1 Reply Latest reply on Oct 11, 2012 9:12 AM by geeky2

    need help with config - cannot connect to db2 - using jboss 5.1 and spring 2.5.6

    geeky2

      hello all,

       

      i am converting older webshere, spring and ibatis services to jboss 5.1.

       

      i have my web services deployed but when i fire my test calls (using soapUI) at the service, i get the following error (see way below).

       

      any help would be greatly appreciated.

       

      thx

      mark

       

       

      here is my db2-ds.xml file (pulled from the examples and modified) that is deployed in the $JBOSS_HOME/server/default/deploy dir

       

       

      <?xml version="1.0" encoding="UTF-8"?>

       

      <!-- ===================================================================== -->

      <!--                                                                       -->

      <!--  JBoss Server Configuration                                           -->

      <!--                                                                       -->

      <!-- ===================================================================== -->

       

      <!-- See http://www.jboss.org/community/wiki/Multiple1PC for information about local-tx-datasource -->

      <!-- $Id: db2-ds.xml 88948 2009-05-15 14:09:08Z jesper.pedersen $ -->

       

       

      <datasources>

        <local-tx-datasource>

              <jndi-name>jdbc/MembershipDB</jndi-name>

          <connection-url>jdbc:db2://blah.blah.com:9999/DB91</connection-url>

         

          <!-- DB2 Universal Driver Note connection URL is in form of

               jdbc:db2://host:port:dbname

              

               Default port for Type 4 driver is 50000

              

               Note, host and port must be specified if using Type 4 driver. And be forewarned, no native

               XA support is provided with Type 4; you must set a DB property calling for Type 2 to get XA

              

            <driver-class>com.ibm.db2.jcc.DB2Driver</driver-class>

            <connection-url>jdbc:db2://[hostname]:[port]/databasename"</connection-url>

           

            Please see http://www-128.ibm.com/developerworks/db2/library/techarticle/dm-0512kokkat/

            or the DB2 JDBC application developers manual.

          --> 

         

              <driver-class>com.ibm.db2.jcc.DB2Driver</driver-class>

              <!--

          <driver-class>COM.ibm.db2.jdbc.app.DB2Driver</driver-class>

              -->

          <user-name>someuser</user-name>

          <password>somepassword</password>

          <min-pool-size>0</min-pool-size>

         

          <!-- New org.jboss.resource.adapter.jdbc.vendor.DB2ExceptionSorter

         

          <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.DB2ExceptionSorter</exception-sorter-class-name>

         

          -->

         

          <!-- sql to call when connection is created

          <new-connection-sql>some arbitrary sql</new-connection-sql>

          -->

       

          <!-- sql to call on an existing pooled connection when it is obtained from pool

          <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>

          -->

       

        <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->

       

          

            <metadata>

               <type-mapping>DB2</type-mapping>

            </metadata>

        </local-tx-datasource>

       

       

      here are the libs that i am deploying in $JBOSS_HOME/server/default/lib

       

      -rw-r--r-- 1 mark users 3352093 Oct  9 08:24 db2jcc.jar

      -rw-r--r-- 1 mark users   23709 Oct  9 08:24 db2jcc_javax.jar

      -rw-r--r-- 1 mark users    2068 Oct  9 08:24 db2jcc_license_cisuz.jar

      -rw-r--r-- 1 mark users     673 Oct  9 08:24 db2jcc_license_c.jar

      -rw-r--r-- 1 mark users    1015 Oct  9 08:24 db2jcc_license_cu.jar

       

      these same libs are being deployed in the .war file

       

      3352093  10-09-2012 09:30   WEB-INF/lib/db2jcc.jar

          23709  10-09-2012 09:30   WEB-INF/lib/db2jcc_javax.jar

            673  10-09-2012 09:30   WEB-INF/lib/db2jcc_license_c.jar

           2068  10-09-2012 09:30   WEB-INF/lib/db2jcc_license_cisuz.jar

           1015  10-09-2012 09:30   WEB-INF/lib/db2jcc_license_cu.jar

       

      here is my beans.xml file

       

       

         0  10-09-2012 09:30   WEB-INF/classes/resources/

              0  10-09-2012 09:30   WEB-INF/classes/resources/ibatis/

          11254  10-09-2012 09:30   WEB-INF/classes/resources/ibatis/MembershipMap.xml

            557  10-09-2012 09:30   WEB-INF/classes/resources/ibatis/SqlMapConfig.xml

           3313  10-09-2012 09:30   WEB-INF/classes/resources/ibatis/SubscriptionMap.xml

             14  10-09-2012 09:30   WEB-INF/classes/resources/ibatis/databaseConfig.properties

              0  10-09-2012 09:30   WEB-INF/classes/resources/spring/

           1008  10-09-2012 09:30   WEB-INF/classes/resources/spring/BusinessObject.xml

            657  10-09-2012 09:30   WEB-INF/classes/resources/spring/DataAccessObject.xml

            480  10-09-2012 09:30   WEB-INF/classes/resources/spring/Manager.xml

            582  10-09-2012 09:30   WEB-INF/classes/resources/spring/MembershipBusinessObject.xml

            859  10-09-2012 09:30   WEB-INF/classes/resources/spring/MembershipDataAccessObject.xml

            991  10-09-2012 09:30   WEB-INF/classes/resources/spring/MembershipManager.xml

           4865  10-09-2012 09:30   WEB-INF/classes/resources/spring/beans.xml

       

      <beans xmlns="http://www.springframework.org/schema/beans"

              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"                                                                                                                                                    

              xmlns:jaxws="http://cxf.apache.org/jaxws"

              xsi:schemaLocation="                                                                                                                                                                                     

      http://www.springframework.org/schema/beans                                                                                                                                                                      

      http://www.springframework.org/schema/beans/spring-beans.xsd

      http://cxf.apache.org/jaxws

      http://cxf.apache.org/schemas/jaxws.xsd">                                                                                                                                                                        

              <import resource="classpath:META-INF/cxf/cxf.xml" />

              <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />                                                                                                                                      

              <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

                                                                                                                                                                                                                       

              <jaxws:endpoint id="membershipServiceEndPoint"                                                                                                                                                           

                      implementor="#membershipService" address="/MembershipService">                                                                                                                                   

                      <jaxws:properties>

                              <entry key="schema-validation-enabled" value="true" />

                      </jaxws:properties>

              </jaxws:endpoint>

       

            

         <bean id="dataSourceMySql" class="org.springframework.jndi.JndiObjectFactoryBean">

              <property name="jndiName" value="java:jdbc/SubscriptionDataSource"/>

              <property name="lookupOnStartup" value="false"/>

              <property name="cache" value="false"/>

              <property name="proxyInterface" value="javax.sql.DataSource"/>

              </bean>

       

         <bean id="membershipDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">

              <property name="jndiName" value="java:jdbc/MembershipDB"/>

              <property name="lookupOnStartup" value="false"/>

              <property name="cache" value="false"/>

              <property name="proxyInterface" value="javax.sql.DataSource"/>

          </bean>

       

              <bean id="transactionManager"

                      class="org.springframework.jdbc.datasource.DataSourceTransactionManager"

                      autowire="byName">

                      <property name="dataSource">

                              <ref bean="dataSourceMySql" />

                      </property>

              </bean>

       

              <bean id="transactionManagerDB2"

                      class="org.springframework.jdbc.datasource.DataSourceTransactionManager"

                      autowire="byName">

                      <property name="dataSource">

                              <ref bean="membershipDataSource" />

                      </property>

              </bean>

       

              <bean id="attributeSource"

                      class="org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource">

                      <property name="properties">

                              <props>

                                      <prop key="*">

                                              PROPAGATION_REQUIRED,ISOLATION_DEFAULT,-Exception

                                      </prop>

                              </props>

                      </property>

              </bean>

       

              <bean id="sqlMapClient"

                      class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"

                      abstract="false" autowire="byName">

                      <property name="configLocation">

                              <value>classpath:resources/ibatis/SqlMapConfig.xml</value>

                      </property>

                      <property name="useTransactionAwareDataSource">

                              <value>true</value>

                      </property>

                      <property name="dataSource">

                              <ref bean="dataSourceMySql" />

                      </property>

              </bean>

       

              <bean id="DB2MapClient"

                      class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"

                      abstract="false" autowire="byName">

                      <property name="configLocation">

                              <value>classpath:resources/ibatis/SqlMapConfig.xml</value>

                      </property>

                      <property name="useTransactionAwareDataSource">

                              <value>true</value>

                      </property>

                      <property name="dataSource">

                              <ref bean="membershipDataSource" />

                      </property>

              </bean>

       

              <bean id="subscriptionService"

                      class="com.sears.hs.subscription.service.SubscriptionService">

                      <property name="subscriptionManager" ref="subscriptionManager" />

              </bean>

       

              <bean id="membershipService"

                      class="com.sears.hs.subscription.service.MembershipService">

                      <property name="membershipManager" ref="membershipManager" />

              </bean>

       

              <import resource="Manager.xml" />

              <import resource="BusinessObject.xml" />

              <import resource="DataAccessObject.xml" />

       

              <import resource="MembershipManager.xml" />

              <import resource="MembershipBusinessObject.xml" />

              <import resource="MembershipDataAccessObject.xml" />

       

      </beans>

       

      finally here is the error that i am receiving:

       

       

      09:42:13,838 INFO  [STDOUT] 09:42:13,835 ERROR [MembershipService] Caught Throwable while processing lookupMemberships, request: com.sears.hs.subscription.service.request.LookupRequest@72b4dc StackTrace:                                                               
          at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)                                                                                                                                                                     
          at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
          at $Proxy355.getConnection(Unknown Source)
          at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:200)
          at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)
          at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)
          at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)
          at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
          at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
          at $Proxy357.lookupMemberships(Unknown Source)
          at com.sears.hs.subscription.service.MembershipService.lookupMemberships(MembershipService.java:95)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:173)
          at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:89)
          at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:60)
          at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:75)
          at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
          at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
          at java.util.concurrent.FutureTask.run(FutureTask.java:138)
          at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
          at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106)
          at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
          at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:109)
          at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:98)
          at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:406)
          at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:178)
          at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:142)
          at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
          at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
          at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
          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:235)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
          at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
          at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
          at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
          at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
          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:158)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
          at java.lang.Thread.run(Thread.java:662)

      org.springframework.aop.AopInvocationException: AOP configuration seems to be invalid: tried calling method [public abstract java.sql.Connection javax.sql.DataSource.getConnection() throws java.sql.SQLException] on target [org.jboss.resource.adapter.jdbc.WrapperDataSource@14e6e7d]; nested exception is java.lang.IllegalArgumentException: object is not an instance of declaring class

          at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
          at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
          at $Proxy355.getConnection(Unknown Source)
          at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:200)
          at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)
          at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)
          at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)
          at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
          at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
          at $Proxy357.lookupMemberships(Unknown Source)
          at com.sears.hs.subscription.service.MembershipService.lookupMemberships(MembershipService.java:95)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:173)
          at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:89)
          at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:60)
          at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:75)
          at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
          at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
          at java.util.concurrent.FutureTask.run(FutureTask.java:138)
          at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
          at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106)
          at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
          at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:109)
          at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:98)
          at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:406)
          at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:178)
          at org.ap

      09:42:13,845 INFO  [STDOUT] ache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:142)

          at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)                                                                                                 
          at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
          at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
          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:235)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
          at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
          at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
          at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
          at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
          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:158)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
          at java.lang.Thread.run(Thread.java:662)

      Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
          ... 54 more
        • 1. Re: need help with config - cannot connect to db2 - using jboss 5.1 and spring 2.5.6
          geeky2

          Hello all,

           

          sorry for the double post - i had never worked with db2 before and really needed some input from the experts up here.

           

          i figured it out on my own through trial and error.

           

          as mentioned in the OP - the original developer had packaged all of the db2 libs in the .war file, then wrapped the war in an ear for deployment to Webshere.

           

          when i was setting this up for jboss - i took the same db2 libs, and placed them in the $JBOSS_HOME/server/default/lib directory.

           

          when i eliminated the db2 libs from the war (by changing the ant script) - this eliminated the error.

           

          thx

          mark