aspose file tools*
The moose likes Struts and the fly likes Struts2 & XWork Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2 & XWork" Watch "Struts2 & XWork" New topic
Author

Struts2 & XWork

Jennifer Moran
Ranch Hand

Joined: Oct 21, 2002
Posts: 60
Does anyone know what version of Struts2 and XWork work together. I CANNOT get them to work together, I keep getting exceptions when I start my Tomcat Server.

I have tried Struts2 2.0.9 with XWork 2.0.4
Struts 2.1.6 with XWork 2.1.0 and XWork 2.1.2

I keep getting this or something similar

SEVERE: Exception starting filter struts2
Unable to load configuration. - bean - jar:file:/C:/Project%20Workspaces/NetBeans/workspaces/cswebapp/build/web/WEB-INF/lib/struts2-core-2.1.6.jar!/struts-default.xml:78:136
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 org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:221)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:302)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:78)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3635)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4222)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1150)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Caused by: Unable to load bean: type:com.opensymphony.xwork2.validator.ValidatorFactory class:com.opensymphony.xwork2.validator.DefaultValidatorFactory - bean - jar:file:/C:/Project%20Workspaces/NetBeans/workspaces/cswebapp/build/web/WEB-INF/lib/struts2-core-2.1.6.jar!/struts-default.xml:78:136
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:240)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:178)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
... 30 more
Caused by: java.lang.ClassNotFoundException: com.opensymphony.xwork2.validator.DefaultValidatorFactory
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1386)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1232)
at com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:147)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:208)
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

S2.0.9 uses XW2.0.4, S2.1.6 uses XW2.1.2. The issue is likely something else.

Are you using Maven or handling your dependencies manually?
Jennifer Moran
Ranch Hand

Joined: Oct 21, 2002
Posts: 60
Not using Maven. What is Maven?

Jennifer
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Maven

What's the complete list of libraries you're deploying? (And are you sure they're deploying?)

(2.0.9 is a bit long-in-the-tooth, btw; 2.0.14 is current 2.0 release.)
Jennifer Moran
Ranch Hand

Joined: Oct 21, 2002
Posts: 60
Sorry - went home for the night

The libraries included are

antlr-2.7.6.jar
asm.jar
asm-attrs.jar
cglib-2.1.3.jar
commons-collections-2.1.1.jar
commons-logging-1.1.jar
dom4j-1.6.1.jar
ehcache-1.2.3.jar
jdbc2_0-stdext.jar
jta.jar
hibernate3.jar
hibernate-tools.jar
hibernate-annotations.jar
hibernate-commons-annotations.jar
hibernate-entitymanager.jar
javassist.jar
commons-beanutils-1.7.0.jar
commons-chain-1.2.jar
commons-collections-3.2.jar
commons-digester-1.8.jar
commons-fileupload-1.2.1.jar
commons-io-1.3.2.jar
commons-lang-2.3.jar
commons-logging-1.0.4.jar
commons-logging-api-1.1.jar
commons-validator-1.3.1.jar
freemarker-2.3.13.jar
ognl-2.6.11.jar
dogo-plugin-2.1.6.jar

struts2-core-2.0.9.jar
xwork-2.0.4.jar

I think they are being deployed...i am using a new ide (NetBeans) from JBuilder but here is the build info

library-inclusion-in-archive:
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib
Copying 1 file to C:\Project Workspaces\NetBeans\workspaces\cswebapp\build\web\WEB-INF\lib

And like I said, I have replaced the struts core and xwork with both
Struts 2.1.6 with XWork 2.1.0 and XWork 2.1.2
and still not working.

Thanks!!

Jennifer
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8927
    
    9

Notice this line:

Struts is having a problem resolving a dependency, of which there are many.
My advice is to take the version of Struts you want to use, download the "full" distribution, locate the example applications in the "apps" directory, unzip the "struts2-blank-x.x.x.war file and copy the contents of the $UNZIP_DIR/WEB-INF/lib directory to the corresponding directory in your build path.

"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Jennifer Moran
Ranch Hand

Joined: Oct 21, 2002
Posts: 60
Will do.....I'll let you know how it works out.

Thanks!

Jennifer
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You *may* be able to use the 2.1.6 Dojo plugin with S2.0, but you probably shouldn't--S2.0's Dojo tags are built-in.
Jennifer Moran
Ranch Hand

Joined: Oct 21, 2002
Posts: 60
Okay thanks.

J.
Mil Mnj
Greenhorn

Joined: Dec 27, 2008
Posts: 5
You might be missing the commons-fileupload jar. As of 2.1.2, this is no
longer an optional dependency. See if this fixes your problem.

Regards,
Milind
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

It's in the list of jars provided by the OP.
Stevin Lee
Greenhorn

Joined: Sep 11, 2012
Posts: 1
hello Jennifer
this time I have the same problem with you,can you tell me how did you resolve this problem?
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8927
    
    9

Welcome to the Javaranch.
I stand by my post from 3.5 years ago:
My advice is to take the version of Struts you want to use, download the "full" distribution, locate the example applications in the "apps" directory, unzip the "struts2-blank-x.x.x.war file and copy the contents of the $UNZIP_DIR/WEB-INF/lib directory to the corresponding directory in your build path.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts2 & XWork