cunisia
cunisia

Reputation: 140

unable to deploy struts2 war on tomcat7

I feel really stupid right now but I've been struggling all day long and I don't have a clue, some help would be kindly appreciated :)

I've developped a struts2 webapp which works fine when I run it through eclipse (indigo sr2) related to my servelt server apache tomcat 7.0.27 installed on my own computer. All I do is : right click on the folder of my webapp --> run as --> run on server. Then it runs nicely either in eclipse browser, or in other browser (chrome, firefox) when I copy and path the url adress of my servlets.

Now all I'd like to do is make it run without eclipse. So I exported my webapp in a .war file (right click on the webapp folder --> export --> War file), and tried to deploy it using the app manager tomcat web interface : all it asked me to do was to browse for the war file through my computer and to click on the deploy button. Easy going so far !

Then my webapp appears in the applications tab of the app manager interface, but when I click on the "run" button, all I get is this message :

Failure : application for the context path /MMSProject could not start

(the original message is in French, I did not find how to change tomcat7 language, so this might not be the exact message you'd have in english, I hope this translation is close enough. MMSProject is the name of my webapp).

Therefore, I downloaded some struts2 webapp examples on the struts2 website and tried to deploy struts2-blank on tomcat7 using the same process. This one works perfectly fine : I can run it from tomcat app manager. So I guess my problem comes from my own war file and not from tomcat itself, but since it's generated by eclipse it seems weird to me that this part of the process could go wrong.

And so I'm stuck with that. Would you guys know :

Thank you very much in advance for any help ! I'm kind of desperate right now, did not think deployment would be such a pain !

EDIT : I've double checked tomcat's log and actually found this in catalina.[date].log:

  • Grave: Error filterStart juin 21, 2012 1:48:42 PM org.apache.catalina.core.StandardContext startInternal
  • Severe: Context [/MMSproject] startup failed due to previous errors
  • juin 21, 2012 1:48:42 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
  • Grave: The web application [/MMSproject] created a ThreadLocal with key of type [com.opensymphony.xwork2.inject.ContainerImpl$10] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@2de3bcb5]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@427a269c]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
  • juin 21, 2012 1:48:42 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
  • Grave: The web application [/MMSproject] created a ThreadLocal with key of type [com.opensymphony.xwork2.inject.ContainerImpl$10] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@617ceddc]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@50e43884]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

and this in localhost.[date].localhost :

juin 21, 2012 1:48:42 PM org.apache.catalina.core.StandardContext filterStart SEVERE: Exception starting filter struts2 java.lang.NullPointerException at com.opensymphony.xwork2.util.FileManager$FileRevision.needsReloading(FileManager.java:209) at com.opensymphony.xwork2.util.FileManager.fileNeedsReloading(FileManager.java:60) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.needsReload(XmlConfigurationProvider.java:325) at org.apache.struts2.config.StrutsXmlConfigurationProvider.needsReload(StrutsXmlConfigurationProvider.java:168) at com.opensymphony.xwork2.config.ConfigurationManager.conditionalReload(ConfigurationManager.java:220) at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:61) at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:774) at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:191) 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.(ApplicationFilterConfig.java:103) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4638) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5294) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1247) at org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:747) at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:222) at javax.servlet.http.HttpServlet.service(HttpServlet.java:641) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:186) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:581) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)

Upvotes: 1

Views: 2628

Answers (1)

cunisia
cunisia

Reputation: 140

Ok, so I found the anwser and wanted to post it in order to help someone who would have te same issue !

It's a tiny detail but it may save you a lot of struggling and praying time once you know it: before deploying don't forget to switch the struts devMode to false (in struts.xml file) if you had decided to use it at the begining of you development (ie : maybe some few hard coding weeks ago !).

So basically this is what you wanna have in struts.xml :

<constant name="struts.devMode" value="false" />

instead of :

<constant name="struts.devMode" value="true" />

Good luck everybody !

Upvotes: 4

Related Questions