[jboss-user] [JBoss/Spring Integration] - Problem using JBoss Spring Hibernate Struts

aangreen do-not-reply at jboss.com
Sat Dec 6 10:30:03 EST 2008


Hi,

I've been problem with jboss spring and hibernate.

When I start Jboss an Exception ocurred...

this´s my exception:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: CMADS] Unable to configure EntityManagerFactory
  | 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
  | 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
  | 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
  | 	at java.security.AccessController.doPrivileged(Native Method)
  | 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
  | 	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
  | 	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
  | 	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
  | 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
  | 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
  | 	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)
  | 	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
  | 	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
  | 	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
  | 	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
  | 	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
  | 	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.GeneratedMethodAccessor3.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.GeneratedMethodAccessor9.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 $Proxy53.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 $Proxy54.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.GeneratedMethodAccessor25.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.GeneratedMethodAccessor3.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.GeneratedMethodAccessor9.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:304)
  | 	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:595)

my applicationContext.xml

<?xml version="1.0" encoding="UTF-8"?>
  | <beans xmlns="http://www.springframework.org/schema/beans"
  |        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  |        xmlns:aop="http://www.springframework.org/schema/aop"
  |        xmlns:tx="http://www.springframework.org/schema/tx"
  |        xmlns:jee="http://www.springframework.org/schema/jee"
  |        xsi:schemaLocation="
  |        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
  |        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
  |        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
  |        http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd">
  | 
  |     <!-- In a fully J5EE compatible environment, the following xml tag should work in accessing the EMF -->          
  | <!--
  |     <jee:jndi-lookup id="entityManagerFactory" jndi-name="java:/CMADS"/>
  | -->
  |   
  |     <!-- Hack for JBoss 4.something until full compliance is reached -->
  |     <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
  |       <property name="persistenceUnitName" value="CMADS"/>
  |     </bean>
  | 
  |     <!-- Let's access the JTA transaction manager of the application server -->
  |     <bean id="txManager" class="org.springframework.transaction.jta.JtaTransactionManager">
  |         <property name="transactionManagerName" value="java:/TransactionManager"/>
  |         <property name="userTransactionName" value="UserTransaction"/>
  |     </bean>
  |    
  | <!--     Let's define a DAO that uses the EMF -->
  | <!--    <bean id="accountHolderDAO" class="bankapp.dao.AccountHolderDAO">-->
  | <!--        <property name="emf" ref="entityManagerFactory"/>-->
  | <!--    </bean>-->
  |    
  |     <!-- This is a service object that we want to make transactional.
  |          You will have an interface implemented (AccountManager) in the class.
  |     -->
  | <!--    <bean id="accountManager" class="bankapp.AccountManagerImpl">-->
  | <!--        <property name="accountHolderDAO" ref="accountHolderDAO"/>-->
  | <!--    </bean>-->
  |    
  |    
  |     <!-- The transactional advice (i.e. what 'happens'; see the <aop:advisor/> bean below) -->
  | <!--    <tx:advice id="txAdvice" transaction-manager="txManager">-->
  | <!--         the transactional semantics... -->
  | <!--        <tx:attributes>-->
  | <!--             all methods starting with 'get' are read-only transactions -->
  | <!--            <tx:method name="get*" read-only="true"/>-->
  | <!--             other methods use the default transaction settings (see below) -->
  | <!--            <tx:method name="*" read-only="false" />-->
  | <!--        </tx:attributes>-->
  | <!--    </tx:advice>-->
  |    
  |    
  |     <!-- ensure that the above transactional advice runs for execution of any operation defined by the AccountManager interface -->
  | <!--    <aop:config>-->
  | <!--        <aop:pointcut id="accountManagerOperation",-->
  | <!--           expression="execution(* bankapp.AccountManager.*(..))"/>-->
  | <!--        <aop:advisor advice-ref="txAdvice" pointcut-ref="accountManagerOperation"/>-->
  | <!--    </aop:config>-->
  | 
  | </beans>
  | 

my web.xml
<?xml version="1.0" encoding="UTF-8"?>
  | <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
  | 
  |     <display-name>Estacio</display-name>
  | 
  |     <filter>
  |         <filter-name>struts2</filter-name>
  |         <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
  |     </filter>
  | 
  |     <filter-mapping>
  |         <filter-name>struts2</filter-name>
  |         <url-pattern>/*</url-pattern>
  |     </filter-mapping>
  | 
  |     <welcome-file-list>
  |         <welcome-file>index.html</welcome-file>
  |     </welcome-file-list>
  |     
  |     <context-param>
  |         <description>Spring configuration file</description>
  |         <param-name>contextConfigLocation</param-name>
  |         <param-value>/WEB-INF/applicationContext.xml</param-value>
  | 	</context-param>
  | 
  |     <listener>
  |         <description>Spring Loader</description>
  |         <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  | 	</listener>
  | 	
  | 	<persistence-unit-ref>
  |         <description>
  |             Persistence unit for the bank application.
  |         </description>
  |         <persistence-unit-ref-name>persistence/CMADS</persistence-unit-ref-name>
  |         <persistence-unit-name>CMADS</persistence-unit-name>       
  | 	</persistence-unit-ref>
  | 
  | </web-app>
  | 

my persistence.xml

  | <?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="CMADS" transaction-type="JTA">
  |     <provider>org.hibernate.ejb.HibernatePersistence</provider>
  |     <jta-data-source>java:CMADS</jta-data-source>
  |     <properties>
  |       <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
  |       <property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect"/>
  |       <property name="jboss.entity.manager.factory.jndi.name" value="java:/CMADS"/>
  |       <property name="hibernate.hbm2ddl.auto" value="update"/>
  |     </properties>
  |   </persistence-unit>
  | </persistence>


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

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




More information about the jboss-user mailing list