[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Re: org.hibernate.HibernateException: Could not find datasou

schander10 do-not-reply at jboss.com
Wed Jul 23 12:38:46 EDT 2008


I am using Jboss-4.2.2.GA.

I have setup the datasource and it is visible in the JMX Console. I am using SEAM Hibernate and JPA. The following is the configuration in my persistence.xml


  | <?xml version="1.0" encoding="UTF-8"?>
  | <!-- Persistence deployment descriptor for dev profile -->
  | <persistence 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"
  |              version="1.0">
  | 
  |     <persistence-unit name="orads" transaction-type="JTA">
  |         <provider>org.hibernate.ejb.HibernatePersistence</provider>
  |         <jta-data-source>java:/OracleDS</jta-data-source>
  |         <properties>
  |            <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect"/>
  |             <property name="hibernate.transaction.manager_lookup_class"
  |                       value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
  | 			
  |             <!-- Logging -->
  |             <property name="hibernate.show_sql" value="true"/>
  |             <property name="hibernate.use_sql_comments" value="true"/>
  |             <property name="hibernate.format_sql" value="true"/>
  | 
  |         </properties>
  |     </persistence-unit>
  | 
  | </persistence>
  | 

I have set up the entityManagerFactory in the components.xml as 


  | <components xmlns="http://jboss.com/products/seam/components" 
  |             xmlns:core="http://jboss.com/products/seam/core"
  |             xmlns:persistence="http://jboss.com/products/seam/persistence"
  |             xmlns:spring="http://jboss.com/products/seam/spring"
  |             xmlns:transaction="http://jboss.com/products/seam/transaction"
  |             xmlns:security="http://jboss.com/products/seam/security"
  |   	 		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  |             xsi:schemaLocation="http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd 
  |                                 http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.0.xsd
  |                                 http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd
  |                                 http://jboss.com/products/seam/spring http://jboss.com/products/seam/spring-2.0.xsd
  |                        			http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.0.xsd 
  |                                 http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.0.xsd">
  |                                                          
  |   	<core:init debug="false" jndi-pattern="orads/#{ejbName}/local"/>
  |   	
  |  
  | 	<persistence:entity-manager-factory installed="true"
  | 	                                      name="oradsEntityManagerFactory"
  |                                               persistence-unit-name="orads"/>
  |                                         
  |         <persistence:managed-persistence-context name="entityManager"
  | 	                                      auto-create="true"
  | 	                                      
  | 	                                      persistence-unit-jndi-name="java:/oradsEntityManagerFactory">
  |         </persistence:managed-persistence-context>
  | </components>
  | 

When I deploy my war file, I get the following in the jboss logs:


  | .....
  | 
  | 12:13:11,994 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
  | 12:13:12,141 INFO  [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=OracleDS' to JNDI name 'java:OracleDS'
  | .....
  | .....
  | 
  | 12:13:26,813 INFO  [Contexts] starting up: oradsEntityManagerFactory
  | 12:13:27,125 INFO  [Version] Hibernate Annotations 3.3.0.GA
  | 12:13:27,159 INFO  [Environment] Hibernate 3.2.3
  | 12:13:27,177 INFO  [Environment] hibernate.properties not found
  | 12:13:27,183 INFO  [Environment] Bytecode provider name : javassist
  | 12:13:27,193 INFO  [Environment] using JDK 1.4 java.sql.Timestamp handling
  | 12:13:27,331 INFO  [Version] Hibernate EntityManager 3.3.1.GA
  | 12:13:28,322 INFO  [AnnotationBinder] Binding entity from annotated class: org.mypack.core.model.ArticleRating
  | 12:13:28,433 INFO  [EntityBinder] Bind entity org.mypack.core.model.ArticleRating on table ARTICLE_RATING
  | 12:13:28,547 INFO  [AnnotationBinder] Binding entity from annotated class: org.mypack.core.model.Advertisement
  | 12:13:28,548 INFO  [EntityBinder] Bind entity org.mypack.core.model.Advertisement on table ADVERTISEMENT
  | 12:13:28,583 INFO  [Version] Hibernate Validator 3.0.0.GA
  | 12:13:28,857 INFO  [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
  | 12:13:28,862 ERROR [[/mypack]] Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
  | org.jboss.seam.InstantiationException: Could not instantiate Seam component: oradsEntityManagerFactory
  |         at org.jboss.seam.Component.newInstance(Component.java:1986)
  |         at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)
  |         at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278)
  |         at org.jboss.seam.contexts.ServletLifecycle.endInitialization(ServletLifecycle.java:95)
  |         at org.jboss.seam.init.Initialization.init(Initialization.java:596)
  |         at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:34)
  |         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(NativeMethodAccessorImpl.java:39)
  |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |         at java.lang.reflect.Method.invoke(Method.java:585)
  |         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(NativeMethodAccessorImpl.java:39)
  |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |         at java.lang.reflect.Method.invoke(Method.java:585)
  |         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.GeneratedMethodAccessor4.invoke(Unknown Source)
  |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |         at java.lang.reflect.Method.invoke(Method.java:585)
  |         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.GeneratedMethodAccessor10.invoke(Unknown Source)
  |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |         at java.lang.reflect.Method.invoke(Method.java:585)
  |         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(NativeMethodAccessorImpl.java:39)
  |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |         at java.lang.reflect.Method.invoke(Method.java:585)
  |         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.GeneratedMethodAccessor20.invoke(Unknown Source)
  |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |         at java.lang.reflect.Method.invoke(Method.java:585)
  |         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.startService(AbstractDeploymentScanner.java:336)
  |         at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
  |         at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
  |         at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
  |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |         at java.lang.reflect.Method.invoke(Method.java:585)
  |         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.GeneratedMethodAccessor10.invoke(Unknown Source)
  |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |         at java.lang.reflect.Method.invoke(Method.java:585)
  |         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 $Proxy4.start(Unknown Source)
  |         at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
  |         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 org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
  |         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  |         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |         at java.lang.reflect.Method.invoke(Method.java:585)
  |         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 $Proxy5.deploy(Unknown Source)
  |         at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
  |         at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
  |         at org.jboss.Main.boot(Main.java:200)
  |         at org.jboss.Main$1.run(Main.java:508)
  |         at java.lang.Thread.run(Thread.java:613)
  | Caused by: javax.persistence.PersistenceException: org.hibernate.HibernateException: Could not find datasource: java:/OracleDS
  |         at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:737)
  |         at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:121)
  |         at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
  |         at org.jboss.seam.persistence.EntityManagerFactory.createEntityManagerFactory(EntityManagerFactory.java:85)
  |         at org.jboss.seam.persistence.EntityManagerFactory.startup(EntityManagerFactory.java:50)
  |         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  |         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |         at java.lang.reflect.Method.invoke(Method.java:585)
  |         at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
  |         at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
  |         at org.jboss.seam.Component.callComponentMethod(Component.java:2100)
  |         at org.jboss.seam.Component.callCreateMethod(Component.java:2015)
  |         at org.jboss.seam.Component.newInstance(Component.java:1976)
  |         ... 140 more
  | Caused by: org.hibernate.HibernateException: Could not find datasource: java:/OracleDS
  |         at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:59)
  |         at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
  |         at org.hibernate.ejb.InjectionSettingsFactory.createConnectionProvider(InjectionSettingsFactory.java:29)
  |         at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
  |         at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
  |         at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
  |         at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)
  |         at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:730)
  | 


I have placed all the hibernate jar files into jboss server/default/lib directory so that all of them are in the classpath. 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4166210#4166210

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4166210



More information about the jboss-user mailing list