2016-07-07 6 views
0

Я обновляю стек старого приложения. Я смог успешно протестировать часть JTA на tomcat/tomee (1.7.4), но когда я пытаюсь развернуть тот же файл WAR в WebLogic [12c], он не может подключиться к базе данных со следующей трассировкой стека. Оба мои Hibernate конфигурационные файлы выглядят следующим образом:Spring 3.2.13 + Hibernate 4.2.7 + JTA: работает на tomee с jotm, но не работает на WebLogic 12c

<hibernate-configuration> 
<session-factory> 
<mapping resource=“com/example/xyz.hbm.xml"/> 
</session-factory> 
</hibernate-configuration> 

И это как мой контекст часть:

<context:annotation-config/> 
<context:component-scan base-package=“com.example”/> 
<bean id="transactionManager"class="org.springframework.transaction.jta.JtaTransactionManager"> 
<property name="allowCustomIsolationLevels" value="true"/></bean> 

<bean id="transactionDefinition" class="org.springframework.transaction.support.DefaultTransactionDefinition"> 
<property name="isolationLevelName" value="ISOLATION_READ_COMMITTED"/> 
<property name="propagationBehaviorName" value="PROPAGATION_REQUIRED"/> 
<property name="timeout" value="30"/> 
</bean> 

<jee:jndi-lookup id=“ds1" jndi-name="java:comp/env/jdbc/DS1"/> 
<jee:jndi-lookup id="ds2" jndi-name="java:comp/env/jdbc/DS2"/> 

<bean id=“ds1SessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> 
<property name="dataSource" ref=“ds1"/> 
<property name="jtaTransactionManager" ref="transactionManager"/> 
<property name="hibernateProperties"> 
    <props> 
     <prop key="dialect">org.hibernate.dialect.Oracle10gDialect</prop> 
     <prop key="hibernate.driverClassName">oracle.jdbc.OracleDriver</prop> 
     <prop key="hibernate.default_schema”>TEST1</prop> 
     <prop key="hibernate.transaction.factory_class">org.hibernate.engine.transaction.internal.jta.JtaTransactionFactory</prop> 
     <prop key="hibernate.temp.use_jdbc_metadata_defaults">false</prop> 
     <prop key="hibernate.show_sql">true</prop> 
     <prop key="hibernate.format_sql">true</prop> 
     <prop key="hibernate.use_sql_comments">true</prop> 
     <prop key="hibernate.cache.use_query_cache">true</prop> 
     <prop key="hibernate.connection.release_mode">after_transaction</prop> 
     <prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</prop> 
     <prop key="hibernate.cache.use_query_cache">true</prop> 
    </props> 
</property> 
<property name="configLocation" value="classpath:hibernate.cfg.xml”/> 
</bean> 

Сеанс завод для второго источника данных похож на этот. И это трассировки стека я получаю:

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:221) 
    at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:157) 
    at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.connection(StatementPreparerImpl.java:56) 
    at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:161) 
    at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:182) 
    at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:159) 
    at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1859) 
    at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1836) 
    at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1816) 
    at org.hibernate.loader.Loader.doQuery(Loader.java:900) 
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:342) 
    at org.hibernate.loader.Loader.doList(Loader.java:2526) 
    at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2371) 
    at org.hibernate.loader.Loader.list(Loader.java:2334) 
    at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:495) 
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:357) 
    at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:195) 
    at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1275) 
    at org.hibernate.internal.QueryImpl.list(QueryImpl.java:101) 
... 
at jsp_servlet._web_45_inf._jsp.__dc._jsp__tag0(__dc.java:125) 
    at jsp_servlet._web_45_inf._jsp.__dc._jspService(__dc.java:96) 
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:35) 
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:280) 
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:254) 
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136) 
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:346) 
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25) 
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79) 
    ... 
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79) 
    ... 
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) 
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118) 
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
    at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50) 
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87) 
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) 
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192) 
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160) 
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343) 
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260) 
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79) 
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3436) 
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3402) 
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) 
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) 
    at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57) 
    at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2285) 
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2201) 
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179) 
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1572) 
    at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:255) 
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311) 
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:263) 
Caused by: java.sql.SQLException: java.sql.SQLException: User: TEST_USER, failed to be authenticated. 
    at weblogic.jdbc.common.internal.JDBCUtil.wrapAndThrowResourceException(JDBCUtil.java:278) 
    at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:416) 
    at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:393) 
    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:214) 
    ... 77 more 
Caused by: java.sql.SQLException: User: TEST_USER, failed to be authenticated. 
    at weblogic.jdbc.common.internal.RmiDataSource.getSubject(RmiDataSource.java:473) 
    at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:407) 
    ... 81 more> 

Я уже пробовал с несколькими весной/спящий режим комбинации версий, а также различные свойства Hibernate в моей сессии фабрики боба! Я уже тестировал определения данных в WebLogic, и они могут подключаться к базе данных.

Заранее благодарим за ваши комментарии.

ответ

0

Итак, я выяснил проблему в моих настройках. Hibernate пытался подключиться к базе данных, как если бы это было обычное соединение JDBC. После удаления этой строки: <property name="dataSource" ref=“ds1"/> из определения sessionFactory он начал работать.