-->
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.  [ 4 posts ] 
Author Message
 Post subject: How can I configure transactionManager weblogic 10.3.6
PostPosted: Mon Jun 27, 2016 8:11 am 
Newbie

Joined: Mon Jun 27, 2016 8:03 am
Posts: 3
Hello,

I work with Eclipse Juno, weblogic 10.3.6, maven, spring mvc 3.2.6 and hibernate 4, oracle.

I wrote this bean in my hibernate-context.xml

Code:
<bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"
          p:sessionFactory-ref="sessionFactory" ></bean>
         
          </beans>


hibernate-context.xml deploy right in tomcat 7.0

But when I deploy in weblogic 10.3.6. I get the error

Code:
Caused By: java.lang.ClassNotFoundException: org.springframework.orm.hibernate4.HibernateTransactionManager
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
    at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    Truncated. see log file for complete stacktrace


I want to define a transaction manager to work with Oracle

How can I define transaction manager hibernate in weblogic server?

Thanks in advance

Carlota Vina


Top
 Profile  
 
 Post subject: Re: How can I configure transactionManager weblogic 10.3.6
PostPosted: Mon Jun 27, 2016 8:15 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
Why do you want to deploy a Spring application to Weblogic?

Usually, you have two choices:

1. You either use Spring and then all you need is a web container (e.g. Tomcat, Jetty).
2. You use Java EE, and then you need a Java EE container (e.g. JBoss, Weblogic).

If you want to run in a Java EE container, you get the transaction management logic from the container, so there is no need for HibernateTransactionManager.
HibernateTransactionManager only makes sense for RESOURCE_LOCAL transactions. But then, Java EE uses JTA transactions by default, and the transaction contetx is provided by the application server.


Top
 Profile  
 
 Post subject: Re: How can I configure transactionManager weblogic 10.3.6
PostPosted: Mon Jun 27, 2016 9:57 am 
Newbie

Joined: Mon Jun 27, 2016 8:03 am
Posts: 3
Hello ,

Thanks for your reply. I work in a old project and I have to migrate from tomcat to weblogic. My project has the following hibernate-context.xml

Code:
<tx:annotation-driven transaction-manager="transactionManager" />
   
<bean name="sessionFactory" id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"
     p:packagesToScan="com.ec.survey.model, com.ec.survey.model.survey, com.ec.survey.model.administration, com.ec.survey.service, com.ec.survey.tools">
     
       <property name="dataSource" ref="dataSource" />
      <property name="hibernateProperties">
         <props>
             <!--<property name="hibernate.connection.driver_class" >oracle.jdbc.driver.OracleDriver</property>
            <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
            <property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>  -->
               <prop key="hibernate.connection.driver">oracle.jdbc.driver.OracleDriver</prop>
               <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
               
               
            <!--<prop key="hibernate.connection.driver_class">net.bull.javamelody.JdbcDriver</prop>-->
            <prop key="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</prop>
               
               <!-- Added by jgd was missing and cause exception
               <prop key="hibernate.connection.driver">com.mysql.jdbc.Driver</prop>
               <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</prop>-->
            <prop key="hibernate.connection.url">${app.jdbc.url}</prop>
            <prop key="hibernate.connection.username">${app.jdbc.username}</prop>
            <prop key="hibernate.connection.password">${app.jdbc.password}</prop>
            <!-- <prop key="hibernate.connection.provider_class">org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider</prop>-->
            <prop key="hibernate.cache.provider_class">org.hibernate.cache.ehcache.SingletonEhCacheProvider</prop>
            <prop key="hibernate.cache.use_query_cache">true</prop>
            <prop key="hibernate.cache.use_structured_entries">true</prop>
            <prop key="hibernate.cache.provider_configuration_file_resource_path">/ehcache.xml</prop>
             <prop key="hibernate.cache.use_second_level_cache">true</prop>
            <prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory</prop>
            <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
            <prop key="hibernate.jdbc.batch_size">20</prop>
             <prop key="hibernate.hbm2ddl.auto">update</prop>
             <prop key="hibernate.query.substitutions">true 1, false 0</prop>
             <prop key="hibernate.connection.useUnicode">true</prop>
             <prop key="hibernate.query.factory_class">org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory</prop>
            <!--  <prop key="hibernate.c3p0.initialPoolSize">${hibernate.c3p0.initialPoolSize}</prop>
            <prop key="hibernate.c3p0.minPoolSize">${hibernate.c3p0.minPoolSize}</prop>
            <prop key="hibernate.c3p0.maxPoolSize">${hibernate.c3p0.maxPoolSize}</prop>
             <prop key="hibernate.c3p0.unreturnedConnectionTimeout">36000</prop>
            <prop key="hibernate.c3p0.debugUnreturnedConnectionStackTraces">true</prop>
            <prop key="hibernate.c3p0.testConnectionOnCheckout">true</prop>
            <prop key="hibernate.c3p0.statementCacheNumDeferredCloseThreads">1</prop>
             <prop key="hibernate.c3p0.timeout">1800</prop>
             <prop key="hibernate.c3p0.idle_test_period">100</prop> -->
             <prop key="hibernate.jdbc.factory_class">net.bull.javamelody.HibernateBatcherFactory</prop>
             <prop key="hibernate.generate_statistics">${hibernate.generate_statistics}</prop>
             <prop key="show_sql">true</prop>
            <prop key="format_sql">true</prop>
            <prop key="use_sql_comments">true</prop>
         </props>
      </property>
     </bean>
 
 
  <bean id="dataSource"
         class="org.springframework.jdbc.datasource.DriverManagerDataSource">
   <property name="driverClassName" value="${app.jdbc.driverClassName}" />
   <property name="url" value="${app.jdbc.url}" />
   <property name="username" value="${app.jdbc.username}" />
   <property name="password" value="${app.jdbc.username}" />
</bean>
   
<!-- Declare a transaction manager-->
<bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"
          p:sessionFactory-ref="sessionFactory" ></bean>
         
          </beans>


Do you know how I can modify transactionManager to work with weblogic 10.3.6

Thanks in advance

Carlota Vina


Top
 Profile  
 
 Post subject: Re: How can I configure transactionManager weblogic 10.3.6
PostPosted: Mon Jun 27, 2016 10:09 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
There's a lot you need to change:

1. You need to remove DriverManagerDataSource and use the JTA DataSource instead via JNDI
2. You need to replace HibernateTranscationManager with WebLogicJtaTransactionManager
3. Depending on your Hibernate version you need to use a JTAPlatform (Hibernate 5) or a hibernate.transaction.manager_lookup_class (Hibernate 3 and 4)

Check Spring documentation since this is more related to Spring than Hibernate.


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

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.