[JBoss JIRA] (WFLY-2319) LDAP Search containing URL - InvalidNameException: ldap:: [LDAP: error code 34 - Invalid root Dn given
by RH Bugzilla Integration (JIRA)
[ https://issues.jboss.org/browse/WFLY-2319?page=com.atlassian.jira.plugin.... ]
RH Bugzilla Integration commented on WFLY-2319:
-----------------------------------------------
Kabir Khan <kkhan(a)redhat.com> changed the Status of [bug 1014911|https://bugzilla.redhat.com/show_bug.cgi?id=1014911] from POST to MODIFIED
> LDAP Search containing URL - InvalidNameException: ldap:: [LDAP: error code 34 - Invalid root Dn given
> ------------------------------------------------------------------------------------------------------
>
> Key: WFLY-2319
> URL: https://issues.jboss.org/browse/WFLY-2319
> Project: WildFly
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: Naming
> Affects Versions: 8.0.0.Beta1
> Reporter: Darran Lofthouse
> Assignee: Eduardo Martins
> Fix For: 8.0.0.CR1
>
> Attachments: LdapSearching.tgz
>
>
> The following code: -
> {code}
> Hashtable env = new Hashtable();
> env.put("java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory");
> env.put("java.naming.security.authentication", "simple");
> env.put("java.naming.provider.url", "ldap://localhost:10389");
> env.put(InitialDirContext.SECURITY_PRINCIPAL, "uid=admin,ou=system");
> env.put(InitialDirContext.SECURITY_CREDENTIALS, "secret");
> SearchControls ctl = null;
> String attrArr[] = new String[1];
> attrArr[0] = "sn";
> ctl = new SearchControls(2, 0L, 0, attrArr, false, false);
> String base = "ldap://localhost:10389/dc=simple,dc=wildfly,dc=org";
> String filter = "(uid=UserOne)";
> NamingEnumeration nenum = null;
> DirContext ictx = null;
> ictx = new InitialDirContext(env);
> nenum = ictx.search(base, filter, ctl);
> {code}
> Results in the following exception: -
> {noquote}
> 13:03:45,598 ERROR [stderr] (default task-1) javax.naming.InvalidNameException: ldap:: [LDAP: error code 34 - Invalid root Dn given : ldap: (0x6C 0x64 0x61 0x70 0x3A ) is invalid]; remaining name 'ldap://localhost:10389/dc=simple,dc=wildfly,dc=org'
> 13:03:45,599 ERROR [stderr] (default task-1) at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:3025)
> 13:03:45,600 ERROR [stderr] (default task-1) at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2840)
> 13:03:45,600 ERROR [stderr] (default task-1) at com.sun.jndi.ldap.LdapCtx.c_lookup(LdapCtx.java:1034)
> {noquote}
> Switching to a base that does not begin with a URL and the search works, executing this code outside of WildFly also works.
> The underlying issue is that the default InitialContext implementation contains the following method: -
> {code}
> protected Context getURLOrDefaultInitCtx(String name)
> throws NamingException {
> if (NamingManager.hasInitialContextFactoryBuilder()) {
> return getDefaultInitCtx();
> }
> String scheme = getURLScheme(name);
> if (scheme != null) {
> Context ctx = NamingManager.getURLContext(scheme, myProps);
> if (ctx != null) {
> return ctx;
> }
> }
> return getDefaultInitCtx();
> }
> {code}
> As the naming subsystem has registered a InitialContextFactoryBuilder this code will never fall down to the scheme specific section.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 6 months
[JBoss JIRA] (WFLY-2504) add lazy xpc inheritance to handle legacy case, remote client with UserTransaction fails on 2nd SFSB invocation when using extended persistence context
by Sande Gilda (JIRA)
[ https://issues.jboss.org/browse/WFLY-2504?page=com.atlassian.jira.plugin.... ]
Sande Gilda commented on WFLY-2504:
-----------------------------------
Created a documentation bug for the Migration Guide for this issue: https://bugzilla.redhat.com/show_bug.cgi?id=1049610
> add lazy xpc inheritance to handle legacy case, remote client with UserTransaction fails on 2nd SFSB invocation when using extended persistence context
> -------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: WFLY-2504
> URL: https://issues.jboss.org/browse/WFLY-2504
> Project: WildFly
> Issue Type: Enhancement
> Security Level: Public(Everyone can see)
> Components: JPA / Hibernate
> Reporter: Scott Marlow
> Assignee: Scott Marlow
> Fix For: 9.0.0.CR1
>
>
> AS5 allowed a remote client to instantiate a set of stateful session beans (e.g. SFSB1 + SFSB2) and then call the remote stateful session beans (SFSB1+SFSB2) in a started user transaction (UT1). Each of the stateful beans reference the same extended persistence context by name. In AS5, both stateful beans will share the same extended persistence unit context but on AS7/WF8, each bean has its own extended persistence unit context. Having both XPCS involved in the same user transaction, causes an (EJBException: JBAS011437: Found extended persistence context in SFSB invocation call stack but that cannot be used because the transaction already has a transactional context associated with it...) error to be thrown.
> On AS7/WF8, Allow the separate (remote) stateful beans to share the same persistence context.
> One approach might be to defer creation of the extended persistence context until the first invocation (need to verify that this is the right approach).
> Currently, we support shallow + deep extended persistence context inheritance. This will be a "lazy" variation of the deep XPC inheritance.
> Some of the AS5 code is pasted below for easy reference.
> {code}
> public class ExtendedPersistenceContextPropagationInterceptor implements Interceptor
> {
> private static final Logger log = Logger.getLogger(ExtendedPersistenceContextPropagationInterceptor.class);
> public String getName()
> {
> return this.getClass().getName();
> }
> public Object invoke(Invocation invocation) throws Throwable
> {
> log.debug("++++ LongLivedSessionPropagationInterceptor");
> StatefulContainerInvocation ejb = (StatefulContainerInvocation) invocation;
> StatefulBeanContext ctx = (StatefulBeanContext) ejb.getBeanContext();
> Map<String, EntityManager> extendedPCs = ctx.getExtendedPersistenceContexts();
> if (extendedPCs == null || extendedPCs.size() == 0)
> {
> return invocation.invokeNext();
> }
> TransactionManager tm = TxUtil.getTransactionManager();
> if (tm.getTransaction() != null)
> {
> for (String kernelname : extendedPCs.keySet())
> {
> EntityManager manager = extendedPCs.get(kernelname);
> ManagedEntityManagerFactory factory = ManagedEntityManagerFactoryHelper.getManagedEntityManagerFactory(kernelname);
> factory.registerExtendedWithTransaction(manager);
> }
> }
> return invocation.invokeNext();
> }
> }
> {code}
> {code}
> public class EJB3XPCResolver implements XPCResolver
> {
> private static final Logger log = Logger.getLogger(EJB3XPCResolver.class);
> /**
> * Query the current stateful bean contexts for the specified XPC.
> */
> public EntityManager getExtendedPersistenceContext(String kernelName)
> {
> StatefulBeanContext beanContext = StatefulBeanContext.currentBean.get();
> if (beanContext != null)
> {
> EntityManager em = null;
> em = beanContext.getExtendedPersistenceContext(kernelName);
> if (em != null) {
> log.info("current SFSB has XPC with scoped pu name=" + kernelName + " on SFSB bean=" + beanContext.getContainer().getIdentifier() + beanContext.getId());
> return em;
> }
> /**
> * Look for XPC in current bean set.
> */
> log.info("looking for existing XPC with scoped pu name=" + kernelName);
> List <StatefulBeanContext> beanContexts = StatefulBeanContext.currentBean.getList();
> for( StatefulBeanContext bc : beanContexts)
> {
> em = bc.getExtendedPersistenceContext(kernelName);
> if (em != null) {
> log.info("found existing XPC with scoped pu name=" + kernelName + " on SFSB bean=" + bc.getContainer().getIdentifier() + bc.getId());
> // Propagate created XPC as required (7.6.2.1 Inheritance of Extended Persistence Context
> beanContext.addExtendedPersistenceContext(kernelName, em);
> return em;
> }
> log.info("XPC not found yet, scoped pu name=" + kernelName + " not in SFSB bean=" + bc.getContainer().getIdentifier() + bc.getId());
> }
> }
> log.info("XPC not found scoped, search done, pu name=" + kernelName);
> return null;
> }
> @Override
> public EntityManager createExtendedPersistenceContext(String kernelName)
> {
> StatefulBeanContext beanContext = StatefulBeanContext.currentBean.get();
> if (beanContext != null)
> {
> EntityManager em = null;
> ManagedEntityManagerFactory factory=
> ((PersistenceUnitDeployment) PersistenceUnitRegistry.getPersistenceUnit(kernelName)).getManagedFactory();
> if (factory != null)
> {
> em = factory.createEntityManager();
> if (em != null)
> {
> beanContext.addExtendedPersistenceContext(factory.getKernelName(), em);
> log.info("created new XPC with scoped pu name=" + kernelName + " on SFSB bean=" + beanContext.getContainer().getIdentifier() + beanContext.getId());
> /**
> * TODO: Propagate created XPC as required (7.6.2.1 Inheritance of Extended Persistence Context
> *
> */
> // List <StatefulBeanContext> beanContexts = StatefulBeanContext.currentBean.getList();
> // for( StatefulBeanContext bc : beanContexts)
> // {
> // bc.addExtendedPersistenceContext(kernelName, em);
> // }
> }
> }
> return em;
> }
> return null;
> }
> }
> {code}
> {code}
> public class ManagedEntityManagerFactoryHelper
> {
> public static ManagedEntityManagerFactory getManagedEntityManagerFactory(String kernelName)
> {
> PersistenceUnitDeployment pu = (PersistenceUnitDeployment) PersistenceUnitRegistry.getPersistenceUnit(kernelName);
> if(pu != null)
> return pu.getManagedFactory();
> return null;
> }
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 6 months
[JBoss JIRA] (WFLY-2720) Per-deployment descriptor replacement
by Joshua Henn (JIRA)
Joshua Henn created WFLY-2720:
---------------------------------
Summary: Per-deployment descriptor replacement
Key: WFLY-2720
URL: https://issues.jboss.org/browse/WFLY-2720
Project: WildFly
Issue Type: Feature Request
Security Level: Public (Everyone can see)
Reporter: Joshua Henn
Currently descriptor replacement (ie. in persistence.xml) is possible via system properties. Unfortunately since system properties are global it is not possible to have per-deployment descriptor replacement.
Usecase:
Have two deployments active of the same application, run-time configured by descriptor replacements.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 6 months
[JBoss JIRA] (WFLY-2690) JSP/JSPX tags don't work with Wildfly CR1
by Matus Zamborsky (JIRA)
[ https://issues.jboss.org/browse/WFLY-2690?page=com.atlassian.jira.plugin.... ]
Matus Zamborsky commented on WFLY-2690:
---------------------------------------
In that case, I don't see a way how to make the ID deterministic, because the class is loaded by class loader dynamically created during JSP loading. Only deterministic and distinct information is the jsp name, but I have no idea how it will be possible to pass this information down to weld and still don't make weld dependent on this specific class loader.
Does anybody know, how this problem was solved in AS 7 ?
> JSP/JSPX tags don't work with Wildfly CR1
> -----------------------------------------
>
> Key: WFLY-2690
> URL: https://issues.jboss.org/browse/WFLY-2690
> Project: WildFly
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: Web (Undertow)
> Affects Versions: 8.0.0.CR1
> Environment: OpenJDK Runtime Environment (fedora-2.4.3.0.fc18-x86_64 u45-b15)
> OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)
> Reporter: Otávio Garcia
> Assignee: Jozef Hartinger
>
> My app works fine on JBoss AS 7.1. When I migrate to Wildfly 8.0.0 CR1, my JSP tags don't work as expected. My project is a EAR with WAR module.
> When app starts, in the 1st access to page A, tag file is compiled and the page are rendered fine. But when I access another page (B in example), I got this error: org.apache.jasper.JasperException: java.lang.ClassCastException: org.apache.jsp.tag.web.default_tagx cannot be cast to org.apache.jsp.tag.web.default_tagx
> If I restart Wildfly and try to access page B, works fine. But when I access page A, I got the same error.
> My default.tagx is bellow:
> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:html="http://www.w3.org/1999/xhtml" version="2.2">
> <jsp:output doctype-root-element="HTML" doctype-system="about:legacy-compat" omit-xml-declaration="yes" />
> some code
> <jsp:doBody />
> more code
> </jsp:root>
> And the pages are somethink like this:
> <tags:default xmlns:tags="urn:jsptagdir:/WEB-INF/tags" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:html="http://www.w3.org/1999/xhtml">
> <jsp:output omit-xml-declaration="yes" />
> my code here
> </tags:default>
> I was created a new empty project with two pages and one tagfile. The error don't occurs. But when I add CDI capabilities, the error occurs. There are something in CDI that confuses Jastow?
> As discussed here: https://community.jboss.org/message/850730
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 6 months
[JBoss JIRA] (WFLY-2719) NullPointerException on first request after deployment using beans.xml
by Stuart Douglas (JIRA)
[ https://issues.jboss.org/browse/WFLY-2719?page=com.atlassian.jira.plugin.... ]
Stuart Douglas commented on WFLY-2719:
--------------------------------------
This is already fixed in Undertow upstream, should be upstream soon. You can just disable session persistence as a workaround.
> NullPointerException on first request after deployment using beans.xml
> ----------------------------------------------------------------------
>
> Key: WFLY-2719
> URL: https://issues.jboss.org/browse/WFLY-2719
> Project: WildFly
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: CDI / Weld, Web (Undertow)
> Affects Versions: 8.0.0.CR1
> Reporter: James Bodkin
> Assignee: Stuart Douglas
> Priority: Minor
> Attachments: dew.zip
>
>
> A NullPointerException occurs on the first request to the WildFly AS if the war package already exists and has been deployed via maven on both occasions causing an 500 Internal Server Error on the client.
> Removing the beans.xml from WEB-INF stops the error from occurring but services aren't injected.
> 02:36:11,177 ERROR [io.undertow.request] (default I/O-3) Blocking request failed HttpServerExchange{ GET /}: java.lang.NullPointerException
> at org.jboss.weld.context.http.HttpConversationContextImpl.getRequestAttribute(HttpConversationContextImpl.java:47)
> at org.jboss.weld.context.http.HttpConversationContextImpl.getRequestAttribute(HttpConversationContextImpl.java:13)
> at org.jboss.weld.context.AbstractConversationContext.copyConversationIdGeneratorAndConversationsToSession(AbstractConversationContext.java:177)
> at org.jboss.weld.context.AbstractConversationContext.sessionCreated(AbstractConversationContext.java:185)
> at org.jboss.weld.servlet.ConversationContextActivator.sessionCreated(ConversationContextActivator.java:187)
> at org.jboss.weld.servlet.HttpContextLifecycle.sessionCreated(HttpContextLifecycle.java:122)
> at org.jboss.weld.servlet.WeldInitialListener.sessionCreated(WeldInitialListener.java:107)
> at io.undertow.servlet.core.ApplicationListeners.sessionCreated(ApplicationListeners.java:256)
> at io.undertow.servlet.core.SessionListenerBridge.sessionCreated(SessionListenerBridge.java:36)
> at io.undertow.server.session.SessionListeners.sessionCreated(SessionListeners.java:32)
> at io.undertow.server.session.InMemorySessionManager.createSession(InMemorySessionManager.java:121)
> at io.undertow.servlet.spec.ServletContextImpl.getSession(ServletContextImpl.java:677)
> at io.undertow.servlet.spec.ServletContextImpl.getSession(ServletContextImpl.java:691)
> at io.undertow.servlet.handlers.SessionRestoringHandler.handleRequest(SessionRestoringHandler.java:110)
> at io.undertow.server.handlers.PathHandler.handleRequest(PathHandler.java:56)
> at io.undertow.server.handlers.NameVirtualHostHandler.handleRequest(NameVirtualHostHandler.java:57)
> at io.undertow.server.handlers.error.SimpleErrorPageHandler.handleRequest(SimpleErrorPageHandler.java:76)
> at io.undertow.server.handlers.CanonicalPathHandler.handleRequest(CanonicalPathHandler.java:43)
> at io.undertow.server.handlers.ChannelUpgradeHandler.handleRequest(ChannelUpgradeHandler.java:158)
> at io.undertow.server.Connectors.executeRootHandler(Connectors.java:164)
> at io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:142)
> at io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:46)
> at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) [xnio-api-3.2.0.Beta4.jar:3.2.0.Beta4]
> at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) [xnio-api-3.2.0.Beta4.jar:3.2.0.Beta4]
> at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:87) [xnio-nio-3.2.0.Beta4.jar:3.2.0.Beta4]
> at org.xnio.nio.WorkerThread.run(WorkerThread.java:531) [xnio-nio-3.2.0.Beta4.jar:3.2.0.Beta4]
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 6 months
[JBoss JIRA] (WFLY-2504) add lazy xpc inheritance to handle legacy case, remote client with UserTransaction fails on 2nd SFSB invocation when using extended persistence context
by Scott Marlow (JIRA)
[ https://issues.jboss.org/browse/WFLY-2504?page=com.atlassian.jira.plugin.... ]
Scott Marlow updated WFLY-2504:
-------------------------------
Description:
AS5 allowed a remote client to instantiate a set of stateful session beans (e.g. SFSB1 + SFSB2) and then call the remote stateful session beans (SFSB1+SFSB2) in a started user transaction (UT1). Each of the stateful beans reference the same extended persistence context by name. In AS5, both stateful beans will share the same extended persistence unit context but on AS7/WF8, each bean has its own extended persistence unit context. Having both XPCS involved in the same user transaction, causes an (EJBException: JBAS011437: Found extended persistence context in SFSB invocation call stack but that cannot be used because the transaction already has a transactional context associated with it...) error to be thrown.
On AS7/WF8, Allow the separate (remote) stateful beans to share the same persistence context.
One approach might be to defer creation of the extended persistence context until the first invocation (need to verify that this is the right approach).
Currently, we support shallow + deep extended persistence context inheritance. This will be a "lazy" variation of the deep XPC inheritance.
Some of the AS5 code is pasted below for easy reference.
{code}
public class ExtendedPersistenceContextPropagationInterceptor implements Interceptor
{
private static final Logger log = Logger.getLogger(ExtendedPersistenceContextPropagationInterceptor.class);
public String getName()
{
return this.getClass().getName();
}
public Object invoke(Invocation invocation) throws Throwable
{
log.debug("++++ LongLivedSessionPropagationInterceptor");
StatefulContainerInvocation ejb = (StatefulContainerInvocation) invocation;
StatefulBeanContext ctx = (StatefulBeanContext) ejb.getBeanContext();
Map<String, EntityManager> extendedPCs = ctx.getExtendedPersistenceContexts();
if (extendedPCs == null || extendedPCs.size() == 0)
{
return invocation.invokeNext();
}
TransactionManager tm = TxUtil.getTransactionManager();
if (tm.getTransaction() != null)
{
for (String kernelname : extendedPCs.keySet())
{
EntityManager manager = extendedPCs.get(kernelname);
ManagedEntityManagerFactory factory = ManagedEntityManagerFactoryHelper.getManagedEntityManagerFactory(kernelname);
factory.registerExtendedWithTransaction(manager);
}
}
return invocation.invokeNext();
}
}
{code}
{code}
public class EJB3XPCResolver implements XPCResolver
{
private static final Logger log = Logger.getLogger(EJB3XPCResolver.class);
/**
* Query the current stateful bean contexts for the specified XPC.
*/
public EntityManager getExtendedPersistenceContext(String kernelName)
{
StatefulBeanContext beanContext = StatefulBeanContext.currentBean.get();
if (beanContext != null)
{
EntityManager em = null;
em = beanContext.getExtendedPersistenceContext(kernelName);
if (em != null) {
log.info("current SFSB has XPC with scoped pu name=" + kernelName + " on SFSB bean=" + beanContext.getContainer().getIdentifier() + beanContext.getId());
return em;
}
/**
* Look for XPC in current bean set.
*/
log.info("looking for existing XPC with scoped pu name=" + kernelName);
List <StatefulBeanContext> beanContexts = StatefulBeanContext.currentBean.getList();
for( StatefulBeanContext bc : beanContexts)
{
em = bc.getExtendedPersistenceContext(kernelName);
if (em != null) {
log.info("found existing XPC with scoped pu name=" + kernelName + " on SFSB bean=" + bc.getContainer().getIdentifier() + bc.getId());
// Propagate created XPC as required (7.6.2.1 Inheritance of Extended Persistence Context
beanContext.addExtendedPersistenceContext(kernelName, em);
return em;
}
log.info("XPC not found yet, scoped pu name=" + kernelName + " not in SFSB bean=" + bc.getContainer().getIdentifier() + bc.getId());
}
}
log.info("XPC not found scoped, search done, pu name=" + kernelName);
return null;
}
@Override
public EntityManager createExtendedPersistenceContext(String kernelName)
{
StatefulBeanContext beanContext = StatefulBeanContext.currentBean.get();
if (beanContext != null)
{
EntityManager em = null;
ManagedEntityManagerFactory factory=
((PersistenceUnitDeployment) PersistenceUnitRegistry.getPersistenceUnit(kernelName)).getManagedFactory();
if (factory != null)
{
em = factory.createEntityManager();
if (em != null)
{
beanContext.addExtendedPersistenceContext(factory.getKernelName(), em);
log.info("created new XPC with scoped pu name=" + kernelName + " on SFSB bean=" + beanContext.getContainer().getIdentifier() + beanContext.getId());
/**
* TODO: Propagate created XPC as required (7.6.2.1 Inheritance of Extended Persistence Context
*
*/
// List <StatefulBeanContext> beanContexts = StatefulBeanContext.currentBean.getList();
// for( StatefulBeanContext bc : beanContexts)
// {
// bc.addExtendedPersistenceContext(kernelName, em);
// }
}
}
return em;
}
return null;
}
}
{code}
{code}
public class ManagedEntityManagerFactoryHelper
{
public static ManagedEntityManagerFactory getManagedEntityManagerFactory(String kernelName)
{
PersistenceUnitDeployment pu = (PersistenceUnitDeployment) PersistenceUnitRegistry.getPersistenceUnit(kernelName);
if(pu != null)
return pu.getManagedFactory();
return null;
}
}
{code}
was:
AS5 allowed a remote client to instantiate a set of stateful session beans (e.g. SFSB1 + SFSB2) and then call the remote stateful session beans (SFSB1+SFSB2) in a started user transaction (UT1). Each of the stateful beans reference the same extended persistence context by name. In AS5, both stateful beans will share the same extended persistence unit context but on AS7/WF8, each bean has its own extended persistence unit context. Having both XPCS involved in the same user transaction, causes an (EJBException: JBAS011437: Found extended persistence context in SFSB invocation call stack but that cannot be used because the transaction already has a transactional context associated with it...) error to be thrown.
On AS7/WF8, Allow the beans invoked in the same transaction, to share the same persistence context.
One approach might be to defer creation of the extended persistence context until the first invocation (need to verify that this is the right approach).
Currently, we support shallow + deep extended persistence context inheritance. This will be a "lazy" variation of the deep XPC inheritance.
Some of the AS5 code is pasted below for easy reference.
{code}
public class ExtendedPersistenceContextPropagationInterceptor implements Interceptor
{
private static final Logger log = Logger.getLogger(ExtendedPersistenceContextPropagationInterceptor.class);
public String getName()
{
return this.getClass().getName();
}
public Object invoke(Invocation invocation) throws Throwable
{
log.debug("++++ LongLivedSessionPropagationInterceptor");
StatefulContainerInvocation ejb = (StatefulContainerInvocation) invocation;
StatefulBeanContext ctx = (StatefulBeanContext) ejb.getBeanContext();
Map<String, EntityManager> extendedPCs = ctx.getExtendedPersistenceContexts();
if (extendedPCs == null || extendedPCs.size() == 0)
{
return invocation.invokeNext();
}
TransactionManager tm = TxUtil.getTransactionManager();
if (tm.getTransaction() != null)
{
for (String kernelname : extendedPCs.keySet())
{
EntityManager manager = extendedPCs.get(kernelname);
ManagedEntityManagerFactory factory = ManagedEntityManagerFactoryHelper.getManagedEntityManagerFactory(kernelname);
factory.registerExtendedWithTransaction(manager);
}
}
return invocation.invokeNext();
}
}
{code}
{code}
public class EJB3XPCResolver implements XPCResolver
{
private static final Logger log = Logger.getLogger(EJB3XPCResolver.class);
/**
* Query the current stateful bean contexts for the specified XPC.
*/
public EntityManager getExtendedPersistenceContext(String kernelName)
{
StatefulBeanContext beanContext = StatefulBeanContext.currentBean.get();
if (beanContext != null)
{
EntityManager em = null;
em = beanContext.getExtendedPersistenceContext(kernelName);
if (em != null) {
log.info("current SFSB has XPC with scoped pu name=" + kernelName + " on SFSB bean=" + beanContext.getContainer().getIdentifier() + beanContext.getId());
return em;
}
/**
* Look for XPC in current bean set.
*/
log.info("looking for existing XPC with scoped pu name=" + kernelName);
List <StatefulBeanContext> beanContexts = StatefulBeanContext.currentBean.getList();
for( StatefulBeanContext bc : beanContexts)
{
em = bc.getExtendedPersistenceContext(kernelName);
if (em != null) {
log.info("found existing XPC with scoped pu name=" + kernelName + " on SFSB bean=" + bc.getContainer().getIdentifier() + bc.getId());
// Propagate created XPC as required (7.6.2.1 Inheritance of Extended Persistence Context
beanContext.addExtendedPersistenceContext(kernelName, em);
return em;
}
log.info("XPC not found yet, scoped pu name=" + kernelName + " not in SFSB bean=" + bc.getContainer().getIdentifier() + bc.getId());
}
}
log.info("XPC not found scoped, search done, pu name=" + kernelName);
return null;
}
@Override
public EntityManager createExtendedPersistenceContext(String kernelName)
{
StatefulBeanContext beanContext = StatefulBeanContext.currentBean.get();
if (beanContext != null)
{
EntityManager em = null;
ManagedEntityManagerFactory factory=
((PersistenceUnitDeployment) PersistenceUnitRegistry.getPersistenceUnit(kernelName)).getManagedFactory();
if (factory != null)
{
em = factory.createEntityManager();
if (em != null)
{
beanContext.addExtendedPersistenceContext(factory.getKernelName(), em);
log.info("created new XPC with scoped pu name=" + kernelName + " on SFSB bean=" + beanContext.getContainer().getIdentifier() + beanContext.getId());
/**
* TODO: Propagate created XPC as required (7.6.2.1 Inheritance of Extended Persistence Context
*
*/
// List <StatefulBeanContext> beanContexts = StatefulBeanContext.currentBean.getList();
// for( StatefulBeanContext bc : beanContexts)
// {
// bc.addExtendedPersistenceContext(kernelName, em);
// }
}
}
return em;
}
return null;
}
}
{code}
{code}
public class ManagedEntityManagerFactoryHelper
{
public static ManagedEntityManagerFactory getManagedEntityManagerFactory(String kernelName)
{
PersistenceUnitDeployment pu = (PersistenceUnitDeployment) PersistenceUnitRegistry.getPersistenceUnit(kernelName);
if(pu != null)
return pu.getManagedFactory();
return null;
}
}
{code}
> add lazy xpc inheritance to handle legacy case, remote client with UserTransaction fails on 2nd SFSB invocation when using extended persistence context
> -------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: WFLY-2504
> URL: https://issues.jboss.org/browse/WFLY-2504
> Project: WildFly
> Issue Type: Enhancement
> Security Level: Public(Everyone can see)
> Components: JPA / Hibernate
> Reporter: Scott Marlow
> Assignee: Scott Marlow
> Fix For: 9.0.0.CR1
>
>
> AS5 allowed a remote client to instantiate a set of stateful session beans (e.g. SFSB1 + SFSB2) and then call the remote stateful session beans (SFSB1+SFSB2) in a started user transaction (UT1). Each of the stateful beans reference the same extended persistence context by name. In AS5, both stateful beans will share the same extended persistence unit context but on AS7/WF8, each bean has its own extended persistence unit context. Having both XPCS involved in the same user transaction, causes an (EJBException: JBAS011437: Found extended persistence context in SFSB invocation call stack but that cannot be used because the transaction already has a transactional context associated with it...) error to be thrown.
> On AS7/WF8, Allow the separate (remote) stateful beans to share the same persistence context.
> One approach might be to defer creation of the extended persistence context until the first invocation (need to verify that this is the right approach).
> Currently, we support shallow + deep extended persistence context inheritance. This will be a "lazy" variation of the deep XPC inheritance.
> Some of the AS5 code is pasted below for easy reference.
> {code}
> public class ExtendedPersistenceContextPropagationInterceptor implements Interceptor
> {
> private static final Logger log = Logger.getLogger(ExtendedPersistenceContextPropagationInterceptor.class);
> public String getName()
> {
> return this.getClass().getName();
> }
> public Object invoke(Invocation invocation) throws Throwable
> {
> log.debug("++++ LongLivedSessionPropagationInterceptor");
> StatefulContainerInvocation ejb = (StatefulContainerInvocation) invocation;
> StatefulBeanContext ctx = (StatefulBeanContext) ejb.getBeanContext();
> Map<String, EntityManager> extendedPCs = ctx.getExtendedPersistenceContexts();
> if (extendedPCs == null || extendedPCs.size() == 0)
> {
> return invocation.invokeNext();
> }
> TransactionManager tm = TxUtil.getTransactionManager();
> if (tm.getTransaction() != null)
> {
> for (String kernelname : extendedPCs.keySet())
> {
> EntityManager manager = extendedPCs.get(kernelname);
> ManagedEntityManagerFactory factory = ManagedEntityManagerFactoryHelper.getManagedEntityManagerFactory(kernelname);
> factory.registerExtendedWithTransaction(manager);
> }
> }
> return invocation.invokeNext();
> }
> }
> {code}
> {code}
> public class EJB3XPCResolver implements XPCResolver
> {
> private static final Logger log = Logger.getLogger(EJB3XPCResolver.class);
> /**
> * Query the current stateful bean contexts for the specified XPC.
> */
> public EntityManager getExtendedPersistenceContext(String kernelName)
> {
> StatefulBeanContext beanContext = StatefulBeanContext.currentBean.get();
> if (beanContext != null)
> {
> EntityManager em = null;
> em = beanContext.getExtendedPersistenceContext(kernelName);
> if (em != null) {
> log.info("current SFSB has XPC with scoped pu name=" + kernelName + " on SFSB bean=" + beanContext.getContainer().getIdentifier() + beanContext.getId());
> return em;
> }
> /**
> * Look for XPC in current bean set.
> */
> log.info("looking for existing XPC with scoped pu name=" + kernelName);
> List <StatefulBeanContext> beanContexts = StatefulBeanContext.currentBean.getList();
> for( StatefulBeanContext bc : beanContexts)
> {
> em = bc.getExtendedPersistenceContext(kernelName);
> if (em != null) {
> log.info("found existing XPC with scoped pu name=" + kernelName + " on SFSB bean=" + bc.getContainer().getIdentifier() + bc.getId());
> // Propagate created XPC as required (7.6.2.1 Inheritance of Extended Persistence Context
> beanContext.addExtendedPersistenceContext(kernelName, em);
> return em;
> }
> log.info("XPC not found yet, scoped pu name=" + kernelName + " not in SFSB bean=" + bc.getContainer().getIdentifier() + bc.getId());
> }
> }
> log.info("XPC not found scoped, search done, pu name=" + kernelName);
> return null;
> }
> @Override
> public EntityManager createExtendedPersistenceContext(String kernelName)
> {
> StatefulBeanContext beanContext = StatefulBeanContext.currentBean.get();
> if (beanContext != null)
> {
> EntityManager em = null;
> ManagedEntityManagerFactory factory=
> ((PersistenceUnitDeployment) PersistenceUnitRegistry.getPersistenceUnit(kernelName)).getManagedFactory();
> if (factory != null)
> {
> em = factory.createEntityManager();
> if (em != null)
> {
> beanContext.addExtendedPersistenceContext(factory.getKernelName(), em);
> log.info("created new XPC with scoped pu name=" + kernelName + " on SFSB bean=" + beanContext.getContainer().getIdentifier() + beanContext.getId());
> /**
> * TODO: Propagate created XPC as required (7.6.2.1 Inheritance of Extended Persistence Context
> *
> */
> // List <StatefulBeanContext> beanContexts = StatefulBeanContext.currentBean.getList();
> // for( StatefulBeanContext bc : beanContexts)
> // {
> // bc.addExtendedPersistenceContext(kernelName, em);
> // }
> }
> }
> return em;
> }
> return null;
> }
> }
> {code}
> {code}
> public class ManagedEntityManagerFactoryHelper
> {
> public static ManagedEntityManagerFactory getManagedEntityManagerFactory(String kernelName)
> {
> PersistenceUnitDeployment pu = (PersistenceUnitDeployment) PersistenceUnitRegistry.getPersistenceUnit(kernelName);
> if(pu != null)
> return pu.getManagedFactory();
> return null;
> }
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 6 months
[JBoss JIRA] (WFLY-2504) add lazy xpc inheritance to handle legacy case, remote client with UserTransaction fails on 2nd SFSB invocation when using extended persistence context
by Scott Marlow (JIRA)
[ https://issues.jboss.org/browse/WFLY-2504?page=com.atlassian.jira.plugin.... ]
Scott Marlow updated WFLY-2504:
-------------------------------
Description:
AS5 allowed a remote client to instantiate a set of stateful session beans (e.g. SFSB1 + SFSB2) and then call the remote stateful session beans (SFSB1+SFSB2) in a started user transaction (UT1). Each of the stateful beans reference the same extended persistence context by name. In AS5, both stateful beans will share the same extended persistence unit context but on AS7/WF8, each bean has its own extended persistence unit context. Having both XPCS involved in the same user transaction, causes an (EJBException: JBAS011437: Found extended persistence context in SFSB invocation call stack but that cannot be used because the transaction already has a transactional context associated with it...) error to be thrown.
On AS7/WF8, Allow the beans invoked in the same transaction, to share the same persistence context.
One approach might be to defer creation of the extended persistence context until the first invocation (need to verify that this is the right approach).
Currently, we support shallow + deep extended persistence context inheritance. This will be a "lazy" variation of the deep XPC inheritance.
Some of the AS5 code is pasted below for easy reference.
{code}
public class ExtendedPersistenceContextPropagationInterceptor implements Interceptor
{
private static final Logger log = Logger.getLogger(ExtendedPersistenceContextPropagationInterceptor.class);
public String getName()
{
return this.getClass().getName();
}
public Object invoke(Invocation invocation) throws Throwable
{
log.debug("++++ LongLivedSessionPropagationInterceptor");
StatefulContainerInvocation ejb = (StatefulContainerInvocation) invocation;
StatefulBeanContext ctx = (StatefulBeanContext) ejb.getBeanContext();
Map<String, EntityManager> extendedPCs = ctx.getExtendedPersistenceContexts();
if (extendedPCs == null || extendedPCs.size() == 0)
{
return invocation.invokeNext();
}
TransactionManager tm = TxUtil.getTransactionManager();
if (tm.getTransaction() != null)
{
for (String kernelname : extendedPCs.keySet())
{
EntityManager manager = extendedPCs.get(kernelname);
ManagedEntityManagerFactory factory = ManagedEntityManagerFactoryHelper.getManagedEntityManagerFactory(kernelname);
factory.registerExtendedWithTransaction(manager);
}
}
return invocation.invokeNext();
}
}
{code}
{code}
public class EJB3XPCResolver implements XPCResolver
{
private static final Logger log = Logger.getLogger(EJB3XPCResolver.class);
/**
* Query the current stateful bean contexts for the specified XPC.
*/
public EntityManager getExtendedPersistenceContext(String kernelName)
{
StatefulBeanContext beanContext = StatefulBeanContext.currentBean.get();
if (beanContext != null)
{
EntityManager em = null;
em = beanContext.getExtendedPersistenceContext(kernelName);
if (em != null) {
log.info("current SFSB has XPC with scoped pu name=" + kernelName + " on SFSB bean=" + beanContext.getContainer().getIdentifier() + beanContext.getId());
return em;
}
/**
* Look for XPC in current bean set.
*/
log.info("looking for existing XPC with scoped pu name=" + kernelName);
List <StatefulBeanContext> beanContexts = StatefulBeanContext.currentBean.getList();
for( StatefulBeanContext bc : beanContexts)
{
em = bc.getExtendedPersistenceContext(kernelName);
if (em != null) {
log.info("found existing XPC with scoped pu name=" + kernelName + " on SFSB bean=" + bc.getContainer().getIdentifier() + bc.getId());
// Propagate created XPC as required (7.6.2.1 Inheritance of Extended Persistence Context
beanContext.addExtendedPersistenceContext(kernelName, em);
return em;
}
log.info("XPC not found yet, scoped pu name=" + kernelName + " not in SFSB bean=" + bc.getContainer().getIdentifier() + bc.getId());
}
}
log.info("XPC not found scoped, search done, pu name=" + kernelName);
return null;
}
@Override
public EntityManager createExtendedPersistenceContext(String kernelName)
{
StatefulBeanContext beanContext = StatefulBeanContext.currentBean.get();
if (beanContext != null)
{
EntityManager em = null;
ManagedEntityManagerFactory factory=
((PersistenceUnitDeployment) PersistenceUnitRegistry.getPersistenceUnit(kernelName)).getManagedFactory();
if (factory != null)
{
em = factory.createEntityManager();
if (em != null)
{
beanContext.addExtendedPersistenceContext(factory.getKernelName(), em);
log.info("created new XPC with scoped pu name=" + kernelName + " on SFSB bean=" + beanContext.getContainer().getIdentifier() + beanContext.getId());
/**
* TODO: Propagate created XPC as required (7.6.2.1 Inheritance of Extended Persistence Context
*
*/
// List <StatefulBeanContext> beanContexts = StatefulBeanContext.currentBean.getList();
// for( StatefulBeanContext bc : beanContexts)
// {
// bc.addExtendedPersistenceContext(kernelName, em);
// }
}
}
return em;
}
return null;
}
}
{code}
{code}
public class ManagedEntityManagerFactoryHelper
{
public static ManagedEntityManagerFactory getManagedEntityManagerFactory(String kernelName)
{
PersistenceUnitDeployment pu = (PersistenceUnitDeployment) PersistenceUnitRegistry.getPersistenceUnit(kernelName);
if(pu != null)
return pu.getManagedFactory();
return null;
}
}
{code}
was:
AS5 allowed a remote client to instantiate a set of stateful session beans (e.g. SFSB1 + SFSB2) and then call the remote stateful session beans in a started user transaction (UT1). Allow the beans invoked in the same transaction, to share the same persistence context.
One approach might be to defer creation of the extended persistence context until the first invocation (need to verify that this is the right approach).
Currently, we support shallow + deep extended persistence context inheritance. This will be a "lazy" variation of the deep XPC inheritance.
Some of the AS5 code is pasted below for easy reference.
{code}
public class ExtendedPersistenceContextPropagationInterceptor implements Interceptor
{
private static final Logger log = Logger.getLogger(ExtendedPersistenceContextPropagationInterceptor.class);
public String getName()
{
return this.getClass().getName();
}
public Object invoke(Invocation invocation) throws Throwable
{
log.debug("++++ LongLivedSessionPropagationInterceptor");
StatefulContainerInvocation ejb = (StatefulContainerInvocation) invocation;
StatefulBeanContext ctx = (StatefulBeanContext) ejb.getBeanContext();
Map<String, EntityManager> extendedPCs = ctx.getExtendedPersistenceContexts();
if (extendedPCs == null || extendedPCs.size() == 0)
{
return invocation.invokeNext();
}
TransactionManager tm = TxUtil.getTransactionManager();
if (tm.getTransaction() != null)
{
for (String kernelname : extendedPCs.keySet())
{
EntityManager manager = extendedPCs.get(kernelname);
ManagedEntityManagerFactory factory = ManagedEntityManagerFactoryHelper.getManagedEntityManagerFactory(kernelname);
factory.registerExtendedWithTransaction(manager);
}
}
return invocation.invokeNext();
}
}
{code}
{code}
public class EJB3XPCResolver implements XPCResolver
{
private static final Logger log = Logger.getLogger(EJB3XPCResolver.class);
/**
* Query the current stateful bean contexts for the specified XPC.
*/
public EntityManager getExtendedPersistenceContext(String kernelName)
{
StatefulBeanContext beanContext = StatefulBeanContext.currentBean.get();
if (beanContext != null)
{
EntityManager em = null;
em = beanContext.getExtendedPersistenceContext(kernelName);
if (em != null) {
log.info("current SFSB has XPC with scoped pu name=" + kernelName + " on SFSB bean=" + beanContext.getContainer().getIdentifier() + beanContext.getId());
return em;
}
/**
* Look for XPC in current bean set.
*/
log.info("looking for existing XPC with scoped pu name=" + kernelName);
List <StatefulBeanContext> beanContexts = StatefulBeanContext.currentBean.getList();
for( StatefulBeanContext bc : beanContexts)
{
em = bc.getExtendedPersistenceContext(kernelName);
if (em != null) {
log.info("found existing XPC with scoped pu name=" + kernelName + " on SFSB bean=" + bc.getContainer().getIdentifier() + bc.getId());
// Propagate created XPC as required (7.6.2.1 Inheritance of Extended Persistence Context
beanContext.addExtendedPersistenceContext(kernelName, em);
return em;
}
log.info("XPC not found yet, scoped pu name=" + kernelName + " not in SFSB bean=" + bc.getContainer().getIdentifier() + bc.getId());
}
}
log.info("XPC not found scoped, search done, pu name=" + kernelName);
return null;
}
@Override
public EntityManager createExtendedPersistenceContext(String kernelName)
{
StatefulBeanContext beanContext = StatefulBeanContext.currentBean.get();
if (beanContext != null)
{
EntityManager em = null;
ManagedEntityManagerFactory factory=
((PersistenceUnitDeployment) PersistenceUnitRegistry.getPersistenceUnit(kernelName)).getManagedFactory();
if (factory != null)
{
em = factory.createEntityManager();
if (em != null)
{
beanContext.addExtendedPersistenceContext(factory.getKernelName(), em);
log.info("created new XPC with scoped pu name=" + kernelName + " on SFSB bean=" + beanContext.getContainer().getIdentifier() + beanContext.getId());
/**
* TODO: Propagate created XPC as required (7.6.2.1 Inheritance of Extended Persistence Context
*
*/
// List <StatefulBeanContext> beanContexts = StatefulBeanContext.currentBean.getList();
// for( StatefulBeanContext bc : beanContexts)
// {
// bc.addExtendedPersistenceContext(kernelName, em);
// }
}
}
return em;
}
return null;
}
}
{code}
{code}
public class ManagedEntityManagerFactoryHelper
{
public static ManagedEntityManagerFactory getManagedEntityManagerFactory(String kernelName)
{
PersistenceUnitDeployment pu = (PersistenceUnitDeployment) PersistenceUnitRegistry.getPersistenceUnit(kernelName);
if(pu != null)
return pu.getManagedFactory();
return null;
}
}
{code}
> add lazy xpc inheritance to handle legacy case, remote client with UserTransaction fails on 2nd SFSB invocation when using extended persistence context
> -------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: WFLY-2504
> URL: https://issues.jboss.org/browse/WFLY-2504
> Project: WildFly
> Issue Type: Enhancement
> Security Level: Public(Everyone can see)
> Components: JPA / Hibernate
> Reporter: Scott Marlow
> Assignee: Scott Marlow
> Fix For: 9.0.0.CR1
>
>
> AS5 allowed a remote client to instantiate a set of stateful session beans (e.g. SFSB1 + SFSB2) and then call the remote stateful session beans (SFSB1+SFSB2) in a started user transaction (UT1). Each of the stateful beans reference the same extended persistence context by name. In AS5, both stateful beans will share the same extended persistence unit context but on AS7/WF8, each bean has its own extended persistence unit context. Having both XPCS involved in the same user transaction, causes an (EJBException: JBAS011437: Found extended persistence context in SFSB invocation call stack but that cannot be used because the transaction already has a transactional context associated with it...) error to be thrown.
> On AS7/WF8, Allow the beans invoked in the same transaction, to share the same persistence context.
> One approach might be to defer creation of the extended persistence context until the first invocation (need to verify that this is the right approach).
> Currently, we support shallow + deep extended persistence context inheritance. This will be a "lazy" variation of the deep XPC inheritance.
> Some of the AS5 code is pasted below for easy reference.
> {code}
> public class ExtendedPersistenceContextPropagationInterceptor implements Interceptor
> {
> private static final Logger log = Logger.getLogger(ExtendedPersistenceContextPropagationInterceptor.class);
> public String getName()
> {
> return this.getClass().getName();
> }
> public Object invoke(Invocation invocation) throws Throwable
> {
> log.debug("++++ LongLivedSessionPropagationInterceptor");
> StatefulContainerInvocation ejb = (StatefulContainerInvocation) invocation;
> StatefulBeanContext ctx = (StatefulBeanContext) ejb.getBeanContext();
> Map<String, EntityManager> extendedPCs = ctx.getExtendedPersistenceContexts();
> if (extendedPCs == null || extendedPCs.size() == 0)
> {
> return invocation.invokeNext();
> }
> TransactionManager tm = TxUtil.getTransactionManager();
> if (tm.getTransaction() != null)
> {
> for (String kernelname : extendedPCs.keySet())
> {
> EntityManager manager = extendedPCs.get(kernelname);
> ManagedEntityManagerFactory factory = ManagedEntityManagerFactoryHelper.getManagedEntityManagerFactory(kernelname);
> factory.registerExtendedWithTransaction(manager);
> }
> }
> return invocation.invokeNext();
> }
> }
> {code}
> {code}
> public class EJB3XPCResolver implements XPCResolver
> {
> private static final Logger log = Logger.getLogger(EJB3XPCResolver.class);
> /**
> * Query the current stateful bean contexts for the specified XPC.
> */
> public EntityManager getExtendedPersistenceContext(String kernelName)
> {
> StatefulBeanContext beanContext = StatefulBeanContext.currentBean.get();
> if (beanContext != null)
> {
> EntityManager em = null;
> em = beanContext.getExtendedPersistenceContext(kernelName);
> if (em != null) {
> log.info("current SFSB has XPC with scoped pu name=" + kernelName + " on SFSB bean=" + beanContext.getContainer().getIdentifier() + beanContext.getId());
> return em;
> }
> /**
> * Look for XPC in current bean set.
> */
> log.info("looking for existing XPC with scoped pu name=" + kernelName);
> List <StatefulBeanContext> beanContexts = StatefulBeanContext.currentBean.getList();
> for( StatefulBeanContext bc : beanContexts)
> {
> em = bc.getExtendedPersistenceContext(kernelName);
> if (em != null) {
> log.info("found existing XPC with scoped pu name=" + kernelName + " on SFSB bean=" + bc.getContainer().getIdentifier() + bc.getId());
> // Propagate created XPC as required (7.6.2.1 Inheritance of Extended Persistence Context
> beanContext.addExtendedPersistenceContext(kernelName, em);
> return em;
> }
> log.info("XPC not found yet, scoped pu name=" + kernelName + " not in SFSB bean=" + bc.getContainer().getIdentifier() + bc.getId());
> }
> }
> log.info("XPC not found scoped, search done, pu name=" + kernelName);
> return null;
> }
> @Override
> public EntityManager createExtendedPersistenceContext(String kernelName)
> {
> StatefulBeanContext beanContext = StatefulBeanContext.currentBean.get();
> if (beanContext != null)
> {
> EntityManager em = null;
> ManagedEntityManagerFactory factory=
> ((PersistenceUnitDeployment) PersistenceUnitRegistry.getPersistenceUnit(kernelName)).getManagedFactory();
> if (factory != null)
> {
> em = factory.createEntityManager();
> if (em != null)
> {
> beanContext.addExtendedPersistenceContext(factory.getKernelName(), em);
> log.info("created new XPC with scoped pu name=" + kernelName + " on SFSB bean=" + beanContext.getContainer().getIdentifier() + beanContext.getId());
> /**
> * TODO: Propagate created XPC as required (7.6.2.1 Inheritance of Extended Persistence Context
> *
> */
> // List <StatefulBeanContext> beanContexts = StatefulBeanContext.currentBean.getList();
> // for( StatefulBeanContext bc : beanContexts)
> // {
> // bc.addExtendedPersistenceContext(kernelName, em);
> // }
> }
> }
> return em;
> }
> return null;
> }
> }
> {code}
> {code}
> public class ManagedEntityManagerFactoryHelper
> {
> public static ManagedEntityManagerFactory getManagedEntityManagerFactory(String kernelName)
> {
> PersistenceUnitDeployment pu = (PersistenceUnitDeployment) PersistenceUnitRegistry.getPersistenceUnit(kernelName);
> if(pu != null)
> return pu.getManagedFactory();
> return null;
> }
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 6 months