-
15. Re: naming context read only while creating hibernate session
smarlow Nov 16, 2011 12:59 PM (in response to smarlow)If your adding the "transaction.factory_class" property to your persistence.xml, try removing that.
-
16. Re: naming context read only while creating hibernate session
jilani2423 Nov 16, 2011 1:15 PM (in response to smarlow)please see the below persistence xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd ">
<persistence-unit name="ldm_pu">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/ldmDS</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" />
</properties>
</persistence-unit>
</persistence>
-
17. Re: naming context read only while creating hibernate session
smarlow Nov 16, 2011 1:26 PM (in response to jilani2423)What is the value of the factory instance variable? Did you try printing that? Seems that you should use that if its not null.
-
18. Re: naming context read only while creating hibernate session
jilani2423 Nov 16, 2011 1:31 PM (in response to smarlow)It is null
Thank You,
Jilani
-
19. Re: naming context read only while creating hibernate session
jilani2423 Nov 16, 2011 1:34 PM (in response to jilani2423)Please find below stack trace, may be it will help you.
23:59:56,201 INFO [org.jboss.jpa] (MSC service thread 1-4) JBAS011403: Stopping
Persistence Unit Service 'ldm.war#ldm_pu'
23:59:56,402 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) Sto
pped deployment ldm.war in 209ms
23:59:56,405 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) Sta
rting deployment of "ldm.war"
23:59:57,629 INFO [org.jboss.jpa] (MSC service thread 1-2) JBAS011401: Read per
sistence.xml for ldm_pu
23:59:57,681 INFO [org.jboss.jpa] (MSC service thread 1-1) JBAS011402: Starting
Persistence Unit Service 'ldm.war#ldm_pu'
23:59:57,684 INFO [org.hibernate.ejb.Ejb3Configuration] (MSC service thread 1-1
) HHH000204: Processing PersistenceUnitInfo [
name: ldm_pu
...]
23:59:57,707 INFO [org.hibernate.service.jdbc.connections.internal.ConnectionPr
oviderInitiator] (MSC service thread 1-1) HHH000130: Instantiating explicit conn
ection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvid
er
23:59:57,717 INFO [org.hibernate.dialect.Dialect] (MSC service thread 1-1) HHH0
00400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
23:59:57,719 INFO [org.hibernate.engine.transaction.internal.TransactionFactory
Initiator] (MSC service thread 1-1) HHH000268: Transaction strategy: org.hiberna
te.engine.transaction.internal.jta.CMTTransactionFactory
23:59:57,722 INFO [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (M
SC service thread 1-1) HHH000397: Using ASTQueryTranslatorFactory
23:59:57,731 INFO [org.apache.catalina.core.StandardContext] (MSC service threa
d 1-2) The listener "com.sun.faces.config.ConfigureListener" is already configur
ed for this context. The duplicate definition has been ignored.
23:59:57,737 INFO [javax.enterprise.resource.webcontainer.jsf.config] (MSC serv
ice thread 1-2) Initializing Mojarra 2.1.3 (SNAPSHOT 20110825) for context '/ldm
'
23:59:57,960 INFO [org.jboss.web] (MSC service thread 1-2) registering web cont
ext: /ldm
23:59:57,983 INFO [org.jboss.as.server.controller] (DeploymentScanner-threads -
1) Replaced deployment "ldm.war" with deployment "ldm.war"
00:00:02,061 INFO [stdout] (http-java.sun.com-127.0.0.1-80-3) TemplateBean.Temp
lateBean()
00:00:06,008 INFO [stdout] (http-java.sun.com-127.0.0.1-80-1) LoginBean.login()
00:00:06,033 INFO [stdout] (http-java.sun.com-127.0.0.1-80-1) -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- --
00:00:06,034 INFO [stdout] (http-java.sun.com-127.0.0.1-80-1) BaseDAO.getJNDICo
nnection() initialContext: javax.naming.InitialContext@3674fd44
00:00:06,035 INFO [stdout] (http-java.sun.com-127.0.0.1-80-1) BaseDAO.getJNDICo
nnection() result: org.jboss.jca.adapters.jdbc.jdk6.WrappedConnectionJDK6@3a9f97
4a
00:00:06,035 INFO [stdout] (http-java.sun.com-127.0.0.1-80-1) -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- --
00:00:06,059 INFO [org.hibernate.dialect.Dialect] (http-java.sun.com-127.0.0.1-
80-1) HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
00:00:06,060 INFO [org.hibernate.engine.transaction.internal.TransactionFactory
Initiator] (http-java.sun.com-127.0.0.1-80-1) HHH000268: Transaction strategy: o
rg.hibernate.engine.transaction.internal.jta.CMTTransactionFactory
00:00:06,061 INFO [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (h
ttp-java.sun.com-127.0.0.1-80-1) HHH000397: Using ASTQueryTranslatorFactory
00:00:06,065 INFO [stdout] (http-java.sun.com-127.0.0.1-80-1) BaseDAO.getEMF()
emf: org.hibernate.ejb.EntityManagerFactoryImpl@196acde9
00:00:06,066 INFO [stdout] (http-java.sun.com-127.0.0.1-80-1) BaseDAO.getEMF()
factory: null
00:00:06,067 WARNING [javax.enterprise.resource.webcontainer.jsf.lifecycle] (htt
p-java.sun.com-127.0.0.1-80-1) #{loginBean.login}: java.lang.NullPointerExceptio
n: javax.faces.FacesException: #{loginBean.login}: java.lang.NullPointerExceptio
n
at com.sun.faces.application.ActionListenerImpl.processAction(ActionList
enerImpl.java:118) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
at javax.faces.component.UICommand.broadcast(UICommand.java:315) [jboss-
jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
[jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1
259) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicat
ionPhase.java:81) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.3
-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
[jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) [jboss
-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:329) [jbossweb-7.0.3.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:248) [jbossweb-7.0.3.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:275) [jbossweb-7.0.3.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:161) [jbossweb-7.0.3.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmC
loserValve.java:50) [jboss-as-jpa-7.1.0.Alpha2-SNAPSHOT.jar:7.1.0.Alpha2-SNAPSHO
T]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(Secu
rityContextAssociationValve.java:151) [jboss-as-web-7.1.0.Alpha2-SNAPSHOT.jar:7.
1.0.Alpha2-SNAPSHOT]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:155) [jbossweb-7.0.3.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:102) [jbossweb-7.0.3.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:109) [jbossweb-7.0.3.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:362) [jbossweb-7.0.3.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:877) [jbossweb-7.0.3.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ss(Http11Protocol.java:671) [jbossweb-7.0.3.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:93
0) [jbossweb-7.0.3.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]
Caused by: javax.faces.el.EvaluationException: java.lang.NullPointerException
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(Met
hodBindingMethodExpressionAdapter.java:102) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.
jar:2.0.0.Beta1]
at com.sun.faces.application.ActionListenerImpl.processAction(ActionList
enerImpl.java:102) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
... 21 more
Caused by: java.lang.NullPointerException
at org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.getStat
us(JtaStatusHelper.java:73) [hibernate-core-4.0.0.CR6.jar:4.0.0.CR6]
at org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.isActiv
e(JtaStatusHelper.java:115) [hibernate-core-4.0.0.CR6.jar:4.0.0.CR6]
at org.hibernate.engine.transaction.internal.jta.CMTTransaction.join(CMT
Transaction.java:149) [hibernate-core-4.0.0.CR6.jar:4.0.0.CR6]
at org.hibernate.ejb.AbstractEntityManagerImpl.joinTransaction(AbstractE
ntityManagerImpl.java:1201) [hibernate-entitymanager-4.0.0.CR6.jar:4.0.0.CR6]
at org.hibernate.ejb.AbstractEntityManagerImpl.postInit(AbstractEntityMa
nagerImpl.java:172) [hibernate-entitymanager-4.0.0.CR6.jar:4.0.0.CR6]
at org.hibernate.ejb.EntityManagerImpl.<init>(EntityManagerImpl.java:90)
[hibernate-entitymanager-4.0.0.CR6.jar:4.0.0.CR6]
at org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(Entity
ManagerFactoryImpl.java:111) [hibernate-entitymanager-4.0.0.CR6.jar:4.0.0.CR6]
at org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(Entity
ManagerFactoryImpl.java:106) [hibernate-entitymanager-4.0.0.CR6.jar:4.0.0.CR6]
at com.ahadanfal.common.dao.BaseDAO.getEMF(BaseDAO.java:37) [classes:]
at com.ldm.bean.LoginBean.login(LoginBean.java:39) [classes:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_2
6]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39) [:1.6.0_26]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25) [:1.6.0_26]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_26]
at org.apache.el.parser.AstValue.invoke(AstValue.java:196) [jbossweb-7.0
.3.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:2
76) [jbossweb-7.0.3.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpress
ion.java:105) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(Met
hodBindingMethodExpressionAdapter.java:88) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.j
ar:2.0.0.Beta1]
... 22 more
00:00:06,079 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-
host].[/ldm].[Faces Servlet]] (http-java.sun.com-127.0.0.1-80-1) Servlet.service
() for servlet Faces Servlet threw exception: java.lang.NullPointerException
at org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.getStat
us(JtaStatusHelper.java:73) [hibernate-core-4.0.0.CR6.jar:4.0.0.CR6]
at org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.isActiv
e(JtaStatusHelper.java:115) [hibernate-core-4.0.0.CR6.jar:4.0.0.CR6]
at org.hibernate.engine.transaction.internal.jta.CMTTransaction.join(CMT
Transaction.java:149) [hibernate-core-4.0.0.CR6.jar:4.0.0.CR6]
at org.hibernate.ejb.AbstractEntityManagerImpl.joinTransaction(AbstractE
ntityManagerImpl.java:1201) [hibernate-entitymanager-4.0.0.CR6.jar:4.0.0.CR6]
at org.hibernate.ejb.AbstractEntityManagerImpl.postInit(AbstractEntityMa
nagerImpl.java:172) [hibernate-entitymanager-4.0.0.CR6.jar:4.0.0.CR6]
at org.hibernate.ejb.EntityManagerImpl.<init>(EntityManagerImpl.java:90)
[hibernate-entitymanager-4.0.0.CR6.jar:4.0.0.CR6]
at org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(Entity
ManagerFactoryImpl.java:111) [hibernate-entitymanager-4.0.0.CR6.jar:4.0.0.CR6]
at org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(Entity
ManagerFactoryImpl.java:106) [hibernate-entitymanager-4.0.0.CR6.jar:4.0.0.CR6]
at com.ahadanfal.common.dao.BaseDAO.getEMF(BaseDAO.java:37) [classes:]
at com.ldm.bean.LoginBean.login(LoginBean.java:39) [classes:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_2
6]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39) [:1.6.0_26]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25) [:1.6.0_26]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_26]
at org.apache.el.parser.AstValue.invoke(AstValue.java:196) [jbossweb-7.0
.3.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:2
76) [jbossweb-7.0.3.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpress
ion.java:105) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(Met
hodBindingMethodExpressionAdapter.java:88) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.j
ar:2.0.0.Beta1]
at com.sun.faces.application.ActionListenerImpl.processAction(ActionList
enerImpl.java:102) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
at javax.faces.component.UICommand.broadcast(UICommand.java:315) [jboss-
jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
[jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1
259) [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicat
ionPhase.java:81) [jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.3
-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
[jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) [jboss
-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:329) [jbossweb-7.0.3.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:248) [jbossweb-7.0.3.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:275) [jbossweb-7.0.3.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:161) [jbossweb-7.0.3.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmC
loserValve.java:50) [jboss-as-jpa-7.1.0.Alpha2-SNAPSHOT.jar:7.1.0.Alpha2-SNAPSHO
T]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(Secu
rityContextAssociationValve.java:151) [jboss-as-web-7.1.0.Alpha2-SNAPSHOT.jar:7.
1.0.Alpha2-SNAPSHOT]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:155) [jbossweb-7.0.3.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:102) [jbossweb-7.0.3.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:109) [jbossweb-7.0.3.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:362) [jbossweb-7.0.3.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:877) [jbossweb-7.0.3.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ss(Http11Protocol.java:671) [jbossweb-7.0.3.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:93
0) [jbossweb-7.0.3.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]
Thank You,
Jilani
-
20. Re: naming context read only while creating hibernate session
smarlow Nov 16, 2011 1:55 PM (in response to jilani2423)Yeah, looks like the same as the previous call stack. Either approach should be made to work. I'm not sure why the factory is null. You could enable TRACE logging as mentioned in here.
For the other approach in your code, you would need to add more properties to specify how the transaction manager is to be located. I'll look around for that.
-
21. Re: naming context read only while creating hibernate session
smarlow Nov 16, 2011 3:12 PM (in response to smarlow)1 of 1 people found this helpfulTry also setting property "hibernate.transaction.jta.platform" to "org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform". When the TransactionManager is needed, that should help Hibernate (4.0) to find it.
-
22. Re: naming context read only while creating hibernate session
jilani2423 Nov 17, 2011 8:54 AM (in response to smarlow)Even after setting the above paramters, I am getting the same error. I have removed tha jars from my web application lib So that the application should use servers hibernate jars then also same error.
Please find the below EntityManagerFactory object's data grabbed from debug mode, May be it will provide some information to fix this.
[null,
java.vm.version=20.1-b02,
null,
null,
java.vendor.url=http://java.sun.com/,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
java.awt.printerjob=sun.awt.windows.WPrinterJob,
null,
null,
null,
null,
null,
null,
null,
javax.xml.stream.XMLInputFactory=__redirected.__XMLInputFactory,
java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi,
null,
null,
line.separator=
,
null,
sun.rmi.dgc.client.gcInterval=3600000,
null,
null,
null,
null,
null,
null,
null,
null,
null,
java.vm.vendor=Sun Microsystems Inc.,
null,
null,
jboss.host.name=jilani-think,
null,
null,
null,
null,
hibernate.connection.release_mode=auto,
user.name=jilani,
null,
null,
hibernate.use_identifier_rollback=false,
null,
sun.desktop=windows,
null,
jboss.server.log.dir=C:\home\ahadanfal\jboss-7.0.x\jboss-as-7.1.0.Alpha2-SNAPSHOT_1944\standalone\log,
sun.cpu.endian=little,
null,
jboss.modules.dir=C:\home\ahadanfal\jboss-7.0.x\jboss-as-7.1.0.Alpha2-SNAPSHOT_1944\modules,
null,
null,
null,
null,
awt.toolkit=sun.awt.windows.WToolkit,
null,
null,
null,
hibernate.connection.datasource=java:/ldmDS,
null,
javax.xml.parsers.DocumentBuilderFactory=__redirected.__DocumentBuilderFactory,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
java.specification.vendor=Sun Microsystems Inc.,
null,
null,
null,
null,
null,
null,
null,
null,
null,
user.timezone=Asia/Calcutta,
null,
os.name=Windows 7,
null,
null,
null,
null,
java.ext.dirs=C:\myProgramFiles\Java\jdk1.6.0_26\jre\lib\ext;C:\Windows\Sun\Java\lib\ext,
sun.arch.data.model=64,
os.version=6.1,
null,
null,
null,
org.jboss.com.sun.CORBA.ORBUseDynamicStub=true,
null,
null,
null,
null,
java.vendor=Sun Microsystems Inc.,
java.rmi.server.hostname=127.0.0.1,
null,
null,
null,
java.naming.factory.url.pkgs=org.jboss.as.naming.interfaces:org.jboss.ejb.client.naming,
null,
null,
null,
null,
sun.jnu.encoding=Cp1252,
java.vm.info=mixed mode,
jboss.server.name=jilani-think,
hibernate.query.jpaql_strict_compliance=true,
sun.cpu.isalist=amd64,
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment,
sun.os.patch.level=,
null,
null,
org.omg.CORBA.ORBSingletonClass=org.jacorb.orb.ORBSingleton,
null,
null,
javax.xml.datatype.DatatypeFactory=__redirected.__DatatypeFactory,
null,
null,
user.home=C:\Users\jilani,
null,
null,
hibernate.connection.autocommit=true,
null,
java.version=1.6.0_26,
file.encoding.pkg=sun.io,
javax.xml.parsers.SAXParserFactory=__redirected.__SAXParserFactory,
org.jboss.boot.log.file=C:\home\ahadanfal\jboss-7.0.x\jboss-as-7.1.0.Alpha2-SNAPSHOT_1944\standalone\log\boot.log,
jboss.server.config.dir=C:\home\ahadanfal\jboss-7.0.x\jboss-as-7.1.0.Alpha2-SNAPSHOT_1944\standalone\configuration,
null,
null,
file.encoding=Cp1252,
sun.java.command=C:\home\ahadanfal\jboss-7.0.x\jboss-as-7.1.0.Alpha2-SNAPSHOT_1944\jboss-modules.jar -mp C:\home\ahadanfal\jboss-7.0.x\jboss-as-7.1.0.Alpha2-SNAPSHOT_1944\modules -logmodule org.jboss.logmanager -jaxpmodule javax.xml.jaxp-provider org.jboss.as.standalone -Djboss.home.dir=C:\home\ahadanfal\jboss-7.0.x\jboss-as-7.1.0.Alpha2-SNAPSHOT_1944,
null,
hibernate.transaction.factory_class=org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory,
module.path=C:\home\ahadanfal\jboss-7.0.x\jboss-as-7.1.0.Alpha2-SNAPSHOT_1944\modules,
java.vm.specification.vendor=Sun Microsystems Inc.,
javax.xml.transform.TransformerFactory=__redirected.__TransformerFactory,
null,
javax.xml.validation.SchemaFactory:http://www.w3.org/2001/XMLSchema=__redirected.__SchemaFactory,
java.util.logging.manager=org.jboss.logmanager.LogManager,
jboss.node.name=jilani-think,
null,
catalina.home=C:\home\ahadanfal\jboss-7.0.x\jboss-as-7.1.0.Alpha2-SNAPSHOT_1944\standalone\tmp,
null,
null,
null,
null,
null,
null,
sun.io.unicode.encoding=UnicodeLittle,
user.variant=,
null,
user.language=en,
java.runtime.version=1.6.0_26-b03,
null,
hibernate.transaction.flush_before_completion=false,
javax.xml.xpath.XPathFactory:http://java.sun.com/jaxp/xpath/dom=__redirected.__XPathFactory,
hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
sun.boot.library.path=C:\myProgramFiles\Java\jdk1.6.0_26\jre\bin,
java.home=C:\myProgramFiles\Java\jdk1.6.0_26\jre,
null,
null,
null,
jboss.modules.system.pkgs=org.jboss.byteman,
null,
jboss.qualified.host.name=jilani-think,
null,
null,
sun.management.compiler=HotSpot 64-Bit Tiered Compilers,
null,
null,
java.runtime.name=Java(TM) SE Runtime Environment,
null,
null,
null,
null,
null,
java.library.path=C:\myProgramFiles\Java\jdk1.6.0_26\bin;C:\Windows\Sun\Java\bin;C:\myProgramFiles\Java\jdk1.6.0_26\bin;C:\Program Files (x86)\CVSNT\;C:\myProgramFiles\apache-maven-3.0.3\bin;C:\myProgramFiles\apache-ant-1.8.2\bin;;.,
file.separator=\,
jboss.home.dir=C:\home\ahadanfal\jboss-7.0.x\jboss-as-7.1.0.Alpha2-SNAPSHOT_1944,
null,
javax.xml.stream.XMLOutputFactory=__redirected.__XMLOutputFactory,
null,
null,
null,
java.vm.specification.version=1.0,
null,
org.jboss.resolver.warning=true,
null,
null,
sun.java.launcher=SUN_STANDARD,
null,
null,
program.name=standalone.bat,
null,
null,
null,
path.separator=;,
null,
null,
jboss.server.temp.dir=C:\home\ahadanfal\jboss-7.0.x\jboss-as-7.1.0.Alpha2-SNAPSHOT_1944\standalone\tmp,
null,
null,
null,
null,
null,
null,
null,
user.country=IN,
null,
null,
java.vm.specification.name=Java Virtual Machine Specification,
null,
java.specification.version=1.6,
null,
null]
Thank You,
Jilani
-
23. Re: naming context read only while creating hibernate session
smarlow Nov 17, 2011 9:31 AM (in response to smarlow)1 of 1 people found this helpful<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd ">
<persistence-unit name="ldm_pu">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/ldmDS</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" />
<property name="hibernate.transaction.jta.platform"="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform"/>
</properties>
</persistence-unit>
</persistence>
Above is the example of what your persistence.xml should now look like.
-
24. Re: naming context read only while creating hibernate session
smarlow Nov 17, 2011 9:32 AM (in response to jilani2423)Confirm that your persistence.xml matches what I just posted, then we can talk about what to look for, in the debugger.
Scott
-
25. Re: naming context read only while creating hibernate session
jilani2423 Nov 17, 2011 9:37 AM (in response to smarlow)No, I placed the same line into hibernate cfg xml file but not in persistence.xml.
I will check with the same change in persistence.xml and let you know the result.
-
26. Re: naming context read only while creating hibernate session
jilani2423 Nov 17, 2011 9:45 AM (in response to jilani2423)Thank You, In this approach I am able to get the entity manager and even Session Object also.
20:11:46,853 INFO [stdout] (http--127.0.0.1-80-4) BaseDAO.getEMF() em: org.hibernate.ejb.EntityManagerImpl@15a4792f
20:11:46,855 INFO [stdout] (http--127.0.0.1-80-4) BaseDAO.getEMF() session: SessionImpl(PersistenceContext[entityKeys=],collectionKeys=]];ActionQueue[insertions=[] updates=[] deletions=[] collectionCreations=[] collectionRemovals=[] collectionUpdates=[]])
-
27. Re: naming context read only while creating hibernate session
smarlow Nov 17, 2011 9:51 AM (in response to jilani2423)I would like to update the JPA documentation, to show some working examples for the case that you have gotten to work.
Do you want to help on that directly or indirectly? Its pretty easy to make changes.
Either way, could you attach or paste your current working example, we could base it on that. If you click on the "use advanced editor", you get more control over formatting these forum messages.
Scott
-
28. Re: naming context read only while creating hibernate session
jilani2423 Nov 17, 2011 10:32 AM (in response to smarlow)Sure, I will do.
Do you want the war file or files like persistence.xml and then hibernate cfg xml etc?
-
29. Re: naming context read only while creating hibernate session
smarlow Nov 17, 2011 1:49 PM (in response to jilani2423)Include as much as you like.