This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
I'm trying to get a simple Hello World application up and running.
However, every time I try to deploy it, I'm getting an error message
Error filterStart:
<body>
<h2><s:property value="message"/></h2>
If you can see above message, Congrats! You have successfully created your first Struts 2 application.
</body>
</html>
The only clue I have left is the line
INFO: Parsing configuration file [struts-default.xml]
in the log file, as I don't understand what this xml file
is about. I've been hunting about for missing jar files
but I think I've got all the needed ones included by now.
As I've been at 'hello world' for nearly a week,
I am getting ever so slightly frustrated by now.
'Error filterStart' is not very informative, is there a
more effective way to see what's wrong?
Turning on devMode and setting the logging levels to debug is almost always the best and easiest place to start.
You're missing commons-fileupload, which is now a requirement, even if you're not uploading files.
I'm generally wary of including unnecessary plugins (here, SiteMesh) if you're not actually using it. You shouldn't need the spring-context jar if you're not using Spring. If you *are* using Spring, you'll need more than that, and probably want the Struts 2 Spring plugin.
Managing dependencies by hand is... problematic, and I don't really recommend it. A simple "hello, world" app, however, really only needs: commons-io, commons-fileupload, commons-logging (both), freemarker, ognl, struts2-core, and xwork. (Might need beanutils and collections, but I don't think so).
Note that there are several dependency browsers available both standalone and online. For example, see here for Struts 2.1.6-core dependencies. (According to that you don't need commons-logging, too, but I've never used S2 w/o it, so I have no idea. In general I usually recommend putting a logging package in there too, like Log4J or SLF4J or whatever.)
Marc Brevoort
Greenhorn
Joined: Mar 31, 2009
Posts: 3
posted
0
A simple "hello, world" app, however, really only needs: commons-io, commons-fileupload, commons-logging (both), freemarker, ognl, struts2-core, and xwork.
Indeed. I threw away all jars and re-included just those and that solved it. Thank you very much!
also added and removed commons-logging-api.jar for checking weather it is running by this trial and error or not. But it is still not working.
Any one please help me.
Marc Brevoort
Greenhorn
Joined: Mar 31, 2009
Posts: 3
posted
0
> Hi, all I am having same problem. I have also removed all unnecessary jars but the problem still remain.
Obviously you're using the right JAR files (by the way, I managed to get things running in the end)
If things aren't working, probably your application isn't finding them.
Take a look at your classpath settings.
Also, take some time looking at the .war file that is being generated; a .war file is simply
a zipped archive, and you should be able to see if all required jar files have been
included in there.
I was able to resolve that issue after seeing the tomcat log details. Actual problem relies here
1) There are two struts.xml & example.xml files in the classpath, so it is unable to start an application properly.
problem message in loggers :- Caused by: The package name 'roseindia' at location package -....... is already been used by another package at location package - .....
console message :- Error filterStart:
solution :- you can comment out the jar command of compile tag in the build.xml, so that there will be only one distinct files/package.
2) after that check the required jar files, if we wont get any result and errors,
solution: you just keep the jars mentioned in the struts2-blank.zip.
By following the above steps , I was able to resolve the issues.
You need to check the Tomcat Logs... I'm using Tomcat 7
<Tomcat>\logs\localhost.YYYY-MM-DD
Dec 12, 2011 8:07:30 PM org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter <project name>
java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:198)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:180)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:380)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:424)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:103)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4624)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5281)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:866)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:842)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1095)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1617)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.StringUtils
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1533)
... 26 more
The fix is just to include the commons-lang-2.5 JAR
You need to check for the right version .. you can check it from the manifest.mf file where the version of the jar is specified as it might be possible that the jar you are downloading is with the wrong tag.
Also, If you are not able to solve the problem post the code with list of jar and log file here.
Regards
Jatan