7 Replies Latest reply on Apr 15, 2009 12:48 PM by jaikiran pai

    Jboss and Oracle DB Question

    Sayef Ahmed Newbie

      Hi All,

      I am new to JBoss world. I just got my application up and running but had a question.

      Does jboss (4.23) wrap the oracle connections, and if so if there is a way to disable this?

      Thanks in advance for you help.

      -Sayef

        • 1. Re: Jboss and Oracle DB Question
          Peter Johnson Master

          What do you mean by "wrap the Oracle connections"? JBoss AS does provide a mechanism to define data sources, you can look it up in the documentation.

          By default, JBoss AS does nothing with Oracle (it uses the built-in Hypersonic database).

          • 2. Re: Jboss and Oracle DB Question
            Sayef Ahmed Newbie

            Thanks Peter.

            Here is my oracle-ds.xml file:

            <?xml version="1.0" encoding="UTF-8"?>
            <datasources>
             <local-tx-datasource>
             <jndi-name>basic_ds</jndi-name>
             <use-java-context>false</use-java-context>
             <connection-url>jdbc:oracle:thin:@192.168.100.102:1521:JBOSSTST</connection-url>
             <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
             <user-name>bendev</user-name>
             <password>bendev</password>
             <metadata>
             <type-mapping>Oracle9i</type-mapping>
             </metadata>
             </local-tx-datasource>
            </datasources>
            
            


            Here is the Error from my application log, Is this configuration problem or code issue? :

            009-04-14 09:54:38,171 INFO [STDOUT] 09:54:38,156 ERROR V3Engine:169 - Error logging exception
            java.lang.ClassCastException: org.jboss.resource.adapter.jdbc.jdk5.WrappedConnectionJDK5
            at oracle.sql.CLOB.createTemporary(CLOB.java:754)
            at oracle.sql.CLOB.createTemporary(CLOB.java:716)
            at com.vitechinc.core.model.ClobType.nullSafeSet(ClobType.java:77)
            at net.sf.hibernate.type.CustomType.nullSafeSet(CustomType.java:118)
            at net.sf.hibernate.persister.EntityPersister.dehydrate(EntityPersister.java:393)
            at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:466)
            at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:439)
            at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:29)
            at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2418)
            at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2371)
            at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2240)
            at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
            at org.springframework.orm.hibernate.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:507)
            at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:662)
            at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:632)
            at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:314)
            at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:117)
            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
            at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
            at $Proxy74.saveExceptionLog(Unknown Source)
            at com.vitechinc.v3.core.view.V3Engine.activateExceptionPage(V3Engine.java:161)
            at org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:914)
            at org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:197)
            at org.apache.tapestry.ApplicationServlet.doPost(ApplicationServlet.java:326)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at com.vitechinc.core.locale.ExtractLocaleFilter.doFilterInternal(ExtractLocaleFilter.java:43)
            at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at org.springframework.orm.hibernate.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:170)
            at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
            at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
            at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
            at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
            at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
            at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
            at java.lang.Thread.run(Thread.java:595)
            2009-04-14 09:54:38,437 INFO [STDOUT] 09:54:38,437 ERROR V3Engine:126 - org.apache.tapestry.ApplicationRuntimeException
            org.jboss.resource.adapter.jdbc.jdk5.WrappedConnectionJDK5
            component:com.vitechinc.v3.dashboard.Home@48089e[dashboard:Home]
            location:classpath:/com/vitechinc/v3/dashboard/Home.page, line 7, column 61
            java.lang.ClassCastException
            org.jboss.resource.adapter.jdbc.jdk5.WrappedConnectionJDK5
            * oracle.sql.BLOB.createTemporary(BLOB.java:587)
            * com.vitechinc.core.model.BlobType.nullSafeSet(BlobType.java:94)
            * net.sf.hibernate.type.CustomType.nullSafeSet(CustomType.java:118)
            * net.sf.hibernate.persister.EntityPersister.dehydrate(EntityPersister.java:393)
            * net.sf.hibernate.persister.EntityPersister.update(EntityPersister.java:663)
            * net.sf.hibernate.persister.EntityPersister.update(EntityPersister.java:642)
            * net.sf.hibernate.impl.ScheduledUpdate.execute(ScheduledUpdate.java:52)
            * net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2418)
            * net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2372)
            * net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2240)


            • 3. Re: Jboss and Oracle DB Question
              Peter Johnson Master

              The *-ds.xml file looks OK.

              You are using Hibernate, and a very old version of it (based on the package names). What database connection configuration have you done in Hibernate? Or was that done in Spring? Depending on that configuration, you might not even be using the connections defined by the *-ds.xml file.

              Also, which Oracle JDBC driver are you using? Name and version number, please. Perhaps someone will notice an issue with that, if the driver is the problem.

              • 4. Re: Jboss and Oracle DB Question
                Sayef Ahmed Newbie

                Peter

                Here is the information about Oracle JDBC Driver:

                Oracle Database 10g Release 2 (10.2.0.4) JDBC Drivers
                ojdbc14.jar (1,555,682 bytes) - classes for use with JDK 1.4 and 1.5

                Download it from Oracle website:

                http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc_10201.html

                I hope that helps.

                • 5. Re: Jboss and Oracle DB Question
                  Sayef Ahmed Newbie

                  Peter/All

                  I have spoke to one of the developer. We realized that JBoss is wrapping all the connection pool to Database.

                  java.lang.ClassCastException: org.jboss.resource.adapter.jdbc.jdk5.WrappedConnectionJDK5

                  Is there any way to prevent that? Let me know if you need more information.


                  Thanks
                  Sayef

                  • 6. Re: Jboss and Oracle DB Question
                    Peter Johnson Master

                    All connections are wrapped and there is no way to prevent it. The WrappedConnectionJDK5 class implements Connection, so there should not be an issue unless the Oracle driver is casting the connection to something else.

                    • 7. Re: Jboss and Oracle DB Question
                      jaikiran pai Master

                       

                      com.vitechinc.core.model.BlobType.nullSafeSet(BlobType.java:94)


                      Looking at this line in the code, i guess this belongs to your application and this piece of code is passing the connection to the oracle driver method which probably excepts it to be of a different type.

                      In your com.vitechinc.core.model.BlobType.nullSafeSet you might want to do something like:
                      DataSource ds = ctx.lookup("dsname");
                      Connection conn = ds.getConnection();
                      // JBoss returns a "JBoss specific" wrapped connection, so let's give it a try
                      if (conn instanceof org.jboss.resource.adapter.jdbc.WrappedConnection)
                      {
                       Connection underlyingConnection = ((WrappedConnection) conn).getUnderlyingConnection();
                       // pass it on to the oracle driver
                      
                      }
                      else {
                       // pass the connection as-is to the driver
                      }


                      All this is a guess, based on the stacktrace. Not sure whether this is going to work.