为了账号安全,请及时绑定邮箱和手机立即绑定

Intelij 项目中连接到服务器 GlassFish 出错的原因是什么?

Intelij 项目中连接到服务器 GlassFish 出错的原因是什么?

MMMHUHU 2023-10-13 16:34:37
[2019-10-12T11:06:32.875+0300] [glassfish 5.0] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=45 _ThreadName=admin-listener(4)] [timeMillis: 1570867592875] [levelValue: 1000] [[  Exception while deploying the app [web_war_exploded]]][2019-10-12T11:06:32.876+0300] [glassfish 5.0] [SEVERE] [NCLS-CORE-00026] [javax.enterprise.system.core] [tid: _ThreadID=45 _ThreadName=admin-listener(4)] [timeMillis: 1570867592876] [levelValue: 1000] [[  Exception during lifecycle processingjava.io.IOException: org.xml.sax.SAXParseExceptionpublicId: file:/home/vladimir/Downloads/glassfish-5.0/glassfish5/glassfish/lib/schemas/web-app_4_0.xsd; lineNumber: 8; columnNumber: 27; Deployment descriptor file WEB-INF/web.xml in archive [web_war_exploded].  TargetNamespace.1: Expecting namespace 'http://java.sun.com/xml/ns/javaee', but the target namespace of the schema document is 'http://xmlns.jcp.org/xml/ns/javaee'.    at org.glassfish.javaee.core.deployment.DolProvider.processDOL(DolProvider.java:215)    at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:231)    at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:97)    at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:881)    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396)]]
查看完整描述

1 回答

?
互换的青春

TA贡献1797条经验 获得超6个赞

堆栈跟踪之前的长错误消息(为了清晰起见重新格式化)解释了该问题:


java.io.IOException: org.xml.sax.SAXParseException

publicId: 

file:/home/vladimir/Downloads/glassfish-5.0/glassfish5/glassfish/lib/schemas/web-app_4_0.xsd;

lineNumber: 8; columnNumber: 27; 

Deployment descriptor file  in archive [web_war_exploded].  

TargetNamespace.1: 

Expecting namespace

'http://java.sun.com/xml/ns/javaee'

, but the target namespace of the schema document is 

'http://xmlns.jcp.org/xml/ns/javaee'.

因此,Glassfish 架构定义 ( web-app_4_0.xsd ) 中指定的命名空间与您在应用程序的部署描述符 ( WEB-INF/web.xml ) 中提供的命名空间不匹配。


这是 Glassfish 的web-app_4_0.xsd的顶级内容:


<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"

            targetNamespace="http://xmlns.jcp.org/xml/ns/javaee"

            xmlns:javaee="http://xmlns.jcp.org/xml/ns/javaee"

            xmlns:xsd="http://www.w3.org/2001/XMLSchema"

            elementFormDefault="qualified"

            attributeFormDefault="unqualified"

            version="4.0">

...


</xsd:schema>

targetNamespace请注意,为和指定的值xmlns:javaee是您应该在应用程序的web.xml"http://xmlns.jcp.org/xml/ns/javaee"中指定的值,而不是。修理:"http://java.sun.com/xml/ns/javaee"

  • 停止玻璃鱼

  • 在应用程序的web.xml中,将所有出现的 替换http://java.sun.com/xml/ns/javaeehttp://xmlns.jcp.org/xml/ns/javaee

  • 清理、构建和重新部署您的应用程序。

  • 重新启动 Glassfish 服务器。

查看完整回答
反对 回复 2023-10-13
  • 1 回答
  • 0 关注
  • 69 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信