Announcement Announcement Module
Collapse
No announcement yet.
Spring Data Hibernate JDBC Connection Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Data Hibernate JDBC Connection

    I have been in the process of upgrading my application from Spring Framework 2.5.5 to 3.2.4.RELEASE, Hibernate 3.2.1.ga to 4.1.9.Final and Jave 1.5 to Java 1.6. The application is runs a WebSphere server and connects to a DB2 server both running AIX, it is developed on Windows 7 (64-bit)machines with Eclipse Juno (64-bit). The older DB2JCC jars no longer worked and I needed to upgrade them as well. I am currently using the 9.7.500.4299 version. I have tried multiple ways of configuring the Session Factory, below is the latest.

    Code:
        <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
    
    		<property name="entityInterceptor"> 
    			<bean class="com.tst.e2.tst.app.sys.DB2Interceptor"/>
    		</property>
    
            <property name="hibernateProperties"> 
                <props>
    
                    <prop key="hibernate.current_session_context_class">thread</prop>
    
    	  <prop key="hibernate.connection.driver_class">com.ibm.db2.jcc.DB2Driver</prop>
    	  <prop key="hibernate.connection.password">aBcdefgh</prop>
    	  <prop key="hibernate.connection.url">jdbc:db2://localhost:50000/MYTSTDB</prop>
    	  <prop key="hibernate.connection.username">db2admin</prop>
    				
    	  <prop key="hibernate.dialect">org.hibernate.dialect.DB2Dialect</prop>
    	  <prop key="hibernate.show_sql">true</prop>
    
    
               	  <prop key="hibernate.connection.driver_class">com.ibm.db2.jcc.DB2Driver</prop>
                    <prop key="hibernate.transaction.factory_class">org.hibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory</prop>
    
                </props>
            </property>
            
            <property name="annotatedClasses">
                <list> 
                    <value>com.tst.e2.tst.tst.dom.TestClass1</value>
                    <value>com.tst.e2.tst.tst.dom.TestClass2</value>
                    <value>com.tst.e2.tst.tst.dom.TestClass3</value>
                    .
                    .
                    .
                </list>
            </property>
            
            <property name="mappingResources">
                <list>
                    <value>com/tst/e2/tst/cmn/rep/tstRepositoryQueries.hbm.xml</value>
                    .
                    .
                    .
                </list>
            </property>
            
        </bean>
    When I run he application with the Jetty plugin (version 8.0.0.M2) I get the following exception

    Code:
    2013-09-03 01:40:57,465 WARN  [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] - SQL Error: -1393, SQLState:      
    2013-09-03 01:40:57,465 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] - [jcc][4038][12241][3.63.75] T2LUW exception: SQL10007N Message "-1393" could not be retrieved.  Reason code: "6".
     ERRORCODE=-1393, SQLSTATE=     
    2013-09-03 01:40:57,475 INFO  [com.tst.framework.core.trc.sys.TraceManager] - ********** com.tst.e2.tst.cmn.rep.com.tst.e2.tst.cmn.rep.RmsRepositoryImpl.findUsersByName: exception (CriticalSystemFailure) . **********
    2013-09-03 01:40:57,475 INFO  [com.tst.framework.core.trc.sys.TraceManager] - org.hibernate.exception.GenericJDBCException: Could not open connection
    	at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54)
    	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125)
    	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110)
    	at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:304)
    	at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:169)
    	at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doBegin(JdbcTransaction.java:67)
    	at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:160)
    	at org.hibernate.internal.SessionImpl.beginTransaction(SessionImpl.java:1395)
    	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.hibernate.context.internal.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:352)
    	at com.sun.proxy.$Proxy37.beginTransaction(Unknown Source)
    	at com.tst.e2.tst.cmn.rep.RmsRepositoryAppImpl.findUsersByName(RmsRepositoryAppImpl.java:64)
    	at com.tst.e2.tst.app.sys.UserDetailsServiceImpl.loadUserByUsername(UserDetailsServiceImpl.java:65)
    	at org.springframework.security.providers.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:102)
    	at org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:121)
    	at org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188)
    	at org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)
    	at org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82)
    	at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:259)
    	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:411)
    	at org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89)
    	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:411)
    	at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
    	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:411)
    	at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:188)
    	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
    	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)
    	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1254)
    	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:481)
    	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
    	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:516)
    	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:230)
    	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:956)
    	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:411)
    	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:188)
    	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:891)
    	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
    	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:247)
    	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:151)
    	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:114)
    	at org.eclipse.jetty.server.Server.handle(Server.java:353)
    ...
    
    Caused by: com.ibm.db2.jcc.am.SqlException: [jcc][4038][12241][3.63.75] T2LUW exception: SQL10007N Message "-1393" could not be retrieved.  Reason code: "6".
     ERRORCODE=-1393, SQLSTATE=     
    	at com.ibm.db2.jcc.am.fd.a(fd.java:682)
    	at com.ibm.db2.jcc.am.fd.a(fd.java:60)
    	at com.ibm.db2.jcc.am.fd.a(fd.java:103)
    	at com.ibm.db2.jcc.uw.UWExceptionGenerator.a(UWExceptionGenerator.java:83)
    	at com.ibm.db2.jcc.uw.UWExceptionGenerator.a(UWExceptionGenerator.java:106)
    	at com.ibm.db2.jcc.uw.UWConnection.a(UWConnection.java:616)
    	at com.ibm.db2.jcc.uw.f.z(f.java:201)
    	at com.ibm.db2.jcc.uw.UWConnection.a(UWConnection.java:538)
    	at com.ibm.db2.jcc.uw.UWConnection.a(UWConnection.java:383)
    	at com.ibm.db2.jcc.uw.UWConnection.<init>(UWConnection.java:273)
    	at com.ibm.db2.jcc.DB2SimpleDataSource.getConnection(DB2SimpleDataSource.java:223)
    	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:317)
    	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
    	at com.sun.proxy.$Proxy11.getConnection(Unknown Source)
    	at org.hibernate.service.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:141)
    	at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:292)
    	at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:297)
    	... 53 more


    Thank you for any assistance anyone my be able to offer.

  • #2
    The Jetty plugin is configure as:

    Code:
    	<plugin>
    	  <groupId>org.mortbay.jetty</groupId>  
        	  <artifactId>jetty-maven-plugin</artifactId>
    	  <version>8.0.0.M2</version>  
    
    	  <configuration>
    					  <webAppSourceDirectory>${basedir}/src/main/webapp</webAppSourceDirectory>
    	    <classesDirectory>${basedir}/target/tst-1.0-SNAPSHOT/WEB-INF/lib</classesDirectory>
    	    <scanIntervalSeconds>5</scanIntervalSeconds>
    	    <httpConnector>
    		<port>8080</port>
    		<maxIdleTime>3600000</maxIdleTime>
    	    </httpConnector>
    	    <webApp>
    		<contextPath>${rms.app.contextRoot}</contextPath>
              		<descriptor>${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
               		<jettyEnvXml>${basedir}/src/main/webapp/WEB-INF/jetty-env.xml</jettyEnvXml> 
    	    </webApp>
    	  </configuration>
    	</plugin>

    Comment


    • #3
      When I upgraded to the new version of db2jcc I grabbed it from a SQLLIB directory from our Windows (32-bit) server running the 32-bit 9.7.500.4299 version of DB2. I reconfigured the environmental variables to point to the new location where I copied the SQLLIB directory.

      Comment

      Working...
      X