[jboss-jira] [JBoss JIRA] Commented: (EJBTHREE-1252) @PersistenceContext injection from a different jar fails
deanhiller (JIRA)
jira-events at lists.jboss.org
Sat Mar 20 14:53:38 EDT 2010
[ https://jira.jboss.org/jira/browse/EJBTHREE-1252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12521013#action_12521013 ]
deanhiller commented on EJBTHREE-1252:
--------------------------------------
I am using 5.1 with two jars and can't seem to get this to work even with the work around :(. I tried
@PersistenceContext(unitName="DDHxcore3.jar#xcore3", type=PersistenceContextType.EXTENDED)
protected EntityManager mgr;
and I got
DEPLOYMENTS IN ERROR:
Deployment "vfszip:/home/jboss/jboss-5.1.0.GA-nonXA/server/all/deploy/ata-tpv-vxml.jar/" is in error due to the following reason(s): java.lang.IllegalArgumentException: Can't find a deployment unit named DDHxcore3.jar at AbstractVFSDeploymentContext at 1458888444{vfszip:/home/jboss/jboss-5.1.0.GA-nonXA/server/all/deploy/ata-tpv-vxml.jar/}
any ideas how to work around this? We have 5 apps on using our EJB3 jar(which is shared of course) and they all inject a stateless bean from our xcore3.jar and that bean has no trouble injecting the persistence unit(but that just feels like a hack, and we don't know how to do a stateful bean now when we want one). Any ideas?
> @PersistenceContext injection from a different jar fails
> --------------------------------------------------------
>
> Key: EJBTHREE-1252
> URL: https://jira.jboss.org/jira/browse/EJBTHREE-1252
> Project: EJB 3.0
> Issue Type: Bug
> Components: core
> Affects Versions: AS 4.2.2.GA
> Environment: JBoss-4.2.2GA, Windows 2003 Server, Sun Java 1.5
> Reporter: jaikiran pai
> Assignee: Andrew Lee Rubinger
> Attachments: Application EARs.zip, EJBTHREE-1252.zip, Logs.zip
>
>
> I have a sample application with an EJB3 SLSB which is being injected with a PersistenceContext which is configured in a different jar file as follows
> package org.myapp.ejb.impl;
> import javax.ejb.Remote;
> import javax.ejb.Stateless;
> import javax.persistence.EntityManager;
> import javax.persistence.PersistenceContext;
> import org.jboss.annotation.ejb.RemoteBinding;
> import org.myapp.ejb.AppManager;
> @Stateless
> @Remote ({AppManager.class})
> @RemoteBinding (jndiBinding = "AppManagerBean")
> public class AppManagerBean implements AppManager {
> @PersistenceContext (unitName="myapp_ejb3.jar#EJB3Persistence")
> private EntityManager em;
>
> public String getVersion() {
> System.out.println("EM is " + em);
> return "1.0";
> }
>
>
> }
> The application is deployed as an EAR file in the following structure:
> EJB3Persistence.ear
> |
> |--- META-INF
> | |
> | |--- META-INF
> | | |
> | | |--- application.xml
> | | |
> | | |--- jboss-app.xml
> |
> |
> |--- myapp_ejb3.jar (contains the persistence.xml)
> | |
> | |--- META-INF
> | | |
> | | |--- persistence.xml
> |
> |
> |
> |--- another_ejb3.jar (contains the SLSB)
> | |
> | |
> | |--- META-INF
> | |
> | |--- org.myapp.ejb.impl.AppManagerBean
>
>
> When this application is deployed in 4.2.2 the deployment fails with an exception. Part of the exception is pasted below. The relevant log files (ConsoleLog_Fail.txt and serverLog_fail.txt in the logs.zip file) are attached.
> 22:45:41,137 INFO [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.stateless.StatelessContainer
> 22:45:41,152 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=EJB3Persistence.ear,jar=another_ejb3.jar,name=AppManagerBean,service=EJB3 with dependencies:
> 22:45:41,152 INFO [JmxKernelAbstraction] persistence.units:jar=pp_ejb3.jar,unitName=EJB3Persistence
> 22:45:41,152 INFO [EJB3Deployer] Deployed: file:/D:/JBoss-4.2.2/jboss-4.2.2.GA/server/default/tmp/deploy/tmp53619EJB3Persistence.ear-contents/another_ejb3.jar
> 22:45:41,168 INFO [EARDeployer] Started J2EE application: file:/D:/JBoss-4.2.2/jboss-4.2.2.GA/server/default/deploy/EJB3Persistence.ear
> 22:45:41,184 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
> --- MBeans waiting for other MBeans ---
> ObjectName: jboss.j2ee:ear=EJB3Persistence.ear,jar=another_ejb3.jar,name=AppManagerBean,service=EJB3
> State: NOTYETINSTALLED
> I Depend On:
> persistence.units:jar=pp_ejb3.jar,unitName=EJB3Persistence
> --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
> ObjectName: persistence.units:jar=pp_ejb3.jar,unitName=EJB3Persistence
> State: NOTYETINSTALLED
> Depends On Me:
> jboss.j2ee:ear=EJB3Persistence.ear,jar=another_ejb3.jar,name=AppManagerBean,service=EJB3
> If i change the PersistenceContext injection, in the bean, to prefix 3 random letters to the unitName as follows:
> @PersistenceContext (unitName="XXXmyapp_ejb3.jar#EJB3Persistence")
> private EntityManager em;
> and deploy the application, then everything works fine (have also attached the successful logs ConsoleLogs_Success.txt and serverLogs_Success.txt in the logs.zip file).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list