my dog learned polymorphism*
The moose likes Struts and the fly likes Integrating Struts2 with BEA Weblogic10 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Integrating Struts2 with BEA Weblogic10" Watch "Integrating Struts2 with BEA Weblogic10" New topic
Author

Integrating Struts2 with BEA Weblogic10

Anurag Swaym
Greenhorn

Joined: Aug 12, 2002
Posts: 14
Hi All -

I am trying a "Hello World" example using Struts2 with Weblogic 10 server, but running into issues. I have followed the correct procedures and have the correct directory structure. I have cross-verified with multiple sites.

But, I am getting 2 Errors while starting the managed weblogic server..not sure if they are inter-related

My first error in the server log file is
<Error> <HTTP> <BEA-101165> <Could not load user defined filter in web.xml: org.apache.struts2.dispatcher.FilterDispatcher.
Unable to load configuration. - action - file:/C:/Project_home/domains/DomainWithClusters/servers/ManagedServer_1/stage/webapps/webapps/WEB-INF/classes/struts.xml:7:61
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:360)

- My web.xml entry is
><filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>

The second error in the stack is -
Action class [/HelloWorldAction] not found - action - file:/C:/Project_home/domains/DomainWithClusters/servers/ManagedServer_1/stage/webapps/webapps/WEB-INF/classes/struts.xml:7:61
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:405)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:355)

Now, I have setup the classpaths correctly by modifying the server startup scripts to load the necessary jars for Struts2...I have placed the jars in the lib folder under webapp\WEB-INF\....but nothing seems to work.

This seems to be specific to Weblogic. Has anybody run into this issue or any ideas on how to resolve them?

Thanks for your help.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8839
    
    7

blore boy wrote:Now, I have setup the classpaths correctly by modifying the server startup scripts to load the necessary jars for Struts2..


The server should not have Struts in its classpath. The correct way to load Struts is to put them in the WEB-INF/lib directory and let the application classloader discover them. If the same classes are in the server classpath the application will not load correctly.
Anurag Swaym
Greenhorn

Joined: Aug 12, 2002
Posts: 14
Thanks for the tip Joe.

But, I initially started out that setup..where-in all the jars were under WEB-INF/lib folder. Because of the error, I started making changes to the classpath and went down that path.

After your suggestion, I have again reverted back to the original configurstion, but still get the

<Error> <HTTP> <BEA-101165> <Could not load user defined filter in web.xml: org.apache.struts2.dispatcher.FilterDispatcher.
Unable to load configuration. - action - file:/C:/Project_home/domains/DomainWithClusters/servers/ManagedServer_1/stage/webapps/webapps/WEB-INF/classes/struts.xml:7:60

and later unable to find the action error

Action class [HelloWorldAction] not found - action - file:/C:/Project_home/domains/DomainWithClusters/servers/ManagedServer_1/stage/webapps/webapps/WEB-INF/classes/struts.xml:7:60
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:405)>
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8839
    
    7

It looks like you aren't the only one with this problem.
Can you deploy the example applications that come with Struts 2?
If you can, then compare the WEB-INF/lib directory of your app with the blank example application.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Do you have a full stack trace? Have you pinged WebLogic support to see if there's a server setting to help get it to work?
Anurag Swaym
Greenhorn

Joined: Aug 12, 2002
Posts: 14
I am trying the empty HelloWorld application using Struts2. I have Struts1 successfully deployed on Weblogic. I have successfully done struts2 using Tomcat with the same folder structure. I identified 2 different exceptions.

The complete stack traces for Exception 1 is:

<Error> <HTTP> <BEA-101165> <Could not load user defined filter in web.xml: org.apache.struts2.dispatcher.FilterDispatcher.
Unable to load configuration. - action - file:/C:/Project_home/domains/DomainWithClusters/servers/ManagedServer_1/stage/webapps/webapps/WEB-INF/classes/struts.xml:7:60
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:360)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:403)
at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:190)
at weblogic.servlet.internal.FilterManager$FilterInitAction.run(FilterManager.java:320)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.servlet.internal.FilterManager.loadFilter(FilterManager.java:88)
at weblogic.servlet.internal.FilterManager.preloadFilters(FilterManager.java:57)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1725)
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2890)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:948)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:353)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:117)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:26)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:635)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:154)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:182)
at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:359)
at weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:51)
at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:196)
at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)
at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:233)
at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169)
at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123)
at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:173)
at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:89)
at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:172)

Stack trace for exception 2 is
Action class [HelloWorldAction] not found - action - file:/C:/Project_home/domains/DomainWithClusters/servers/ManagedServer_1/stage/webapps/webapps/WEB-INF/classes/struts.xml:7:60
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:405)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:355)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:460)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:265)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:189)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:360)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:403)
at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:190)
at weblogic.servlet.internal.FilterManager$FilterInitAction.run(FilterManager.java:320)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.servlet.internal.FilterManager.loadFilter(FilterManager.java:88)
at weblogic.servlet.internal.FilterManager.preloadFilters(FilterManager.java:57)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1725)
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2890)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:948)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:353)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:117)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:26)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:635)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:154)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:182)
at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:359)
at weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:51)
at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:196)
at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)
at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:233)
at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169)
at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123)
at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:173)
at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:89)
at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:172)
>
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:405) - I decompiled XmlConfigurationProvider class. The verifyAction() method has an "URI" as its input parameter and uses the class loader returns a boolean if the action class is present at that location. I verified that the class is present at the specified location in the staging area.

Someone suggested it might be a security/firewall issue. I have turned off all firewall on my computer.

So, not sure whats happening.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8839
    
    7

David Newton wrote:Have you pinged WebLogic support to see if there's a server setting to help get it to work?


I'm running Weblogic Server 10.3 here and I'm not aware of any problems with Struts 2 or settings that would fix this problem.
Speaking of which, are you running 10 or 10.3? There were some weird classpath issues with WLS 10. It appeared that the application classpath would not override the server classpath if I recall correctly. A Struts 1 app I maintain would not run under 10 but runs fine under 10.3. I don't know if the service packs available fix that problem.
Anurag Swaym
Greenhorn

Joined: Aug 12, 2002
Posts: 14
Thanks for replying back Joe.

Thanks David for the tip on pinging Weblogic support. I have not yet pinged weblogic support regarding this issue. I will do it next.

I am currently using Weblogic version10.0.

Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8839
    
    7

Weblogic Server 10 known and resolved issues
There are none identified concerning Struts.
Have you tried deploying the example applications?
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8839
    
    7

I was able to reproduce your problem under WLS 10.3. An application I wrote for Tomcat displays the same behavior you see:


I went into the Struts code and added a println in StrutsXmlConfigurationProvider to see which file is being reloaded: struts-default.xml
I checked the Struts Core jar file and struts-default.xml is in the correct place. As a matter of fact, I think it has to be read at least once to get the framework to the point it fails (hence the call to &quot;reload&quot;).
I spent way too much time trying to figure out the difference between the example apps and my app. It pretty much boils down to one line in struts.xml:



If the value of this line is &quot;true&quot;, the problem occurs. If the value is &quot;false&quot;, the problem does not.
It's a pretty trivial change. Give it a try.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Oh, right; I *knew* I'd seen this:

XWork JIRA ticket
S2 ticket (marked dupe)

Dave
Anurag Swaym
Greenhorn

Joined: Aug 12, 2002
Posts: 14
Allright...I have some closure on this issue.

The issue is related Weblogic 10.0. As Joe mentioned some classpath issues. I thought I had successfully tested struts1.x on Weblogic 10.0, but I was wrong. When I tried struts 1.x, I kept getting variations of FormBean "not found" or "null" errors.

Thanks to Joe Ess suggestion, I upgraded to Weblogic 10.3 and I immediately achieved successful results for both struts1.3 and struts2.0 version without any changes to the existing WAR.

I had a question regarding moving from 10.0 to 10.3. Is it better to upgrade or to completely uninstall 10.0 and then start on 10.3. I have just started building a webapp and do not want to run into issues later.

Thanks Joe and David for your help and suggestions.
sanjay sahu
Ranch Hand

Joined: Mar 28, 2007
Posts: 89
This solution worked for me on Weblogic 9.2 with STRUTS 2...Thanks

If the value of this line is &quot;true&quot;, the problem occurs. If the value is &quot;false&quot;, the problem does not.

Joe Ess wrote:
I spent way too much time trying to figure out the difference between the example apps and my app. It pretty much boils down to one line in struts.xml:



If the value of this line is &quot;true&quot;, the problem occurs. If the value is &quot;false&quot;, the problem does not.
It's a pretty trivial change. Give it a try.




Sanjay<br />SCJP | SCWCD | SCBCD | SCEA | SCEA 5 upgrade
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Integrating Struts2 with BEA Weblogic10
 
Similar Threads
Weblogic 9.2, issue related with struts2, spring and struts2-spring-plugin [installed
unable to find out filter in web.xml
Struts2 Start up error : org.apache.struts2.dispatcher.FilterDispatcher java.lang.NullPointerExcept
Exception in Struts2
Exception in struts2 server startup