[jboss-jira] [JBoss JIRA] (WFLY-6678) StackoverflowError ejbclientinvocationcontext
jaikiran pai (JIRA)
issues at jboss.org
Mon Jun 13 10:29:00 EDT 2016
[ https://issues.jboss.org/browse/WFLY-6678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13251586#comment-13251586 ]
jaikiran pai commented on WFLY-6678:
------------------------------------
{quote}
So I would suggest, you change that code above to register that interceptor only once per EJBClientContext. Without knowing/seeing more context for that code of your application, I can't suggest where/how to do that such that it registers it only one per context.
{quote}
I see 2 ways to fix that application code.
First:
{code}
/**
* Get service needed authentication
*
* @param userContext
* @return
*/
public T getService(final String fullUserId, final String applicationName) {
try {
final Properties ejbClientContextProps = new Properties();
ejbClientContextProps.put("org.jboss.ejb.client.scoped.context", "true");
final Context initialContext = new InitialContext(ejbClientContextProps);
// find the EJB client context which is scoped to this JNDI contet
final EJBClientContext scopedEJBClientContext = initialContext.lookup("ejb:/EJBClientContext");
// register the interceptor against the scoped EJB client context
scopedEJBClientContext.registerInterceptor(0x99999, new ProxyInterceptor(fullUserId, applicationName));
return (T) initialContext.lookup(jndiName);
}
catch (NamingException e) {
LOGGER.warn("Service non disponible : " + jndiName + ", " + e);
}
return null;
}
{code}
See the way the scoped EJB client context is obtained and how the interceptor is now registered against that specific one.
*Second (the one that I recommend) * is that you create a META-INF/services/org.jboss.ejb.client.EJBClientInterceptor file which contains the following:
{code}
com.inovelan.cloud.common.proxy.ProxyInterceptor
{code}
You can then completely remove the part in your code where you register a client interceptor, since this interceptor now gets registered automatically to the interceptor chain of the newly created EJB client contexts. So your code would then just be:
{code}
/**
* Get service needed authentication
*
* @param userContext
* @return
*/
public T getService(final String fullUserId, final String applicationName) {
try {
final Properties ejbClientContextProps = new Properties();
ejbClientContextProps.put("org.jboss.ejb.client.scoped.context", "true");
final Context initialContext = new InitialContext(ejbClientContextProps);
return (T) initialContext.lookup(jndiName);
}
catch (NamingException e) {
LOGGER.warn("Service non disponible : " + jndiName + ", " + e);
}
return null;
}
{code}
> StackoverflowError ejbclientinvocationcontext
> ---------------------------------------------
>
> Key: WFLY-6678
> URL: https://issues.jboss.org/browse/WFLY-6678
> Project: WildFly
> Issue Type: Bug
> Components: EJB
> Affects Versions: 9.0.1.Final
> Environment: wildfly 9.0.1, jdk 1.8
> Reporter: Jimmy Pannier
> Attachments: server.log
>
>
> Sometimes after few days i get an exception
> Here is a stacktrace.
> 2016-06-07 07:38:10,441 ERROR [org.jboss.as.ejb3.invocation] (default task-76) WFLYEJB0034: EJB Invocation failed on component StorageServiceImpl for method public abstract java.util.List com.inovelan.cloud.api.storage.service.dataset.IStorageEjbService.loadData(com.inovelan.cloud.api.storage.model.dto.dataset.LoadDataConfig): javax.ejb.EJBTransactionRolledbackException: WFLYEJB0457: Unexpected Error
> at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleInCallerTx(CMTTxInterceptor.java:153)
> at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:256)
> at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:329)
> .....
> Caused by: java.lang.StackOverflowError
> at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:290)
> at com.inovelan.cloud.common.proxy.ProxyInterceptor.handleInvocationResult(ProxyInterceptor.java:37)
> at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:290)
> at com.inovelan.cloud.common.proxy.ProxyInterceptor.handleInvocationResult(ProxyInterceptor.java:37)
> at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:290)
> at com.inovelan.cloud.common.proxy.ProxyInterceptor.handleInvocationResult(ProxyInterceptor.java:37)
> at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:290)
> at com.inovelan.cloud.common.proxy.ProxyInterceptor.handleInvocationResult(ProxyInterceptor.java:37)
> at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:290)
> at com.inovelan.cloud.common.proxy.ProxyInterceptor.handleInvocationResult(ProxyInterceptor.java:37)
> at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:290)
> at com.inovelan.cloud.common.proxy.ProxyInterceptor.handleInvocationResult(ProxyInterceptor.java:37)
> at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:290)
> at com.inovelan.cloud.common.proxy.ProxyInterceptor.handleInvocationResult(ProxyInterceptor.java:37)
> at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:290)
> at com.inovelan.cloud.common.proxy.ProxyInterceptor.handleInvocationResult(ProxyInterceptor.java:37)
> at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:290)
> at com.inovelan.cloud.common.proxy.ProxyInterceptor.handleInvocationResult(ProxyInterceptor.java:37)
> at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:290)
> at com.inovelan.cloud.common.proxy.ProxyInterceptor.handleInvocationResult(ProxyInterceptor.java:37)
> at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:290)
> at com.inovelan.cloud.common.proxy.ProxyInterceptor.handleInvocationResult(ProxyInterceptor.java:37)
> at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:290)
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
More information about the jboss-jira
mailing list