-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate/Jetty DB2 Connection Issue
PostPosted: Wed Sep 11, 2013 2:03 am 
Newbie

Joined: Tue Sep 03, 2013 5:47 am
Posts: 2
I am using Spring Framework 3.2.4.RELEASE, Hibernate 4.1.9.Final, Java 1.6 and IBM DB2JCC jars version 9.7.500.4299. I am trying to connection to the DB2 database via the dataSource property in the session factory and keep getting 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.TstRepositoryImpl.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)
.
.
.


My spring-persistence.xml looks like:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
   http://www.springframework.org/schema/tx
   http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
   http://www.springframework.org/schema/context
   http://www.springframework.org/schema/context/spring-context-3.2.xsd "
default-autowire="byName">
   
    <context:annotation-config/> 
    <context:spring-configured/>
   
    <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">

      <property name="dataSource">
         <ref bean="dataSource" />
      </property>

      <property name="entityInterceptor">
         <bean class="com.tst.v2.tst.app.sys.DB2Interceptor"/>
      </property>

        <property name="hibernateProperties">
            <props>

                <prop key="hibernate.dialect">org.hibernate.dialect.DB2Dialect</prop>
                <prop key="hibernate.show_sql">false</prop>
                <prop key="hibernate.current_session_context_class">thread</prop>

                <prop key="hibernate.transaction.factory_class">org.hibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory</prop>

            </props>
        </property>
        .
        .
        .


My Jetty-env.xml looks like

Code:
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
   <New id="tst2tmp" class="org.eclipse.jetty.plus.jndi.Resource">
        <Arg></Arg>
        <Arg>jdbc/TESTTMP</Arg>
        <Arg>
           <New class="com.ibm.db2.jcc.DB2SimpleDataSource">
              <Set name="databaseName">mytest1</Set>
              <Set name="user">tstadm</Set>
              <Set name="password">test$$5</Set>
              <Set name="serverName">tstsvr</Set>
              <Set name="portNumber">57000</Set>
              <Set name="traceDirectory">c:/logs</Set>
              <Set name="traceFile">trace.log</Set>
              <Set name="traceFileAppend">true</Set>
              <Set name="traceLevel">28663</Set>
           </New>
        </Arg>
   </New>
</Configure>


My spring-datasource.xml looks like:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
             http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
              http://www.springframework.org/schema/context
              http://www.springframework.org/schema/context/spring-context-3.2.xsd">

   <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">      
        <property name="jndiName" value="jdbc/TESTTMP"/>
        <property name="lookupOnStartup" value="true"/>
        <property name="cache" value="true"/>
        <property name="proxyInterface" value="javax.sql.DataSource"/>      
      <property name="resourceRef" value="true" />
   </bean>
</beans>


The resource reference is in my web.xml:

Code:
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="
  http://java.sun.com/xml/ns/javaee
  http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">

       .
       .
       .

<resource-ref>
<description></description>
<res-ref-name>jdbc/TESTTMP</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.