-->
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.  [ 3 posts ] 
Author Message
 Post subject: JPA accesing a datasource using jboss
PostPosted: Tue Feb 17, 2009 11:33 am 
Beginner
Beginner

Joined: Sat Feb 07, 2009 12:31 am
Posts: 21
Hibernate 3.3.1.GA
Hibernate Annotation 3.4.0.GA
Hibernate EntityManager 3.4.0.GA
JBoss 4.2.3.GA

Hi,

I'm getting an error whenever I try to create an EntityManager using EntityManagerFactory and using a container managed datasource for my persistence unit, here's the stack:

Code:
01:57:43,070 ERROR [[/MyDemoProject]] Exception sending context initialized event to listener instance of class tonsky.web.listeners.Initializer
java.lang.VerifyError: (class: org/hibernate/ejb/Ejb3Configuration, method: <clinit> signature: ()V) Bad type in putfield/putstatic
   at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:124)
   at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
   at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)
   at tonsky.datasource.DataSrc.<clinit>(DataSrc.java:14)
   at tonsky.web.listeners.Initializer.contextInitialized(Initializer.java:28)
   at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3856)
   at org.apache.catalina.core.StandardContext.start(StandardContext.java:4361)
   at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:790)
   at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:770)
   at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:553)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:296)
   at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
   at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
   at org.apache.catalina.core.StandardContext.init(StandardContext.java:5312)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:296)
   at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
   at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
   at org.jboss.web.tomcat.service.TomcatDeployer.performDeployInternal(TomcatDeployer.java:301)
   at org.jboss.web.tomcat.service.TomcatDeployer.performDeploy(TomcatDeployer.java:104)
   at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:375)
   at org.jboss.web.WebModule.startModule(WebModule.java:83)
   at org.jboss.web.WebModule.startService(WebModule.java:61)
   at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
   at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
   at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
   at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
   at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
   at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
   at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
   at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
   at $Proxy0.start(Unknown Source)
   at org.jboss.system.ServiceController.start(ServiceController.java:417)
   at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
   at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
   at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
   at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
   at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
   at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
   at $Proxy44.start(Unknown Source)
   at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:466)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
   at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
   at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
   at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
   at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
   at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
   at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
   at org.jboss.wsf.container.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:87)
   at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
   at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
   at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
   at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
   at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
   at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
   at $Proxy45.start(Unknown Source)
   at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
   at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
   at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
   at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
   at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
   at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
   at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
   at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
   at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
   at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
   at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
   at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
   at $Proxy9.deploy(Unknown Source)
   at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
   at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
   at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
   at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
   at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)


META-INF/persistence.xml:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.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_1_0.xsd ">
   <persistence-unit name="DefaultUnit" transaction-type="JTA">   
      <provider>org.hibernate.ejb.HibernatePersistence</provider>
      <jta-data-source>java:demoproj</jta-data-source>      
      <properties>
         <property name="hibernate.ejb.cfgfile" value="hibernate.cfg.xml"/>
      </properties>
   </persistence-unit>
</persistence>


hibernate.cfg.xml:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
      "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
      "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory name="MySessionFactory">   
        <property name="hibernate.transaction.manager_lookup_class">
         org.hibernate.transaction.JBossTransactionManagerLookup
      </property>
      <property name="hibernate.transaction.factory_class">
         org.hibernate.transaction.JTATransactionFactory
      </property>
        <property name="hibernate.connection.datasource">java:/demoproj</property>
       
        <property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property>
       
        <mapping class="tonsky.datamodel.PersonalInfo"/>
        <mapping class="tonsky.datamodel.Role"/>
        <mapping class="tonsky.datamodel.UserAccount"/>
        <mapping class="tonsky.datamodel.MySelfId"/>
       
    </session-factory>
</hibernate-configuration>


My datasource:
mysql datasource (demoproj-ds.xml):

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE datasources PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN" "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd" >
<datasources>
   <local-tx-datasource>
      <jndi-name>demoproj</jndi-name>
      <connection-url>jdbc:mysql://localhost:3306/mydemoproject</connection-url>
      <driver-class>com.mysql.jdbc.Driver</driver-class>
      <user-name>root</user-name>
      <password>root</password>
      <min-pool-size>5</min-pool-size>
      <max-pool-size>20</max-pool-size>
      <metadata>
         <type-mapping>MySQL</type-mapping>
      </metadata>
   </local-tx-datasource>
</datasources>


My datasource is deployed alone in an EAR file

My persistence unit is deployed as a separate WAR

It looks like I have the same error even if I change the value of <jta-data-source> to non existing jndi binding. Am I referring to my data source the wrong way?

Thanks


Top
 Profile  
 
 Post subject: Re: JPA accesing a datasource using jboss
PostPosted: Fri Oct 23, 2009 7:04 am 
Newbie

Joined: Fri Oct 23, 2009 6:57 am
Posts: 1
Hi, I need help too with same error, I cannot solve it for days! I am frustrated with that, I use JBoss 5, I tried to add/delete libs in app or in JBoss and another attempts I thought it could be solve my problems in application, thanks a lot


Top
 Profile  
 
 Post subject: Re: JPA accesing a datasource using jboss
PostPosted: Wed Dec 09, 2009 5:06 pm 
Newbie

Joined: Tue Dec 01, 2009 2:41 pm
Posts: 4
You have probably solved this, but here goes for anyone else who has this problem.

First, I'm not sure why you are deploying your datasource XML in an EAR file. You can simply copy the XML file directly into the JBoss deploy directory. That can be useful since JBoss will notice it and deploy the datasource for you. It also spits out lots of helpful information on what it is doing, the most useful of which is the JNDI name for the datasource.

Second, you have a malformed URL in your jta-data-source element. It needs to be "java:/demoproj" I hope this helps someone. Hibernate seems to have some serious issues with reporting errors.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.