oracle - Weblogic with Hibernate getting javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection -
i migrating jboss weblogic 12c, project working on jboss, when trying migrate weblogic have error. context:
my database: oracle xe application server: weblogic 12c
on start script startweblogic.cmd added:
set pre_classpath=%mw_home%\oracle_common\modules\javax.persistence_2.1.jar;%mw_home%\wlserver\modules\com.oracle.weblogic.jpa21support_1.0.0.0_2-1.jar
on weblogic console in services -> datasources created data source
name: oracleds
jndi name: u_interface
url: jdbc:oracle:thin:@localhost:1521:xe
driver class: oracle.jdbc.xa.client.oraclexadatasource
i can see on jndi names u_interface there.
i able test connection database on weblogic.
now application:
pom.xml
<dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-entitymanager</artifactid> <version>3.6.0.final</version> <scope>test</scope> </dependency> <dependency> <groupid>javax</groupid> <artifactid>javaee-api</artifactid> <version>6.0</version> <type>jar</type> <scope>provided</scope> </dependency>
persistence.xml
<persistence-unit name="oracleds" transaction-type="jta"> <provider>org.hibernate.ejb.hibernatepersistence</provider> <jta-data-source>u_interface</jta-data-source> <properties> <property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.weblogicjtaplatform" /> <property name="hibernate.dialect" value="org.hibernate.dialect.oracle10gdialect"/> <!-- property name="hibernate.hbm2ddl.auto" value="validate"/--> <!--property name="hibernate.show_sql" value="true" /--> <property name="hibernate.default_batch_fetch_size" value="8"/> <property name="hibernate.max_fetch_depth" value="3"/> </properties>
the ejb have entity manager:
@stateful(mappedname="/moduledao") public class moduledao implements moduledaoremote { @persistencecontext(unitname = "oracleds", type = persistencecontexttype.transaction) private entitymanager em;
the method getmodulebyname can see on stack trace.
@suppresswarnings("unchecked") public module getmodulebyname(string name) { list<module> local = null; criteriabuilder cb = getentitymanager().getcriteriabuilder(); criteriaquery<module> cq = cb.createquery(module.class); root<module> root = cq.from(module.class); predicate cond1 = cb.equal(root.get(module_.name), name); cq.where(cb.and(cond1)); query query = getentitymanager().createquery(cq); local = query.getresultlist(); if(local != null && !local.isempty()) { return local.get(0); } else { return null; } }
i getting error on line
local = query.getresultlist();
the interface:
@remote public interface moduledaoremote
so in class inject ejb successfuly when call method
getmodulebyname("some string")
i error:
apr 22, 2015 3:58:57 pm org.hibernate.engine.jdbc.spi.sqlexceptionhelper logexceptions warn: sql error: 0, sqlstate: null <22-apr-2015 15:58:57 o'clock cest> <warning> <org.hibernate.engine.jdbc.spi.sqlexceptionhelper> <bea-000000> <sql error: 0, sqlstate: null> apr 22, 2015 3:58:57 pm org.hibernate.engine.jdbc.spi.sqlexceptionhelper logexceptions error: java.lang.nullpointerexception <22-apr-2015 15:58:57 o'clock cest> <error> <org.hibernate.engine.jdbc.spi.sqlexceptionhelper> <bea-000000> <java.lang.nullpointerexception> apr 22, 2015 3:58:57 pm org.hibernate.engine.internal.statisticalloggingsessioneventlistener end info: session metrics { 81423 nanoseconds spent acquiring 1 jdbc connections; 0 nanoseconds spent releasing 0 jdbc connections; 7839815 nanoseconds spent preparing 1 jdbc statements; 0 nanoseconds spent executing 0 jdbc statements; 0 nanoseconds spent executing 0 jdbc batches; 0 nanoseconds spent performing 0 l2c puts; 0 nanoseconds spent performing 0 l2c hits; 0 nanoseconds spent performing 0 l2c misses; 0 nanoseconds spent executing 0 flushes (flushing total of 0 entities , 0 collections); 7610 nanoseconds spent executing 1 partial-flushes (flushing total of 0 entities , 0 collections) } apr 22, 2015 3:58:57 pm com.sun.xml.ws.server.sei.tiehandler createresponse severe: ejb exception: ; nested exception is: javax.persistence.persistenceexception: org.hibernate.exception.genericjdbcexception: not open connection javax.ejb.ejbexception: ejb exception: ; nested exception is: javax.persistence.persistenceexception: org.hibernate.exception.genericjdbcexception: not open connection @ weblogic.ejb.container.internal.remotebusinessintfproxy.unwrapremoteexception(remotebusinessintfproxy.java:117) @ weblogic.ejb.container.internal.remotebusinessintfproxy.invoke(remotebusinessintfproxy.java:97) @ com.sun.proxy.$proxy191.getmodulebyname(unknown source) @ com.example.ejb.module.maestro.getmodulebyname(maestro.java:81) @ com.example.webservice.modulelauncher.launch(modulelauncher.java:52) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @ weblogic.wsee.jaxws.wlsinstanceresolver$wlsinvoker.invoke(wlsinstanceresolver.java:117) @ weblogic.wsee.jaxws.wlsinstanceresolver$wlsinvoker.invoke(wlsinstanceresolver.java:91) @ com.sun.xml.ws.server.invokertube$2.invoke(invokertube.java:149) @ com.sun.xml.ws.server.sei.seiinvokertube.processrequest(seiinvokertube.java:88) @ com.sun.xml.ws.api.pipe.fiber.__dorun(fiber.java:1136) @ com.sun.xml.ws.api.pipe.fiber._dorun(fiber.java:1050) @ com.sun.xml.ws.api.pipe.fiber.dorun(fiber.java:1019) @ com.sun.xml.ws.api.pipe.fiber.runsync(fiber.java:877) @ com.sun.xml.ws.server.wsendpointimpl$2.process(wsendpointimpl.java:419) @ com.sun.xml.ws.transport.http.httpadapter$httptoolkit.handle(httpadapter.java:868) @ com.sun.xml.ws.transport.http.httpadapter.handle(httpadapter.java:422) @ com.sun.xml.ws.transport.http.servlet.servletadapter.handle(servletadapter.java:169) @ weblogic.wsee.jaxws.wlsservletadapter.handle(wlsservletadapter.java:199) @ weblogic.wsee.jaxws.httpservletadapter$authorizedinvoke.run(httpservletadapter.java:640) @ weblogic.security.acl.internal.authenticatedsubject.doas(authenticatedsubject.java:363) @ weblogic.security.service.securitymanager.runas(securitymanager.java:146) @ weblogic.wsee.util.serversecurityhelper.authenticatedinvoke(serversecurityhelper.java:108) @ weblogic.wsee.jaxws.httpservletadapter$3.run(httpservletadapter.java:284) @ weblogic.wsee.jaxws.httpservletadapter.post(httpservletadapter.java:293) @ weblogic.wsee.jaxws.jaxwsservlet.dorequest(jaxwsservlet.java:128) @ weblogic.servlet.http.abstractasyncservlet.service(abstractasyncservlet.java:99) @ javax.servlet.http.httpservlet.service(httpservlet.java:844) @ weblogic.servlet.internal.stubsecurityhelper$servletserviceaction.run(stubsecurityhelper.java:280) @ weblogic.servlet.internal.stubsecurityhelper$servletserviceaction.run(stubsecurityhelper.java:254) @ weblogic.servlet.internal.stubsecurityhelper.invokeservlet(stubsecurityhelper.java:136) @ weblogic.servlet.internal.servletstubimpl.execute(servletstubimpl.java:346) @ weblogic.servlet.internal.servletstubimpl.execute(servletstubimpl.java:243) @ weblogic.servlet.internal.webappservletcontext$servletinvocationaction.wraprun(webappservletcontext.java:3432) @ weblogic.servlet.internal.webappservletcontext$servletinvocationaction.run(webappservletcontext.java:3402) @ weblogic.security.acl.internal.authenticatedsubject.doas(authenticatedsubject.java:321) @ weblogic.security.service.securitymanager.runas(securitymanager.java:120) @ weblogic.servlet.provider.wlssubjecthandle.run(wlssubjecthandle.java:57) @ weblogic.servlet.internal.webappservletcontext.dosecuredexecute(webappservletcontext.java:2285) @ weblogic.servlet.internal.webappservletcontext.securedexecute(webappservletcontext.java:2201) @ weblogic.servlet.internal.webappservletcontext.execute(webappservletcontext.java:2179) @ weblogic.servlet.internal.servletrequestimpl.run(servletrequestimpl.java:1572) @ weblogic.servlet.provider.containersupportproviderimpl$wlsrequestexecutor.run(containersupportproviderimpl.java:255) @ weblogic.work.executethread.execute(executethread.java:311) @ weblogic.work.executethread.run(executethread.java:263) caused by: javax.persistence.persistenceexception: org.hibernate.exception.genericjdbcexception: not open connection @ org.hibernate.jpa.spi.abstractentitymanagerimpl.convert(abstractentitymanagerimpl.java:1763) @ org.hibernate.jpa.spi.abstractentitymanagerimpl.convert(abstractentitymanagerimpl.java:1677) @ org.hibernate.jpa.internal.queryimpl.getresultlist(queryimpl.java:458) @ org.hibernate.jpa.criteria.compile.criteriaquerytypequeryadapter.getresultlist(criteriaquerytypequeryadapter.java:67) @ com.example.ejb.dao.moduledao.getmodulebyname(moduledao.java:77) @ com.example.ejb.dao.moduledao_b09ccg_moduledaoremoteimpl.__wl_invoke(unknown source) @ weblogic.ejb.container.internal.sessionremotemethodinvoker.invoke(sessionremotemethodinvoker.java:34) @ com.example.ejb.dao.moduledao_b09ccg_moduledaoremoteimpl.getmodulebyname(unknown source) @ com.example.ejb.dao.moduledao_b09ccg_moduledaoremoteimpl_cbv.getmodulebyname(unknown source) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @ weblogic.ejb.container.internal.remotebusinessintfproxy.invoke(remotebusinessintfproxy.java:84) ... 46 more caused by: org.hibernate.exception.genericjdbcexception: not open connection @ org.hibernate.exception.internal.standardsqlexceptionconverter.convert(standardsqlexceptionconverter.java:54) @ org.hibernate.engine.jdbc.spi.sqlexceptionhelper.convert(sqlexceptionhelper.java:126) @ org.hibernate.engine.jdbc.spi.sqlexceptionhelper.convert(sqlexceptionhelper.java:112) @ org.hibernate.engine.jdbc.internal.logicalconnectionimpl.obtainconnection(logicalconnectionimpl.java:235) @ org.hibernate.engine.jdbc.internal.logicalconnectionimpl.getconnection(logicalconnectionimpl.java:171) @ org.hibernate.engine.jdbc.internal.statementpreparerimpl.connection(statementpreparerimpl.java:63) @ org.hibernate.engine.jdbc.internal.statementpreparerimpl$5.doprepare(statementpreparerimpl.java:162) @ org.hibernate.engine.jdbc.internal.statementpreparerimpl$statementpreparationtemplate.preparestatement(statementpreparerimpl.java:186) @ org.hibernate.engine.jdbc.internal.statementpreparerimpl.preparequerystatement(statementpreparerimpl.java:160) @ org.hibernate.loader.loader.preparequerystatement(loader.java:1885) @ org.hibernate.loader.loader.executequerystatement(loader.java:1862) @ org.hibernate.loader.loader.executequerystatement(loader.java:1839) @ org.hibernate.loader.loader.doquery(loader.java:910) @ org.hibernate.loader.loader.doqueryandinitializenonlazycollections(loader.java:355) @ org.hibernate.loader.loader.dolist(loader.java:2554) @ org.hibernate.loader.loader.dolist(loader.java:2540) @ org.hibernate.loader.loader.listignorequerycache(loader.java:2370) @ org.hibernate.loader.loader.list(loader.java:2365) @ org.hibernate.loader.hql.queryloader.list(queryloader.java:497) @ org.hibernate.hql.internal.ast.querytranslatorimpl.list(querytranslatorimpl.java:387) @ org.hibernate.engine.query.spi.hqlqueryplan.performlist(hqlqueryplan.java:236) @ org.hibernate.internal.sessionimpl.list(sessionimpl.java:1300) @ org.hibernate.internal.queryimpl.list(queryimpl.java:103) @ org.hibernate.jpa.internal.queryimpl.list(queryimpl.java:573) @ org.hibernate.jpa.internal.queryimpl.getresultlist(queryimpl.java:449) ... 57 more caused by: java.sql.sqlexception: java.lang.nullpointerexception @ weblogic.jdbc.common.internal.jdbcutil.wrapandthrowresourceexception(jdbcutil.java:278) @ weblogic.jdbc.common.internal.rmidatasource.getconnection(rmidatasource.java:416) @ weblogic.jdbc.common.internal.rmidatasource.getconnection(rmidatasource.java:393) @ org.hibernate.engine.jdbc.connections.internal.datasourceconnectionproviderimpl.getconnection(datasourceconnectionproviderimpl.java:139) @ org.hibernate.internal.abstractsessionimpl$noncontextualjdbcconnectionaccess.obtainconnection(abstractsessionimpl.java:380) @ org.hibernate.engine.jdbc.internal.logicalconnectionimpl.obtainconnection(logicalconnectionimpl.java:228) ... 78 more caused by: java.lang.nullpointerexception @ weblogic.security.simplecallbackhandler.<init>(simplecallbackhandler.java:38) @ weblogic.jdbc.common.internal.rmidatasource.getsubject(rmidatasource.java:466) @ weblogic.jdbc.common.internal.rmidatasource.getconnection(rmidatasource.java:407) ... 82 more <22-apr-2015 15:58:57 o'clock cest> <error> <com.sun.xml.ws.server.sei.tiehandler> <bea-000000> <ejb exception: ; nested exception is: javax.persistence.persistenceexception: org.hibernate.exception.genericjdbcexception: not open connection javax.ejb.ejbexception: ejb exception: ; nested exception is: javax.persistence.persistenceexception: org.hibernate.exception.genericjdbcexception: not open connection @ weblogic.ejb.container.internal.remotebusinessintfproxy.unwrapremoteexception(remotebusinessintfproxy.java:117) @ weblogic.ejb.container.internal.remotebusinessintfproxy.invoke(remotebusinessintfproxy.java:97) @ com.sun.proxy.$proxy191.getmodulebyname(unknown source) @ com.example.ejb.module.maestro.getmodulebyname(maestro.java:81) @ com.example.webservice.modulelauncher.launch(modulelauncher.java:52) truncated. see log file complete stacktrace caused by: javax.persistence.persistenceexception: org.hibernate.exception.genericjdbcexception: not open connection @ org.hibernate.jpa.spi.abstractentitymanagerimpl.convert(abstractentitymanagerimpl.java:1763) @ org.hibernate.jpa.spi.abstractentitymanagerimpl.convert(abstractentitymanagerimpl.java:1677) @ org.hibernate.jpa.internal.queryimpl.getresultlist(queryimpl.java:458) @ org.hibernate.jpa.criteria.compile.criteriaquerytypequeryadapter.getresultlist(criteriaquerytypequeryadapter.java:67) @ com.example.ejb.dao.moduledao.getmodulebyname(moduledao.java:77) truncated. see log file complete stacktrace caused by: org.hibernate.exception.genericjdbcexception: not open connection @ org.hibernate.exception.internal.standardsqlexceptionconverter.convert(standardsqlexceptionconverter.java:54) @ org.hibernate.engine.jdbc.spi.sqlexceptionhelper.convert(sqlexceptionhelper.java:126) @ org.hibernate.engine.jdbc.spi.sqlexceptionhelper.convert(sqlexceptionhelper.java:112) @ org.hibernate.engine.jdbc.internal.logicalconnectionimpl.obtainconnection(logicalconnectionimpl.java:235) @ org.hibernate.engine.jdbc.internal.logicalconnectionimpl.getconnection(logicalconnectionimpl.java:171) truncated. see log file complete stacktrace caused by: java.sql.sqlexception: java.lang.nullpointerexception @ weblogic.jdbc.common.internal.jdbcutil.wrapandthrowresourceexception(jdbcutil.java:278) @ weblogic.jdbc.common.internal.rmidatasource.getconnection(rmidatasource.java:416) @ weblogic.jdbc.common.internal.rmidatasource.getconnection(rmidatasource.java:393) @ org.hibernate.engine.jdbc.connections.internal.datasourceconnectionproviderimpl.getconnection(datasourceconnectionproviderimpl.java:139) @ org.hibernate.internal.abstractsessionimpl$noncontextualjdbcconnectionaccess.obtainconnection(abstractsessionimpl.java:380) truncated. see log file complete stacktrace caused by: java.lang.nullpointerexception @ weblogic.security.simplecallbackhandler.<init>(simplecallbackhandler.java:38) @ weblogic.jdbc.common.internal.rmidatasource.getsubject(rmidatasource.java:466) @ weblogic.jdbc.common.internal.rmidatasource.getconnection(rmidatasource.java:407) @ weblogic.jdbc.common.internal.rmidatasource.getconnection(rmidatasource.java:393) @ org.hibernate.engine.jdbc.connections.internal.datasourceconnectionproviderimpl.getconnection(datasourceconnectionproviderimpl.java:139) truncated. see log file complete stacktrace
need help! please feel free ask more information.
i worked on weblogic once upon time, don't have test right now, doesn't seem jpa jta-data-source name complete, doesn't need java://u_interface?
Comments
Post a Comment