Вопрос

I have a problem with a Webservice deployed in JBoss EAP 6. I have a war file, that war contains a WS, but, that war originally was developed and tested in a Weblogic 11 AS; and everything works fine BUT my boss said that my war can deploys in other server (JBoss) that he has mounted in other computer.

Everything is normal, but in the response, the date is different, i mean, in Weblogic, it appears like this:

 <birthday class="com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl"> 
  <year>1952</year> 
  <month>4</month> 
  <day>17</day> 
  <timezone>-360</timezone> 
  <hour>0</hour> 
  <minute>0</minute> 
  <second>0</second> 
  <fractionalSecond>0.000</fractionalSecond> 
</birthday>

So, in JBoss EAP 6, the date appears whit more fields, like this:

<birthday class="org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl"> 
  <orig__year>1944</orig__year> 
  <orig__month>3</orig__month> 
  <orig__day>1</orig__day>
  <orig__hour>0</orig__hour> 
  <orig__minute>0</orig__minute> 
  <orig__second>0</orig__second> 
  <orig__fracSeconds>0.000</orig__fracSeconds> 
  <orig__timezone>-300</orig__timezone> 
  <year>1944</year> 
  <month>3</month> 
  <day>1</day> 
  <timezone>-300</timezone> 
  <hour>0</hour>
  <minute>0</minute> 
  <second>0</second> 
  <fractionalSecond>0.000</fractionalSecond> 
</birthday>

My question is, how can i switch the implementation of the de/serializer for this data type? It seems, Weblogic uses the JDK interal classes to make the job, but JBoss uses it's own implementation.

I read about to add a xml file (jboss-deployment-structure.xml) to the war archive, i integrate one xml, like this:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
  <deployment>
     <exclusions>
      <module name="org.apache.xerces" />
     </exclusions>
     <dependencies>
        <module name="sun.jdk" >
        </module>
      <system>
        <paths>
      <path name="com/sun/org/apache/xerces/internal/jaxp/datatype"/>
        </paths>
      </system>
    </dependencies>
  </deployment>
</jboss-deployment-structure>

If i understood well, that xml avoids the use of the JBoss XML implementation (xerces) then i can use the internal classes of the JDK; but the result is the same, any ideas?

Это было полезно?

Решение

I resolve my issue in this form:

I change the default xerces implementation, in this path

{JBOSS_HOME}\modules\system\layers\base\org\apache\xerces\main

I add two files: jaxp-api-1.4.5.jar and jaxp-ri-1.4.5.

And in the module.xml i made a change for the jar declared as a resource root, like this:

<module xmlns="urn:jboss:module:1.1" name="org.apache.xerces">
    <resources>
        <!--<resource-root path="xercesImpl-2.9.1-redhat-4.jar"/> -->
        <resource-root path="jaxp-ri-1.4.5.jar"/>
    </resources>
    <dependencies>
        <module name="javax.api"/>
    </dependencies>
</module>

Now, my xml comes with the desired XMLGregorianCalendar implementation. Cheers.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top