Hello World Tutorial Problem

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Hello World Tutorial Problem

Qhaz
Hi!

I followed the instructions from the Hello World Tutorial:
http://javachamp.blogspot.com/2008/07/struts-2-hello-world-example.html

I set up the Dynamic Web Project in Eclipse and created the suggested folder structure. I'm using Tomcat 6. Somehow after running the project the action class cannot be found - however the classpath is ok, and the class file is already there. The same problem was mentioned in the comments below tutorial, however there was no solution.

I'll be gratefull for help.

[EDIT] OK, the problem I had was when I was running the project from eclipse. I exported the project as war and put it in the tomcat webapps folder....and it works. It must be some kind of eclipse problem.  Still if anyone had the same problem with eclipse, I'll e happy to know the solution.

Here is my stacktrace:

SEVERE: Exception starting filter struts2
Unable to load configuration. - action - file:/C:/Documents%20and%20Settings/Robercik/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/OLA/WEB-INF/classes/struts.xml:7:37
        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:275)
        at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
        at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
        at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3709)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4363)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
        at org.apache.catalina.core.StandardService.start(StandardService.java:516)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: Action class [org.vinod.action.HelloWorld] not found - action - file:/C:/Documents%20and%20Settings/Robercik/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/OLA/WEB-INF/classes/struts.xml:7:37
        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)
        ... 21 more
Reply | Threaded
Open this post in threaded view
|

Re: Hello World Tutorial Problem

adamruggles
I used the web tool project with eclipse and it works well.  However I have noticed that sometimes it does not copy the configuration files.  I'm guess this might be what is happening.  I usually have to do a clean build to and the republish to have it work correctly.