websphere 下部署应用报错,请教大侠们

时间:2022-09-16 22:01:10
最近小弟公司的应用要从tomcat转移到was下,但是在部署应用的时候报 如下的错误:
EAR 文件可能已损坏和/或不完整。确保应用程序处于 WebSphere(R) Application Server 当前版本的兼容 Java(TM) Platform, Enterprise Edition(Java EE)级别。
org.eclipse.jst.j2ee.commonarchivecore.internal.exception.DeploymentDescriptorLoadException: WEB-INF/web.xml 

以下是日志的报错

Stack trace of nested exception:
org.eclipse.jst.j2ee.commonarchivecore.internal.exception.ResourceLoadException: IWAE0007E Could not load resource "WEB-INF/web.xml" in archive "C:\webserver\IBM\WebSphere\AppServer\profiles\AppSrv01\wstemp\92668751\upload\svwas.war"
Stack trace of nested exception:
org.eclipse.emf.common.util.WrappedException: org.xml.sax.SAXParseException: 文档类型声明包含的或指向的标记声明必须是格式正确的。
at org.eclipse.wst.common.internal.emf.resource.EMF2SAXRenderer.doLoad(EMF2SAXRenderer.java:142)
at org.eclipse.wst.common.internal.emf.resource.TranslatorResourceImpl.basicDoLoad(TranslatorResourceImpl.java:633)
at org.eclipse.jst.j2ee.internal.xmltrim.XMLTrimResourceImpl.basicDoLoad(XMLTrimResourceImpl.java:231)
at org.eclipse.wst.common.internal.emf.resource.CompatibilityXMIResourceImpl.doLoad(CompatibilityXMIResourceImpl.java:173)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1094)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:900)
at org.eclipse.wst.common.internal.emf.resource.CompatibilityXMIResourceImpl.load(CompatibilityXMIResourceImpl.java:259)
at org.eclipse.wst.common.internal.emf.resource.TranslatorResourceImpl.load(TranslatorResourceImpl.java:589)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:249)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:264)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:390)
at org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.LoadStrategyImpl.getMofResource(LoadStrategyImpl.java:1181)
at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ArchiveImpl.getMofResource(ArchiveImpl.java:2348)
at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ModuleFileImpl.getDeploymentDescriptorResource(ModuleFileImpl.java:258)
at org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.XmlBasedImportStrategyImpl.primLoadDeploymentDescriptor(XmlBasedImportStrategyImpl.java:75)
at org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.War22ImportStrategyImpl.loadDeploymentDescriptor(War22ImportStrategyImpl.java:207)
at org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.War22ImportStrategyImpl.importMetaData(War22ImportStrategyImpl.java:196)
at org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.War22ImportStrategyImpl.importMetaData(War22ImportStrategyImpl.java:203)
at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.WARFileImpl.getDeploymentDescriptor(WARFileImpl.java:416)
at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.WARFileImpl.getDeploymentDescriptor(WARFileImpl.java:368)
at com.ibm.etools.commonarchive.impl.WARFileImpl.isModuleVersionAtLeast25(WARFileImpl.java:917)
at com.ibm.etools.commonarchive.impl.WARFileImpl.patchXMIFiles(WARFileImpl.java:2321)
at com.ibm.etools.commonarchive.impl.WARFileImpl.patchFiles(WARFileImpl.java:2309)
 
Caused by: org.xml.sax.SAXParseException: 文档类型声明包含的或指向的标记声明必须是格式正确的。
 



应用的web.xml如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
<web-app>
    <servlet>
        <servlet-name>action</servlet-name>
        <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
        <init-param>
            <param-name>config</param-name>
            <param-value>/WEB-INF/struts-config.xml</param-value>
            
        </init-param>
        <init-param>
            <param-name>svwass-service-class</param-name>
            <param-value>com.svwass.struts.service.SvwassServiceImpl</param-value>
            
        </init-param>
        <init-param>
            <param-name>debug</param-name>
            <param-value>2</param-value>
            
        </init-param>
        <init-param>
            <param-name>detail</param-name>
            <param-value>2</param-value>
            
        </init-param>
        <init-param>
            <param-name>validate</param-name>
            <param-value>true</param-value>
            
        </init-param>
        <load-on-startup>1</load-on-startup>
        
    </servlet>
    <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
        
    </servlet-mapping>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
        
    </welcome-file-list>
    <resource-ref>
        <description>DB Connection</description>
        <res-ref-name>jdbc/svwas</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
        
    </resource-ref>
    
</web-app>

请问是这个web.xml有问题吗?

6 个解决方案

#1


自己顶up下

#2


哈哈,war文件损坏了。。其实最好不要这种zip压缩文件部署,推荐使用文件夹方式。。。方便同步,部分部署

#3


webshpere有文件夹发布吗?

#4


应该是jar冲突导致解析不了

#5


能否说的具体点吗 麻烦了

#6


我的方法是:先把空项目导出为WAR包,导入进websphere,然后再按照导入的文件路径一次拖入class,jsp等文件

#1


自己顶up下

#2


哈哈,war文件损坏了。。其实最好不要这种zip压缩文件部署,推荐使用文件夹方式。。。方便同步,部分部署

#3


webshpere有文件夹发布吗?

#4


应该是jar冲突导致解析不了

#5


能否说的具体点吗 麻烦了

#6


我的方法是:先把空项目导出为WAR包,导入进websphere,然后再按照导入的文件路径一次拖入class,jsp等文件