1 2 Previous Next 28 Replies Latest reply on Jan 29, 2016 9:59 AM by sgoschin

    JBoss 7 Oracle XMLType retrieval problem

    knightblue610

      We have been using JBoss 6.1.0.Final with Hibernate 4.2 with a custom UserType to map Oracle XMLType columns to our Hibernate entities.  In order to do so, I added the files ojdbc6.jar, xmlparserv2.jar, orai18n.jar, orai18n-collation.jar, and xmlparserv2.jar to the $JBOSS_HOME/lib directory.  It works quite well.

       

      We would like to move to JBoss 7.1.3.Final, and so I created a module called "com.oracle.ojdbc6" by creating $JBOSS_HOME/modules/com/oracle/ojdbc6/main and putting the same JAR files in there.  This is what my module.xml looks like:

       

      {code:xml}<?xml version="1.0" ?>{code}

       

      {code:xml}

      <module xmlns="urn:jboss:module:1.1" name="com.oracle.ojdbc6">

          <resources>

              <resource-root path="ojdbc6.jar"/>   

              <resource-root path="xdb6.jar"/>

              <resource-root path="xmlparserv2.jar"/>

              <resource-root path="orai18n-collation.jar"/>

              <resource-root path="orai18n.jar"/>

              <resource-root path="xercesImpl.jar" />

       

              <!-- Insert resources here -->

          </resources>

        <dependencies>

          <module name="javax.api"/>

          <module name="javax.transaction.api"/>

        </dependencies>

      </module>

      {code}

       

      Then I added the dependency through jboss-deployment-structure.xml in our EAR file in the appropriate location (Hibernate dependencies are excluded because the version of Hibernate that we were using was newer than what came with 7.1.3):

       

      {code:xml}

      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">

        <ear-subdeployments-isolated>false</ear-subdeployments-isolated>

        <deployment>

          <exclusions>

            <module name="org.hibernate" slot="main"/>

          </exclusions>

          <dependencies>

             <module name="org.slf4j.ext" slot="main" />

             <module name="org.apache.log4j" slot="main" />

          </dependencies>   

        </deployment>

       

        <sub-deployment name="updater-1.2.0-SNAPSHOT.war">
            <exclusions>
                <module name="org.hibernate" slot="main"/>
            </exclusions>

          <dependencies>       <module name="org.slf4j.ext" slot="main" />

             <module name="org.apache.log4j" slot="main" />

             <module name="com.oracle.ojdbc6" slot="main" />

             <module name="deployment.gdm-ear.ear.common-1.2.0-SNAPSHOT.jar" />

          </dependencies>     

        </sub-deployment>  

       

        <sub-deployment name="collator-1.1.0-SNAPSHOT.war">

          <dependencies>
             <module name="org.slf4j.ext" slot="main" />
             <module name="org.apache.log4j" slot="main" />
             <module name="com.oracle.ojdbc6" slot="main" />

          </dependencies>     

        </sub-deployment> 

       

        <sub-deployment name="audit-1.0.2-SNAPSHOT.war">

          <dependencies>
             <module name="org.slf4j.ext" slot="main" />
             <module name="org.apache.log4j" slot="main" />
          </dependencies>       

        </sub-deployment>

       

        <sub-deployment name="common-1.2.0-SNAPSHOT.jar">

          <dependencies>

             <module name="org.slf4j.ext" slot="main" />

             <module name="org.apache.log4j" slot="main" />

             <module name="com.oracle.ojdbc6" slot="main" />

          </dependencies>

        </sub-deployment>

      </jboss-deployment-structure>

      {code}

       

      The code deploys and runs up to the point where it retrieves an XMLType from the database using nullSafeGet.  Here is that method:

       

      {code}

      @Override

      public Object nullSafeGet(ResultSet rs, String[] names,

              SessionImplementor session, Object owner)

              throws HibernateException, SQLException

      {

          XMLType xmlData = (XMLType) rs.getSQLXML(names[0]);

          XMLDocument doc;

       

          if (xmlData == null)

          {

              doc = null;

          }

          else

          {

              try

              {

                  BinXMLStream stream = xmlData.getBinXMLStream();

                  BinXMLDecoder decoder = stream.getDecoder();

                  InfosetReader reader = decoder.getReader();

       

                  XMLDOMImplementation domImpl = new XMLDOMImplementation();

       

                  domImpl.setAttribute(XMLDocument.SCALABLE_DOM, true);

                  domImpl.setAttribute(XMLDocument.ACCESS_MODE,

                          XMLDocument.UPDATEABLE);

       

                  doc = (XMLDocument) domImpl.createDocument(reader);   

              }   

              catch (IllegalArgumentException e)   

              {   

                  throw new HibernateException(e);   

              }   

              catch (DOMException e)   

              {   

                  throw new HibernateException(e);   

              }   

              catch (BinXMLException e)   

              {   

                  throw new HibernateException(e);   

              }   

              finally   

              {   

                  if(xmlData != null)   

                  {   

                      xmlData.close();

                  }   

              }   

          }   

      }

      {code}

       

      When the code reaches this line:

      {code}

      XMLType xmlData = (XMLType) rs.getSQLXML(names[0]);

      {code}

       

      I see this exception:

      {code}

      11:54:09,034 WARN  [org.jboss.jca.core.connectionmanager.listener.NoTxConnectionListener] (trChannelTaskExecutor-1) IJ000305: Connection error occured: org.jboss.jca.core.connectionmanager.listener.NoTxConnectionListener@78a8ac79[state=NORMAL managed connection=org.jboss.jca.adapters.jdbc.local.LocalManagedConnection@2dfd574b connection handles=1 lastUse=1356717165759 trackByTx=false pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@536e1483 pool internal context=SemaphoreArrayListManagedConnectionPool@6004cf3f[pool=tl]]: java.lang.NullPointerException

          at oracle.jdbc.driver.NamedTypeAccessor.getOracleObject(NamedTypeAccessor.java:302) [ojdbc6.jar:11.2.0.3.0]

          at oracle.jdbc.driver.NamedTypeAccessor.getSQLXML(NamedTypeAccessor.java:413) [ojdbc6.jar:11.2.0.3.0]

          at oracle.jdbc.driver.OracleResultSetImpl.getSQLXML(OracleResultSetImpl.java:1251) [ojdbc6.jar:11.2.0.3.0]

          at oracle.jdbc.driver.OracleResultSet.getSQLXML(OracleResultSet.java:488) [ojdbc6.jar:11.2.0.3.0]

          at org.jboss.jca.adapters.jdbc.WrappedResultSet.getSQLXML(WrappedResultSet.java:3264)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_33]

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_33]

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_33]

          at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_33]
          at org.hibernate.engine.jdbc.internal.proxy.AbstractResultSetProxyHandler.continueInvocation(AbstractResultSetProxyHandler.java:104) [hibernate-core-4.1.1.Final.jar:4.1.1.Final]
          at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81) [hibernate-core-4.1.1.Final.jar:4.1.1.Final]

          at $Proxy73.getSQLXML(Unknown Source)    at com.acxiom.dnb.toplayer.types.HibernateXMLDocument.nullSafeGet(HibernateXMLDocument.java:89) [common-1.2.0-SNAPSHOT.jar:]

          at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:124) [hibernate-core-4.1.1.Final.jar:4.1.1.Final]

          at org.hibernate.type.AbstractType.hydrate(AbstractType.java:106) [hibernate-core-4.1.1.Final.jar:4.1.1.Final]

          at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2702) [hibernate-core-4.1.1.Final.jar:4.1.1.Final]

          at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1541) [hibernate-core-4.1.1.Final.jar:4.1.1.Final]

          at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1473) [hibernate-core-4.1.1.Final.jar:4.1.1.Final]

          at org.hibernate.loader.Loader.getRow(Loader.java:1373) [hibernate-core-4.1.1.Final.jar:4.1.1.Final]

          at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:640) [hibernate-core-4.1.1.Final.jar:4.1.1.Final]

          at org.hibernate.loader.Loader.doQuery(Loader.java:850) [hibernate-core-4.1.1.Final.jar:4.1.1.Final]

          at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:289) [hibernate-core-4.1.1.Final.jar:4.1.1.Final]

          at org.hibernate.loader.Loader.doList(Loader.java:2447) [hibernate-core-4.1.1.Final.jar:4.1.1.Final]

          at org.hibernate.loader.Loader.doList(Loader.java:2433) [hibernate-core-4.1.1.Final.jar:4.1.1.Final]

          at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2263) [hibernate-core-4.1.1.Final.jar:4.1.1.Final]

          at org.hibernate.loader.Loader.list(Loader.java:2258) [hibernate-core-4.1.1.Final.jar:4.1.1.Final]

          at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:331) [hibernate-core-4.1.1.Final.jar:4.1.1.Final]

          at org.hibernate.internal.SessionImpl.listCustomQuery(SessionImpl.java:1697) [hibernate-core-4.1.1.Final.jar:4.1.1.Final]

          at org.hibernate.internal.AbstractSessionImpl.list(AbstractSessionImpl.java:227) [hibernate-core-4.1.1.Final.jar:4.1.1.Final]

          at org.hibernate.internal.SQLQueryImpl.list(SQLQueryImpl.java:156) [hibernate-core-4.1.1.Final.jar:4.1.1.Final]

          at com.acxiom.dnb.toplayer.gdm.dao.impl.GdmCombinedDaoImpl.getRecord(GdmCombinedDaoImpl.java:90) [common-1.2.0-SNAPSHOT.jar:]

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_33]

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_33]

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_33]

          at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_33]

          at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]

          at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]

          at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]

          at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) [spring-tx-3.1.2.RELEASE.jar:3.1.2.RELEASE]

          at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]

          at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) [spring-aop-3.1.2.RELEASE.jar:3.1.2.RELEASE]

          at $Proxy63.getRecord(Unknown Source)    at com.acxiom.dnb.toplayer.gdm.updater.impl.GdmUpdateManagerImpl.updateGdm_aroundBody0(GdmUpdateManagerImpl.java:90) [classes:]

          at com.acxiom.dnb.toplayer.gdm.updater.impl.GdmUpdateManagerImpl.updateGdm_aroundBody1$advice(GdmUpdateManagerImpl.java:25) [classes:]

          at com.acxiom.dnb.toplayer.gdm.updater.impl.GdmUpdateManagerImpl.updateGdm(GdmUpdateManagerImpl.java:1) [classes:]

          at com.acxiom.dnb.toplayer.gdm.updater.locking.GDMUpdaterLocking.processUpdates(GDMUpdaterLocking.java:180) [classes:]

          at com.acxiom.dnb.toplayer.gdm.updater.locking.GDMUpdaterLocking.processUpdate(GDMUpdaterLocking.java:113) [classes:]

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_33]

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_33]

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_33]

          at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_33]

          at org.springframework.expression.spel.support.ReflectiveMethodExecutor.execute(ReflectiveMethodExecutor.java:69) [spring-expression-3.1.2.RELEASE.jar:3.1.2.RELEASE]

          at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:109) [spring-expression-3.1.2.RELEASE.jar:3.1.2.RELEASE]

          at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:57) [spring-expression-3.1.2.RELEASE.jar:3.1.2.RELEASE]

          at org.springframework.expression.spel.ast.SpelNodeImpl.getTypedValue(SpelNodeImpl.java:102) [spring-expression-3.1.2.RELEASE.jar:3.1.2.RELEASE]

          at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:102) [spring-expression-3.1.2.RELEASE.jar:3.1.2.RELEASE]

          at org.springframework.integration.util.AbstractExpressionEvaluator.evaluateExpression(AbstractExpressionEvaluator.java:126) [spring-integration-core-2.1.3.RELEASE.jar:]

          at org.springframework.integration.util.MessagingMethodInvokerHelper.processInternal(MessagingMethodInvokerHelper.java:225) [spring-integration-core-2.1.3.RELEASE.jar:]

          at org.springframework.integration.util.MessagingMethodInvokerHelper.process(MessagingMethodInvokerHelper.java:125) [spring-integration-core-2.1.3.RELEASE.jar:]

          at org.springframework.integration.handler.MethodInvokingMessageProcessor.processMessage(MethodInvokingMessageProcessor.java:73) [spring-integration-core-2.1.3.RELEASE.jar:]

          at org.springframework.integration.handler.ServiceActivatingHandler.handleRequestMessage(ServiceActivatingHandler.java:67) [spring-integration-core-2.1.3.RELEASE.jar:]

          at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:97) [spring-integration-core-2.1.3.RELEASE.jar:]

          at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73) [spring-integration-core-2.1.3.RELEASE.jar:]

          at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:115) [spring-integration-core-2.1.3.RELEASE.jar:]

          at org.springframework.integration.dispatcher.UnicastingDispatcher.access$000(UnicastingDispatcher.java:52) [spring-integration-core-2.1.3.RELEASE.jar:]

          at org.springframework.integration.dispatcher.UnicastingDispatcher$1.run(UnicastingDispatcher.java:97) [spring-integration-core-2.1.3.RELEASE.jar:]

          at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:52) [spring-integration-core-2.1.3.RELEASE.jar:]

          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_33]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_33]

          at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_33]

      {code}

       

      Keep in mind that this worked in JBoss 6, and at that point, we've got a native OracleResultSet, so connections aren't an issue.  I think that there is a type internally to Oracle that is not being loaded by the same classloader, but I'm not sure.  Does anyone have any ideas as to what is going on?

       

       

        • 1. Re: JBoss 7 Oracle XMLType retrieval problem
          knightblue610

          My apologies for the formatting... the wiki appears to ignore {code} tags.

          • 2. Re: JBoss 7 Oracle XMLType retrieval problem
            dmwm67

            I spent most of yesterday working on this and eventually got something working by making the oracle driver module global. Don't think that this should be necessary, but it worked for me.

             

            Oracle Driver:

             

            modules/oracle/driver/main

             

            Files: ojdbc6.jar, xdb6.jar and xmlparserv2.jar

             

            module.xml:

             

            <module xmlns="urn:jboss:module:1.0" name="oracle.driver">

               <resources>

                   <resource-root path="xdb6.jar"/>

                   <resource-root path="xmlparserv2.jar"/>

                   <resource-root path="ojdbc6.jar"/>

               </resources>

               <dependencies>

                   <module name="javax.api"/>

                   <module name="javax.transaction.api"/>

               </dependencies>

            </module>

             

            In my standalone.xml I defined the module as global:

             

            (lookfor <subsystem xmlns="urn:jboss:domain:ee:1.0"/> and make it like this:

             

            <subsystem xmlns="urn:jboss:domain:ee:1.0"/>

               <global-modules>

                    <module name="oracle.driver" slot="main"/>

               </global-modules>

            </subsystem>

             

            And define your oracle driver in the drivers section:

             

            <driver name="ojbdc6" module="oracle.driver">

                <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>

            </driver>

            1 of 1 people found this helpful
            • 3. Re: JBoss 7 Oracle XMLType retrieval problem
              knightblue610

              Thank you SO much for your help.  I was pretty lost!

               

              I made it a global module... and now the xmlparserv2.jar file has overridden the default XML parser, so my Spring configuration ends up busted. (See http://stackoverflow.com/questions/5005901/duplicated-definition-for-identifiedtype).  I created a META-INF/services/java.xml.parsers.DocumentBuilderFactory SPI override in my EAR file, but now because of the global module, JBoss appears to ignore it.  Do you know how I can force it to use the older Xerces implementation?

              • 4. Re: JBoss 7 Oracle XMLType retrieval problem
                dmwm67

                I haven't tried this, but from what I have read it should be as easy as specifying the following system property

                 

                -Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl

                 

                Try setting JAVA_OPTS to include this definition and see if that resolves the Spring issue

                • 5. Re: JBoss 7 Oracle XMLType retrieval problem
                  sfcoy

                  Normally, you would not need to make your oracle.driver module global because all data access is made through the javax.sql.DataSource interface.

                   

                  However, in your case both your user code and the JBoss Hibernate code need visibility of some of the Oracle classes in the module, and the simplest solution is to make it global.

                  1 of 1 people found this helpful
                  • 6. Re: JBoss 7 Oracle XMLType retrieval problem
                    sfcoy

                    The last time I tried something like this (for an embedded solution) it didn't work because JBoss seizes control of this very early in it's startup process and forces the use of it's own parsers.

                     

                    That said, In your case(s) I would be tempted to try and get it working without any of the Oracle provided XML parsers (remove them from the module), using the JRE/JBoss provided implementations instead.

                    • 7. Re: JBoss 7 Oracle XMLType retrieval problem
                      knightblue610

                      I'll give it a try anyway; it's worth a shot.  Thanks for your responses.  Unfortunately, there's simply no way to get XMLType features working with Oracle without the parser.  I've tried this before, and from all the Google searching that I've done, I've never seen anyone manage to get it to work after Oracle 11.  Besides, we actually use the parser, as it performs better, though we have to use it explicitly as it doesn't play well with Spring.

                       

                      May I ask why JBoss is ignoring my SPI override in my EAR file?  I would guess, based on the https://docs.jboss.org/author/display/AS71/Class+Loading+in+AS7 document, that the system classloader is taking precedence; can I override the service entry through jboss-deployment-structure-xml? 

                       

                      Also, silly question I know but I'm new to the forums... how do I get the forums to format my code properly?  The instructions say to use {code}, but that doesn't seem to work...

                      • 8. Re: JBoss 7 Oracle XMLType retrieval problem
                        sfcoy

                        Brad M wrote:

                        ...

                        Also, silly question I know but I'm new to the forums... how do I get the forums to format my code properly?  The instructions say to use {code}, but that doesn't seem to work...

                        Click on the "Use advanced editor" link in the top right of the editor panel, and then click "Wiki Markup".

                        • 9. Re: JBoss 7 Oracle XMLType retrieval problem
                          sfcoy

                          So, I found a copy of the Oracle xmlparserv2.jar floating around on my system (it's amazing the cruft that accumulates over time) and had a peek inside it.

                           

                          This jar is a bit evil because it contains it's own copies of javax.xml, org.w3c.dom and org.xml.sax packages. Therefore, I'd make a custom version of this jar containing only the oracle.xml package and use that in conjuction with the server provided parsers and see how it goes.

                           

                          It's likely that you will still need to deal with the META-INF/services jaxp configuration that also exists in that jar, but lets deal with that if we come to it.

                          • 10. Re: JBoss 7 Oracle XMLType retrieval problem
                            knightblue610

                            Thanks for the tip about the wiki editor.  I cleaned it up a bit, though the editor demands that I doublespace everything.

                             

                            As to repackaging the Oracle JARs.... I am really worried that I would mess that up.  Before I go down that road, can you help me understand the difference between a local and global module and why classes in JARs of local modules are invisible?  For example, I created a separate, non-global module for xmlparserv2.jar, and put a dependency on another module with ojdbc6.jar, and xdb.jar.  The deployment doesn't have any problems finding oracle.xdb.XMLType in ojdbc6.jar, but throws ClassNotFoundExceptions about oracle.xml.parser.v2.XMLDocument being missing.  Why would the classes from ojdbc6.jar be visible, but xmlparserv2.jar not be?  Is it strictly that META-INF/services entry?

                             

                            Sorry for all of the questions, I just want to understand what I'm doing so I don't spend 19 threads getting it wrong and having to be corrected.

                            • 11. Re: JBoss 7 Oracle XMLType retrieval problem
                              knightblue610

                              Interesting tidbit of information.... I set the configuration back to a single module for ojdbc6. xdb, and xmlparserv2 without global modules, then turned on TRACE logging for org.jboss.modules and saw this:

                               

                              14:30:43,149 TRACE [org.jboss.modules] (ServerService Thread Pool -- 33) Defined class oracle.jdbc.driver.ClassRef in Module "com.oracle.ojdbc6:main" from local module loader @4b0ab323 (roots: C:\jboss-as-7.1.3.Final\modules)

                              14:30:43,150 TRACE [org.jboss.modules] (ServerService Thread Pool -- 33) Finding class oracle.jdbc.driver.ClassRef$XMLTypeClassRef from Module "com.oracle.ojdbc6:main" from local module loader @4b0ab323 (roots: C:\jboss-as-7.1.3.Final\modules)

                              14:30:43,150 TRACE [org.jboss.modules] (ServerService Thread Pool -- 33) Finding local class oracle.jdbc.driver.ClassRef$XMLTypeClassRef from Module "com.oracle.ojdbc6:main" from local module loader @4b0ab323 (roots: C:\jboss-as-7.1.3.Final\modules)

                              14:30:43,150 TRACE [org.jboss.modules] (ServerService Thread Pool -- 33) Loading class oracle.jdbc.driver.ClassRef$XMLTypeClassRef locally from Module "com.oracle.ojdbc6:main" from local module loader @4b0ab323 (roots: C:\jboss-as-7.1.3.Final\modules)

                              14:30:43,150 TRACE [org.jboss.modules] (ServerService Thread Pool -- 33) Attempting to define class oracle.jdbc.driver.ClassRef$XMLTypeClassRef in Module "com.oracle.ojdbc6:main" from local module loader @4b0ab323 (roots: C:\jboss-as-7.1.3.Final\modules)

                              14:30:43,150 TRACE [org.jboss.modules] (ServerService Thread Pool -- 33) Defined class oracle.jdbc.driver.ClassRef$XMLTypeClassRef in Module "com.oracle.ojdbc6:main" from local module loader @4b0ab323 (roots: C:\jboss-as-7.1.3.Final\modules)

                              14:30:43,150 TRACE [org.jboss.modules] (ServerService Thread Pool -- 33) Finding class oracle.xdb.XMLType from Module "org.jboss.as.controller:main" from local module loader @4b0ab323 (roots: C:\jboss-as-7.1.3.Final\modules)

                              14:30:43,150 TRACE [org.jboss.modules] (ServerService Thread Pool -- 33) Class oracle.xdb.XMLType not found from Module "org.jboss.as.controller:main" from local module loader @4b0ab323 (roots: C:\jboss-as-7.1.3.Final\modules)

                               

                              What interests me is the last two lines; it looks like all of the classes from the Oracle driver package are being loaded out of the com.oracle.ojdbc6 module, but for some reason, it's looking for oracle.xdb.XMLType from the org.jboss.as.controller.main class.  Is this significant?  Even the XMLDocument class seems to be loaded from the right module:

                               

                              14:31:18,215 TRACE [org.jboss.modules] (MSC service thread 1-5) Finding class oracle.xml.parser.v2.XMLDocument from Module "deployment.gdm-ear.ear.common-1.2.0-SNAPSHOT.jar:main" from Service Module Loader

                              14:31:18,215 TRACE [org.jboss.modules] (MSC service thread 1-5) Finding local class oracle.xml.parser.v2.XMLDocument from Module "com.oracle.ojdbc6:main" from local module loader @4b0ab323 (roots: C:\jboss-as-7.1.3.Final\modules)

                              14:31:18,215 TRACE [org.jboss.modules] (MSC service thread 1-5) Loading class oracle.xml.parser.v2.XMLDocument locally from Module "com.oracle.ojdbc6:main" from local module loader @4b0ab323 (roots: C:\jboss-as-7.1.3.Final\modules)

                               

                              Could this be a clue as to why it only works with global modules?

                              • 12. Re: JBoss 7 Oracle XMLType retrieval problem
                                sfcoy

                                Code in a global module is visible to everything in the application server. This is generally a bad idea because it has a similar effect to the old CLASSPATH environment variable (you don't use that anymore either do you?).

                                 

                                Code in a non-global module is only visible to other modules and deployments that explicitly import it. Therefore, this kind of module is not going to pollute the the whole application server with it's content.

                                 

                                Creating a repackaged jar is pretty easy. Create a temporary directory and put a copy of xmlparserv2.jar in it. Then

                                {code:bash}[steve@steves-mbp tmp]$ jar xf xmlparserv2.jar

                                [steve@steves-mbp tmp]$ jar cf oracle-parserv2.jar META-INF/services oracle

                                [steve@steves-mbp tmp]$ {code}

                                This creates a jar called oracle-parserv2.jar containing just the oracle classes. Include this in your ojdbc driver module. Don't forget to update your module.xml file.

                                 

                                I'm anticipating that you will need to add a module dependency to the JBoss org.hibernate module:

                                 

                                {code:xml}<module name="com.oracle.ojdbc6" services="import" optional="true"/>{code}

                                but I'd like to see how things go without it first.

                                • 13. Re: JBoss 7 Oracle XMLType retrieval problem
                                  dmwm67

                                  I quickly gave this a try and ended up with a LinkageError on the class oracle/xml/parser/v2/DTD. This class appears to reply heavily on org.w3c.dom.*. I've tried this with and without a dependency on org.apache.xerces, but both times get the same error. Changing back to xmlparserv2.jar resolves the issue.

                                   

                                  Unexpected error in module loader: java.lang.LinkageError: Failed to link oracle/xml/parser/v2/DTD (Module "oracle.driver.main" from module loader @a522a6 (roots: /opt/jboss/modules))

                                   

                                  Note: this is keeping the oracle driver module global.

                                   

                                  Question: is it necessary for the oracle driver module to explicitly export the oracle.xdb and oracle.xml packages? Will other modules such as the org.jboss.as.controller module be able to resolve XMLType if this is done? I haven't had much success with this yet, but most likely I'm not doing this correctly

                                  • 14. Re: JBoss 7 Oracle XMLType retrieval problem
                                    sfcoy

                                    Does your module have a dependency on javax.api?

                                    1 2 Previous Next