[jboss-user] [EJB 3.0] - Re: Why is injection not working in AS 4.0 and 4.2 (servlets

rbellia do-not-reply at jboss.com
Thu Aug 23 05:36:28 EDT 2007


I´m trying to do JPA Injection in a WAR module with JBoss 5 beta2.

I´m configuring the persistence.xml according to
http://docs.jboss.org/ejb3/app-server/reference/build/reference/en/html/entityconfig.html

Here is my persistence.xml:
<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="TesteJPA" transaction-type="JTA">
  |     <jta-data-source>java:jdbc/testeJPA</jta-data-source>
  |     <properties>
  |         <property name="jboss.entity.manager.jndi.name" value="java:jpa/TesteJPA"/>
  |         <property name="jboss.entity.manager.factory.jndi.name" value="java:jpa/TesteJPAFactory"/>
  |     </properties>
  |   </persistence-unit>
  | </persistence>

In JBoss 5 beta 2 the persistence unit is only considered automatically when persistence.xml is placed in WEB-INF folder. It differs froms JPA spec chapter 6.2, where says it should be in WEB-INF/classes/META-INF.

Everything stars fine with Hibernate EntityManager, until the following error shows up:

06:13:23,625 INFO  [SessionFactoryObjectFactory] Factory name: persistence.units:unitName=TesteJPA
06:13:23,765 INFO  [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingC
ontextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
06:13:24,906 INFO  [SessionFactoryObjectFactory] Bound factory to JNDI name: persistence.units:unitName=TesteJPA
06:13:25,000 WARN  [SessionFactoryObjectFactory] InitialContext did not implement EventContext
06:13:25,000 INFO  [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingC
ontextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
06:13:37,625 INFO  [TomcatDeployment] deploy, ctxPath=/TesteWebApplicationJPAJBoss, vfsUrl=JBossWebApplicationJPA.war
06:13:37,875 ERROR [BaseModelMBean] Exception invoking method addChild
java.lang.RuntimeException: persistence.units:unitName=java:jpa/TesteJPAFactory
        at org.jboss.ejb3.JmxDependencyPolicy.addDependency(JmxDependencyPolicy.java:48)
        at org.jboss.injection.PersistenceUnitHandler.addPUDependency(PersistenceUnitHandler.java:131)
        at org.jboss.injection.PersistenceUnitHandler.handleFieldAnnotations(PersistenceUnitHandler.java:243)
...
Caused by: javax.management.MalformedObjectNameException: Invalid character ':' in value part of property
        at javax.management.ObjectName.construct(ObjectName.java:529)
        at javax.management.ObjectName.(ObjectName.java:1304)
        at org.jboss.ejb3.JmxDependencyPolicy.addDependency(JmxDependencyPolicy.java:44)
        ... 78 more
06:13:37,953 ERROR [AbstractKernelController] Error installing to Start: name=jboss.web.deployment:war=/TesteWebApplicat
ionJPAJBoss state=Create mode=Manual requiredState=Installed
LifecycleException:  Pipeline has not been started
        at org.apache.catalina.core.StandardPipeline.stop(StandardPipeline.java:257)
        at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4541)
        at org.apache.catalina.core.ContainerBase.destroy(ContainerBase.java:1134)
        at org.apache.catalina.core.StandardContext.destroy(StandardContext.java:4617)
        at org.apache.catalina.core.StandardContext.init(StandardContext.java:5315)
...

Am I missing something or JBoss 5 beta2 stills not suporting JPA Injection ?


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

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




More information about the jboss-user mailing list