简体   繁体   English

struts2项目无法在tomcat7中正确部署

[英]struts2 project is not deploying properly in tomcat7

My project runs perfectly in eclipse. 我的项目在Eclipse中完美运行。 But when I export its war file to the tomcat7 on my linux server, it is not unpacking the war file. 但是,当我将其war文件导出到Linux服务器上的tomcat7时,它并没有解压缩war文件。 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. 另一个war文件也有同样的问题,但是当手动解压缩它时就可以了。

I'm not sure what the problem is. 我不确定是什么问题。

My Web.xml is 我的Web.xml是

 <?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 我的struts.xml是

<?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. 我的catalina.out没有显示任何日期。 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. 我已经在stackoverflow下检查了类似的问题,但是我无法弄清楚我的情况出了什么问题。

I have found a workaround. 我找到了一种解决方法。

I have deleted the war file and the folder that I created manually, and then restarted the server. 我已经删除了war文件和手动创建的文件夹,然后重新启动了服务器。 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. 希望这对某人有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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