[JBoss JIRA] Created: (EJBTHREE-1252) @PersistenceContext injection from a different jar fails
by jaikiran pai (JIRA)
@PersistenceContext injection from a different jar fails
--------------------------------------------------------
Key: EJBTHREE-1252
URL: http://jira.jboss.com/jira/browse/EJBTHREE-1252
Project: EJB 3.0
Issue Type: Bug
Components: injection
Affects Versions: AS 4.2.2.GA
Environment: JBoss-4.2.2GA, Windows 2003 Server, Sun Java 1.5
Reporter: jaikiran pai
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: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 4 months
[JBoss JIRA] Created: (JBAS-5332) Container artifacts should have symmetric lifecycles
by Adrian Brock (JIRA)
Container artifacts should have symmetric lifecycles
----------------------------------------------------
Key: JBAS-5332
URL: http://jira.jboss.com/jira/browse/JBAS-5332
Project: JBoss Application Server
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: EJB2
Affects Versions: JBossAS-5.0.0.Beta4, JBossAS-4.2.2.GA
Reporter: Adrian Brock
Fix For: JBossAS-5.0.0.CR1, JBossAS-4.2.3.GA
The container artifacts i.e. [Session|Entity|MessageDriven]Container, interceptors, cache, pool, ProxyBindings
should have symmetric create/start/stop/destroy methods.
e.g. The MessageDrivenContainer does this in destroy
// Destroy container invoker
for (Iterator it = proxyFactories.keySet().iterator(); it.hasNext();)
{
String invokerBinding = (String) it.next();
EJBProxyFactory ci = (EJBProxyFactory) proxyFactories.get(invokerBinding);
ci.destroy();
ci.setContainer(null);
try
{
ObjectName containerName = super.getJmxName();
Hashtable props = containerName.getKeyPropertyList();
props.put("plugin", "invoker");
props.put("binding", invokerBinding);
ObjectName invokerName = new ObjectName(containerName.getDomain(), props);
server.unregisterMBean(invokerName);
}
catch(Throwable ignore)
{
}
}
The setContainer(null) is wrong since it isn't the one that sets the container in create()
that is done by EjbModule in its createService() method
In this case, the fix is to either move the setting of container to MessageDrivenContainer::createService()
or move the nulling of the container to EjbModule::destroyService()
Other artifacts also need checking and fixing with tests writing to validate that each container can
go through a stop/destroy/create/start lifecycle and still function correctly.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 4 months
[JBoss JIRA] Created: (JBAS-3770) JBoss/JCA JDBC implementation should allow for Transaction isolation level to be reset on underlying JDBC connection prior to return to pool
by Weston Price (JIRA)
JBoss/JCA JDBC implementation should allow for Transaction isolation level to be reset on underlying JDBC connection prior to return to pool
--------------------------------------------------------------------------------------------------------------------------------------------
Key: JBAS-3770
URL: http://jira.jboss.com/jira/browse/JBAS-3770
Project: JBoss Application Server
Issue Type: Feature Request
Security Level: Public (Everyone can see)
Reporter: Weston Price
Assigned To: Weston Price
Priority: Minor
By default, when we return a JDBC connection to the pool we execute the following in the ManagedConnection.cleanup() method:
if (jdbcTransactionIsolation != transactionIsolation)
{
try
{
con.setTransactionIsolation(jdbcTransactionIsolation);
jdbcTransactionIsolation = transactionIsolation;
}
catch (SQLException e)
{
mcf.log.warn("Error resetting transaction isolation ", e);
}
}
In this scenario we don't return the original isolation level on the underlying connection. The spec doesn't prohibit this, and I can't see any reason why we shouldn't do this, or provide a configurable option.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 4 months