javastruts2weblogicwarweblogic-10.x

Unable to load Action class while deploying struts2.5 war file on weblogic 10.3.6


Unable to load Action error while deploying struts2 war file on weblogic 10.3.6

The above question is very similar to the issue I'm facing but there is no solution provided. I have an application in struts2.5 which I have exported to a *.war file and trying to deploy it to weblogic 10.3.6(running on java7). During deployment I get an error that the Action class is not found (when I can see it present in the war file's WEB-INF/classes).

As mentioned by user3898783 in above link- "What weblogic does during WAR deployment(obviously it internally explodes) it puts all the files reside in web-inf/classes folder into jar called _wl_cls_gen.jar file and copies into web-inf/lib directory under domain stage folder." - similar is my problem. I am currently using the wls:prefer-web-inf-classes"true" /wls:prefer-web-inf-classes configuration in my weblogic.xml file which hasn't really solved my problem.

Weblogic.xml

<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">
     <wls:container-descriptor>
        <wls:prefer-web-inf-classes>true</wls:prefer-web-inf-classes>
     </wls:container-descriptor>
     
        
    <wls:session-descriptor> 
        <wls:cookies-enabled>true</wls:cookies-enabled>
     </wls:session-descriptor>
     
</wls:weblogic-web-app>

<May 23, 2019 1:00:02 AM CDT> <Error> <HTTP> <BEA-101165> <Could not load user defined filter in web.xml: org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.
Unable to load configuration. - action - zip:/apps/bea/wls103/user_projects/domains/mydomain/servers/mymanagedserver/tmp/_WL_user/myapp/4bdx7o/war/WEB-INF/lib/_wl_cls_gen.jar!/struts.xml:16:97
        at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:509)
        at org.apache.struts2.dispatcher.InitOperations.initDispatcher(InitOperations.java:73)
        at org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:61)
        at weblogic.servlet.internal.FilterManager$FilterInitAction.run(FilterManager.java:343)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        Truncated. see log file for complete stacktrace
Caused By: Unable to load configuration. - action - zip:/apps/bea/wls103/user_projects/domains/mydomain/servers/mymanagedserver/tmp/_WL_user/myapp/4bdx7o/war/WEB-INF/lib/_wl_cls_gen.jar!/struts.xml:16:97
        at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)
        at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:957)
        at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:463)
        at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:496)
        at org.apache.struts2.dispatcher.InitOperations.initDispatcher(InitOperations.java:73)
        Truncated. see log file for complete stacktrace
Caused By: Action class [com.myapp.struts.actions.LoginAction] not found - action - zip:/apps/bea/wls103/user_projects/domains/mydomain/servers/mymanagedserver/tmp/_WL_user/myapp/4bdx7o/war/WEB-INF/lib/_wl_cls_gen.jar!/struts.xml:16:97
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:508)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:457)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:572)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:326)
        at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:108)
        Truncated. see log file for complete stacktrace
>

I checked my struts.xml(struts.xml:16:97) - and it is pointing to the LoginAction action class mapping, which obviously its not able to find under the weblogic "../domains/../mymanagedserver/tmp/_WL_user/myapp/4bdx7o/war/WEB-INF/classes"

Thanking you in anticipation


Solution

  • Finally I was able to figure this out. The culprit has been the compiler compliance level in my eclipse project. Although I was using jdk1.7 in my project buildpath, I should have also checked for the projects compiler compliance version in Eclipse which was 1.8 (proj right click> JavaCompiler> I set it to 1.7). Also, I was using javax.servlet-api-3.0.1.jar - I switched to servlet2.5 as I read somewhere that weblogic10.3.x is only compliant upto servlet2.5.

    I hope this helps someone looking for a solution to similar problem.