【原创】websphere部署war包报错

应用程序在Tomcat上运行一切正常,但在websphere上部署时报以下错误:
错误 500

处理请求时发生一个错误: /admin/upload.do

消息: WEB-INF/web.xml

详细错误信息为:
com.ibm.etools.archive.exception.DeploymentDescriptorLoadException: WEB-INF/web.xml
嵌套异常的堆栈跟踪:
com.ibm.etools.archive.exception.ResourceLoadException: IWAE0007E 未能在归档“C:\Program Files\WebSphere\AppServer\wstemp\admin\upload\newiweb.war”中装入资源“WEB-INF/web.xml”
嵌套异常的堆栈跟踪:
com.ibm.etools.j2ee.exception.WrappedRuntimeException: IWAE0099E 分析 xml:行号:138:列号:11 时发生了异常
嵌套异常的堆栈跟踪:
org.xml.sax.SAXParseException: 元素类型“web-app”的内容必须匹配“(icon?,display-name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)”。
        at org.apache.xerces.parsers.DOMParser.parse(DOMParser.java:235)
        at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:209)
        at com.ibm.etools.j2ee.xml.bridge.GeneralXmlDocumentReader.parse(GeneralXmlDocumentReader.java:198)
        at com.ibm.etools.j2ee.xml.bridge.GeneralXmlDocumentReader.parseDocument(GeneralXmlDocumentReader.java:221)
        at com.ibm.etools.j2ee.xml.DeploymentDescriptorImportExport.primImportFrom(DeploymentDescriptorImportExport.java:250)
        at com.ibm.etools.j2ee.xml.DeploymentDescriptorImportExport.primImportFrom(DeploymentDescriptorImportExport.java:239)
        at com.ibm.etools.j2ee.xml.WarDeploymentDescriptorImportExport.importFrom(WarDeploymentDescriptorImportExport.java:56)
        at com.ibm.etools.webapplication.impl.WebAppResourceFactory.importXML(WebAppResourceFactory.java:30)
        at com.ibm.etools.j2ee.common.impl.XMLResourceFactory.load(XMLResourceFactory.java:68)
        at com.ibm.etools.j2ee.common.impl.XMLResourceFactory.load(XMLResourceFactory.java:84)
        at com.ibm.etools.emf.resource.impl.ResourceFactoryImpl.load(ResourceFactoryImpl.java:77)
        at com.ibm.etools.emf.resource.impl.ResourceSetImpl.load(ResourceSetImpl.java:289)
        at com.ibm.etools.archive.impl.LoadStrategyImpl.getMofResource(LoadStrategyImpl.java:222)
        at com.ibm.etools.commonarchive.impl.ArchiveImpl.getMofResource(ArchiveImpl.java:528)
        at com.ibm.etools.commonarchive.impl.ModuleFileImpl.getDeploymentDescriptorResource(ModuleFileImpl.java:65)
        at com.ibm.etools.archive.impl.XmlBasedImportStrategyImpl.primLoadDeploymentDescriptor(XmlBasedImportStrategyImpl.java:35)
        at com.ibm.etools.archive.impl.War22ImportStrategyImpl.loadDeploymentDescriptor(War22ImportStrategyImpl.java:72)
        at com.ibm.etools.archive.impl.War22ImportStrategyImpl.importMetaData(War22ImportStrategyImpl.java:67)
        at com.ibm.etools.commonarchive.impl.WARFileImpl.getDeploymentDescriptor(WARFileImpl.java:201)
        at com.ibm.etools.commonarchive.impl.WARFileImpl.getStandardDeploymentDescriptor(WARFileImpl.java:450)
        at com.ibm.etools.commonarchive.impl.ArchiveCopyUtility.copy(ArchiveCopyUtility.java:89)
        at com.ibm.etools.commonarchive.impl.CommonarchiveFactoryImpl.copy(CommonarchiveFactoryImpl.java:126)
        at com.ibm.etools.commonarchive.impl.EARFileImpl.primAddCopyRef(EARFileImpl.java:169)
        at com.ibm.etools.commonarchive.impl.EARFileImpl.addCopyRef(EARFileImpl.java:186)
        at com.ibm.ws.management.application.client.AppInstallHelper.createEarWrapper(AppInstallHelper.java:466)
        at com.ibm.ws.console.appmanagement.action.UploadAction.formUpload(UploadAction.java:181)
        at com.ibm.ws.console.appmanagement.action.UploadAction.perform(UploadAction.java:99)
        at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1791)
        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1586)
        at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
        at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
        at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
        at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
        at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:258)
        at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
        at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
        at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:872)
        at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:491)
        at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:173)
        at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79)
        at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:199)
        at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
        at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:114)
        at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:187)
        at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:331)
        at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
        at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:432)
        at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:343)
        at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))
由于是第一次搞websphere,不知问题所在,在网上查看原因,一开始怀疑是web.xml头<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">有问题,但多次修改后无效,后又怀疑是filter引起的,多次修改还是无效。今天又仔细看了报错原因,“(icon?,display-name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)”。
怀疑是web.xml中段落顺序不对,检查我的web.xml,发现我的session-config标签在servlet标签前,按上面错误提示顺序调整后重新部署,一切ok,笑。原来websphere的语法检查要比tomcat严格得多,

posted on 2014-01-02 13:02  迷途@书童  阅读(1464)  评论(0编辑  收藏  举报

导航