简体   繁体   中英

struts2 project is not deploying properly in tomcat7

My project runs perfectly in eclipse. But when I export its war file to the tomcat7 on my linux server, it is not unpacking the war file. Even after I do it manually, it says the requested resource is not available

The other war file also had the same problem.But when unpack it manually it worked.

I'm not sure what the problem is.

My Web.xml is

 <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" 
    xmlns="http://java.sun.com/xml/ns/javaee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>  
  <filter>
  <filter-name>struts2</filter-name>
  <filter-class>
        org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
  </filter>
  <filter-mapping>
  <filter-name>struts2</filter-name>
  <url-pattern>/*</url-pattern>
  </filter-mapping>
   <session-config>
         <session-timeout>-1</session-timeout>
 </session-config>
</web-app>

And my struts.xml is

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration
2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
    <package name="" extends="struts-default">
        <action name="effort" class="EffortAction">
            <result name="success">index.jsp</result>
        </action>
        <action name="Finance_Report" class="EffortAction">
            <result name="success">Report.jsp</result>
        </action>
        <action name="Pivot" class="Downloads">
            <result name="success" type="stream">
                <param name="contentType">application/octet-stream</param>
                <param name="inputName">fileInputStream</param>
                <param name="contentDisposition">attachment;filename="Finance_Pivot.xls"</param>
                <param name="bufferSize">1024</param>
            </result>
        </action>       
    </package>
</struts> 

The library files that I use are

commons-fileupload-1.3.1.jar
commons-io-2.2.jar
commons-lang-2.4.jar
commons-lang3-3.1.jar
commons-logging-1.1.3.jar
commons-logging-api-1.1.jar
freemarker-2.3.19.jar
javassist-3.11.0.GA.jar
ognl-3.0.6.jar
sqljdbc4.jar
struts2-core-2.3.16.1.jar
SX.jar
xwork-core-2.3.16.1.jar

My catalina.out do not show anything for todays date. But showed something like the below on a previous date.

INFO: Undeploying context [/FinanceReport]
May 27, 2014 1:42:48 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application [/FinanceReport] registered the JDBC driver [com.microsoft.sqlserver.jdbc.SQLServerDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
May 27, 2014 1:42:48 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/FinanceReport] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@18a2c34]) and a value of type [com.opensymphony.xwork2.inject.ContainerImpl] (value [com.opensymphony.xwork2.inject.ContainerImpl@1feb1c3]) 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.
May 27, 2014 1:42:48 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/FinanceReport] created a ThreadLocal with key of type [com.microsoft.sqlserver.jdbc.ActivityCorrelator$1] (value [com.microsoft.sqlserver.jdbc.ActivityCorrelator$1@1bd63cb]) and a value of type [com.microsoft.sqlserver.jdbc.ActivityId] (value [66662bbe-1458-4ce9-b739-16fd806f8c7a-2]) 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.
Exception in thread "ContainerBackgroundProcessor[StandardEngine[Catalina]]" java.lang.InternalError: Malformed class name
    at java.lang.Class.getSimpleName(Class.java:1317)
    at java.lang.Class.getCanonicalName(Class.java:1386)
    at org.apache.catalina.loader.WebappClassLoader.getPrettyClassName(WebappClassLoader.java:2601)
    at org.apache.catalina.loader.WebappClassLoader.checkThreadLocalMapForLeaks(WebappClassLoader.java:2571)
    at org.apache.catalina.loader.WebappClassLoader.checkThreadLocalsForLeaks(WebappClassLoader.java:2507)
    at org.apache.catalina.loader.WebappClassLoader.clearReferences(WebappClassLoader.java:2013)
    at org.apache.catalina.loader.WebappClassLoader.stop(WebappClassLoader.java:1908)
    at org.apache.catalina.loader.WebappLoader.stopInternal(WebappLoader.java:661)
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
    at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5702)
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
    at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:1028)
    at org.apache.catalina.startup.HostConfig.undeploy(HostConfig.java:1478)
    at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1406)
    at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1626)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:328)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1374)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1530)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1540)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1519)
    at java.lang.Thread.run(Thread.java:745)

I have checked similar question under stackoverflow, but I am unable to figure out what goes wrong in my case.

I have found a workaround.

I have deleted the war file and the folder that I created manually, and then restarted the server. Now I deployed the war once again, and it worked. But I am not sure what was the reason that blocking me previously.

Hope this helps someone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM