Java weblogic.descriptor.DescriptorException:解组失败

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19823016/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 20:29:31  来源:igfitidea点击:

weblogic.descriptor.DescriptorException: Unmarshaller failed

javajakarta-eeweblogic-10.x

提问by GabrielBB

When i deploy my WAR in Weblogic 10.3.6 it runs but in weblogic 10.3.0 it throws this:

当我在 Weblogic 10.3.6 中部署我的 WAR 时它会运行,但在 weblogic 10.3.0 中它会抛出这个:

Unable to load descriptor D:\bea103\user_projects\domains\SRVWinplex\Deployments\WinplexAdmin.war/WEB-INF/weblogic.xml of module WinplexAdmin.war. The error is weblogic.descriptor.DescriptorException: Unmarshaller failed at weblogic.descriptor.internal.MarshallerFactory$1.createDescriptor(MarshallerFactory.java:152) at weblogic.descriptor.BasicDescriptorManager.createDescriptor(BasicDescriptorManager.java:306) at weblogic.application.descriptor.AbstractDescriptorLoader2.getDescriptorBeanFromReader(AbstractDescriptorLoader2.java:788) at weblogic.application.descriptor.AbstractDescriptorLoader2.createDescriptorBean(AbstractDescriptorLoader2.java:409) at weblogic.application.descriptor.AbstractDescriptorLoader2.loadDescriptorBeanWithoutPlan(AbstractDescriptorLoader2.java:759) at weblogic.application.descriptor.AbstractDescriptorLoader2.loadDescriptorBean(AbstractDescriptorLoader2.java:768) at weblogic.servlet.internal.WebAppDescriptor.getWeblogicWebAppBean(WebAppDescriptor.java:170)

无法加载模块 WinplexAdmin.war 的描述符 D:\bea103\user_projects\domains\SRVWinplex\Deployments\WinplexAdmin.war/WEB-INF/weblogic.xml。错误是 weblogic.descriptor.DescriptorException: Unmarshaller failed at weblogic.descriptor.internal.MarshallerFactory$1.createDescriptor(MarshallerFactory.java:152) at weblogic.descriptor.BasicDescriptorManager.createDescriptor(BasicDescriptorManager.java:306) at weblogic.application. .AbstractDescriptorLoader2.getDescriptorBeanFromReader(AbstractDescriptorLoader2.java:788) at weblogic.application.descriptor.AbstractDescriptorLoader2.createDescriptorBean(AbstractDescriptorLoader2.java:409) at weblogic.application.descriptor.AbstractLoadDescriptor.java:788.描述符。

It's a problem with the weblogic.xml i guess. This is my weblogic.xml(Without basic tags) :

我猜这是 weblogic.xml 的问题。这是我的 weblogic.xml(没有基本标签):

<jsp-descriptor>
    <keepgenerated>true</keepgenerated>
    <debug>true</debug>
</jsp-descriptor>
<context-root>/WinplexAdmin</context-root>
<library-ref>
    <library-name>jsf</library-name>
    <specification-version>2.0</specification-version>
    <implementation-version>1.0.0.0_2-0-2</implementation-version>
</library-ref>
<container-descriptor>
    <prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
<jsp-descriptor>
    <keepgenerated>true</keepgenerated>
    <debug>true</debug>
</jsp-descriptor>
<context-root>/WinplexAdmin</context-root>
<library-ref>
    <library-name>jsf</library-name>
    <specification-version>2.0</specification-version>
    <implementation-version>1.0.0.0_2-0-2</implementation-version>
</library-ref>
<container-descriptor>
    <prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>

What can be the problem here ?

这里有什么问题?

采纳答案by GabrielBB

Solved. I was compiling with a newer weblogic.jar I mean: I had Weblogic 10.3.6 attached to NetBeans, so it was a different weblogic.xml.

解决了。我正在使用更新的 weblogic.jar 进行编译,我的意思是:我将 Weblogic 10.3.6 附加到 NetBeans,所以它是一个不同的 weblogic.xml。

A correct weblogic.xml for Weblogic 10.3.0 is like this:

Weblogic 10.3.0 的正确 weblogic.xml 如下所示:

<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-web-app http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd">

You can see "http://www.bea.com/" in the xml while a weblogic.xml for Weblogic 11g and etc. has links with "java" or "sun" in it.

您可以在 xml 中看到“ http://www.bea.com/”,而用于 Weblogic 11g 等的 weblogic.xml 中包含带有“java”或“sun”的链接。

I just downloaded Weblogic 10.3.0, attached it to NetBeans, change the server for the project from Weblogic 10.3.6 to 10.3.0 and then re-compile.

我刚刚下载了Weblogic 10.3.0,将其附加到NetBeans,将项目的服务器从Weblogic 10.3.6更改为10.3.0,然后重新编译。

Or... the easy way is just replacing the weblogic.xml code for the one i pasted here and compile.

或者...简单的方法就是将 weblogic.xml 代码替换为我粘贴在这里并编译的代码。

I hope it solves your problem.

我希望它能解决你的问题。

回答by Ronen Festinger

If you use Sun XML Parser and not the default Weblogic XML parser this is what happening:

如果您使用 Sun XML Parser 而不是默认的 Weblogic XML 解析器,则会发生以下情况:

The problem is that the Sun parser fail to parse the web.xml of the apps if in this element:

问题在于,如果在此元素中,Sun 解析器无法解析应用程序的 web.xml:

<web-app version="2.5" metadata-complete="true" 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">

xmlns attribute is after xmlns:xsi attribute.

xmlns 属性在 xmlns:xsi 属性之后。

xmlns attribute must be before xmlns:xsi attribute!

xmlns 属性必须在 xmlns:xsi 属性之前!

Took me very long time to find it.

我花了很长时间才找到它。

回答by manohar e

If the above code is not for you then you can use below one

如果上面的代码不适合你,那么你可以使用下面的

<web-app xmlns="http://java.sun.com/xml/ns/j2ee" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">

回答by Ajin Vijay

If you have tried with the solutions below and still not working, it may due to version mismatches in JavaVersion, try

如果您尝试了以下解决方案但仍然无法正常工作,可能是由于 JavaVersion 中的版本不匹配,请尝试

  1. Click on Windows
  2. Click on Preferences.
  3. Click on Java->Compiler. Check whether it is matching with the version you use in the application. Change the compiler compliance level if not matched
  1. 单击 Windows
  2. 单击首选项。
  3. 单击 Java->编译器。检查它是否与您在应用程序中使用的版本匹配。如果不匹配,请更改编译器合规性级别