Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebLogic 12c Migration issue with Unmarshalling JAXB

We have an application running currently on WebLogic 10.3.5.0 and we are migrating to WL 12.1.2.0.0. We are experiencing issues with Un-marshalling WS calls to another application. We're familiar with the Marshalling bug when upgrading, however it seems this issue is not the same.

Something weird to note is that it works fine on DEV/Test servers of the same WL version, but will return the following error when deployed locally (must be a env/configuration setting mismatch?):

JAXB unmarshalling exception: null; nested exception is javax.xml.bind.UnmarshalException - with linked exception: [org.xml.sax.SAXParseException; cvc-complex-type.3.2.2: Attribute 'xsi:nil' is not allowed to appear in element 'error'.]

From the error message, it seems that it's not recognizing the xsi namespace or something. The schema has not changed from 10.3.5, and shouldn't be the root of the issue. Anyone have any ideas or even a starting place to look?

Many thanks

Edit: Adding web.xml and weblogic.xml

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="cpc-mi" version="3.0"
    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_3_0.xsd">
...
</web-app>

weblogic.xml

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
        http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd 
        http://xmlns.oracle.com/weblogic/weblogic-web-app 
        http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd" 
    xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
...
</weblogic-web-app>
like image 850
jmeanor Avatar asked Aug 24 '15 17:08

jmeanor


1 Answers

WebLogic 12c (WLS 12c) has its own jar libraries including and jaxb. I already work with this server, and when I want to use JSF (another library that WebLogic comes with) I have to tell WLS 12c that ignore its own JSF libraries and use mine, included in war/ear.

You can use weblogic.xml descriptor inside WEB-INF folder to achieve this. Here you are with one of my weblogic.xml

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app">

  <container-descriptor>
    <prefer-application-packages> 
      <package-name>javax.faces.*</package-name> 
      <package-name>com.sun.faces.*</package-name> 
      <package-name>com.bea.faces.*</package-name> 
      <package-name>org.apache.commons.io.*</package-name>
      <package-name>org.apache.commons.fileupload.*</package-name>
    </prefer-application-packages> 

    <prefer-application-resources> 
      <resource-name>javax.faces.*</resource-name> 
      <resource-name>com.sun.faces.*</resource-name> 
      <resource-name>com.bea.faces.*</resource-name> 
      <resource-name>META-INF/services/javax.servlet.ServletContainerInitializer</resource-name>
      <resource-name>META-INF/services/com.sun.faces.*</resource-name>
    </prefer-application-resources>

    <show-archived-real-path-enabled>true</show-archived-real-path-enabled>
  </container-descriptor>
</weblogic-web-app>

Of course you include your own jaxb dependency into your war/ear and tell WLS 12c ignores its jaxb library, using java.xml.bind.* value for package-name tag and maybe also for the resource-name tag.

Hope it helps.

like image 101
malaguna Avatar answered Nov 08 '22 00:11

malaguna