问题
When i deploy my WAR in Weblogic 10.3.6 it runs but in weblogic 10.3.0 it throws this:
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)
It's a problem with the weblogic.xml i guess. This is my weblogic.xml(Without basic tags) :
<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 ?
回答1:
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.
A correct weblogic.xml for Weblogic 10.3.0 is like this:
<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.
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.
Or... the easy way is just replacing the weblogic.xml code for the one i pasted here and compile.
I hope it solves your problem.
回答2:
If you use Sun XML Parser and not the default Weblogic XML parser this is what happening:
The problem is that the Sun parser fail to parse the web.xml of the apps if in this element:
<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 attribute must be before xmlns:xsi attribute!
Took me very long time to find it.
回答3:
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">
回答4:
If you have tried with the solutions below and still not working, it may due to version mismatches in JavaVersion, try
- Click on Windows
- Click on Preferences.
- 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
来源:https://stackoverflow.com/questions/19823016/weblogic-descriptor-descriptorexception-unmarshaller-failed