IN VM Passthrough strategy, create ServiceClientFactory object when calling API from the same JVM as AEM Forms or LiveCycle server.

Environment

AEM Forms/LiveCycle

Steps

We usually write following code when invoking LiveCycle/AEM Forms JEE java API through a remote client for getting ServiceClientFactory object: 

Properties connectionProps = new Properties(); 
connectionProps.setProperty("DSC_DEFAULT_EJB_ENDPOINT", "remote://localhost:4447"); 
connectionProps.setProperty("DSC_TRANSPORT_PROTOCOL", ServiceClientFactoryProperties.DSC_EJB_PROTOCOL); 
connectionProps.setProperty("DSC_SERVER_TYPE", ServiceClientFactoryProperties.DSC_JBOSS_SERVER_TYPE); 
connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator"); 
connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");

//Create a ServiceClientFactory object 
ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps);

But in case, we want to invoke these APIs in a DSC or 'Execute Script' in workflow, we could easily use in vm direct pass through invocation strategy (which is default).
Use below code to get ServiceClientFactory object using IN VM direct passthrough strategy:

ServiceClientFactory factory = ServiceClientFactory.createInstance();

Additional information

See javadoc for details. EJB invocation (endpoint) could be used either remotely or from same jvm. In AEM Forms 6.x with Jboss 6.x, using EJB endpoint, we get following exception:

11:07:50,598 INFO  [org.jboss.ejb.client.remoting] (Remoting "config-based-ejb-client-endpoint" task-9) EJBCLIENT000016: Channel Channel ID d0222b23 (outbound) of Remoting connection 42c6cf58 to localhost/127.0.0.1:4447 can no longer process messages
11:07:50,635 WARN  [com.arjuna.ats.jta] (http-/0.0.0.0:8080-6) ARJUNA016039: onePhaseCommit on < formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffffac1e0177:-45bdf235:59bf841a:332d3, node_name=1, branch_uid=0:ffffac1e0177:-45bdf235:59bf841a:335f5, subordinatenodename=null, eis_name=unknown eis name > (ResourceImpl{transactionKey=0:ffffac1e0177:-45bdf235:59bf841a:332d3, ejbClientContext=org.jboss.ejb.client.EJBClientContext@5e76e7ac, nodeName='nt388082', state=null}) failed with exception -: java.lang.IllegalStateException: EJBCLIENT000027: No EJBReceiver available for node name nt388082
	at org.jboss.ejb.client.EJBClientContext.requireNodeEJBReceiver(EJBClientContext.java:842) [jboss-ejb-client-1.0.32.Final-redhat-1.jar:1.0.32.Final-redhat-1]
	at org.jboss.ejb.client.EJBClientContext.requireNodeEJBReceiverContext(EJBClientContext.java:883) [jboss-ejb-client-1.0.32.Final-redhat-1.jar:1.0.32.Final-redhat-1]
	at org.jboss.ejb.client.EJBClientManagedTransactionContext$ResourceImpl.commit(EJBClientManagedTransactionContext.java:237) [jboss-ejb-client-1.0.32.Final-redhat-1.jar:1.0.32.Final-redhat-1]
	at com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord.topLevelOnePhaseCommit(XAResourceRecord.java:682)
	at com.arjuna.ats.arjuna.coordinator.BasicAction.onePhaseCommit(BasicAction.java:2278)
	at com.arjuna.ats.arjuna.coordinator.BasicAction.End(BasicAction.java:1479)
	at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:98)
	at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:162)
	at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1189)
	at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:126)
	at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
	at org.jboss.as.ejb3.tx.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:91) [jboss-as-ejb3-7.5.5.Final-redhat-3.jar:7.5.5.Final-redhat-3]
	at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:282) [jboss-as-ejb3-7.5.5.Final-redhat-3.jar:7.5.5.Final-redhat-3]
	at org.jboss.as.ejb3.tx.CMTTxInterceptor.requiresNew(CMTTxInterceptor.java:352) [jboss-as-ejb3-7.5.5.Final-redhat-3.jar:7.5.5.Final-redhat-3]
	at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:244) [jboss-as-ejb3-7.5.5.Final-redhat-3.jar:7.5.5.Final-redhat-3]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
	at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.5.5.Final-redhat-3.jar:7.5.5.Final-redhat-3]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
	at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:43) [jboss-as-ejb3-7.5.5.Final-redhat-3.jar:7.5.5.Final-redhat-3]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
	at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64) [jboss-as-ejb3-7.5.5.Final-redhat-3.jar:7.5.5.Final-redhat-3]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
	at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [jboss-as-ejb3-7.5.5.Final-redhat-3.jar:7.5.5.Final-redhat-3]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
	at org.jboss.as.ejb3.component.interceptors.EjbExceptionTransformingInterceptorFactories$2.processInvocation(EjbExceptionTransformingInterceptorFactories.java:103) [jboss-as-ejb3-7.5.5.Final-redhat-3.jar:7.5.5.Final-redhat-3]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
	at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.5.5.Final-redhat-3.jar:7.5.5.Final-redhat-3]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
	at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:55) [jboss-as-ejb3-7.5.5.Final-redhat-3.jar:7.5.5.Final-redhat-3]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
	at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.5.5.Final-redhat-3.jar:7.5.5.Final-redhat-3]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
	at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
	at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:185) [jboss-as-ee-7.5.5.Final-redhat-3.jar:7.5.5.Final-redhat-3]
	at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:185) [jboss-as-ee-7.5.5.Final-redhat-3.jar:7.5.5.Final-redhat-3]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
	at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
	at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:73) [jboss-as-ee-7.5.5.Final-redhat-3.jar:7.5.5.Final-redhat-3]
	at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapterLocal$$$view75.doRequiresNew(Unknown Source) [adobe-dscf.jar:6.3.0.20170419.1.333177]
	at com.adobe.idp.dsc.transaction.impl.ejb.EjbTransactionProvider.execute(EjbTransactionProvider.java:143) [adobe-dscf.jar:6.3.0.20170419.1.333177]
	at com.adobe.idp.dsc.transaction.interceptor.TransactionInterceptor.intercept(TransactionInterceptor.java:72) [adobe-dscf.jar:6.3.0.20170419.1.333177]
	at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptorChainImpl.java:60) [adobe-dscf.jar:6.3.0.20170419.1.333177]
	at com.adobe.idp.dsc.interceptor.impl.InvocationStrategyInterceptor.intercept(InvocationStrategyInterceptor.java:55) [adobe-dscf.jar:6.3.0.20170419.1.333177]
	at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptorChainImpl.java:60) [adobe-dscf.jar:6.3.0.20170419.1.333177]
	at com.adobe.idp.dsc.interceptor.impl.InvalidStateInterceptor.intercept(InvalidStateInterceptor.java:37) [adobe-dscf.jar:6.3.0.20170419.1.333177]
	at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptorChainImpl.java:60) [adobe-dscf.jar:6.3.0.20170419.1.333177]
	at com.adobe.idp.dsc.interceptor.impl.AuthorizationInterceptor.intercept(AuthorizationInterceptor.java:188) [adobe-dscf.jar:6.3.0.20170419.1.333177]
	at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptorChainImpl.java:60) [adobe-dscf.jar:6.3.0.20170419.1.333177]
	at com.adobe.idp.dsc.interceptor.impl.JMXInterceptor.intercept(JMXInterceptor.java:48) [adobe-dscf.jar:6.3.0.20170419.1.333177]
	at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptorChainImpl.java:60) [adobe-dscf.jar:6.3.0.20170419.1.333177]
	at com.adobe.idp.dsc.engine.impl.ServiceEngineImpl.invoke(ServiceEngineImpl.java:121) [adobe-dscf.jar:6.3.0.20170419.1.333177]
	at com.adobe.idp.dsc.routing.Router.routeRequest(Router.java:131) [adobe-dscf-client.jar:6.3.0.20170419.1.333177]
	at com.adobe.idp.dsc.provider.impl.soap.axis.AdobeAxisServiceProvider.invokeMethod(AdobeAxisServiceProvider.java:222) [adobe-soap-provider.jar:6.3.0.20170419.1.333177]
	at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186) [axis.jar:]
	at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323) [axis.jar:]
	at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32) [axis.jar:]
	at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) [axis.jar:]
	at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83) [axis.jar:]
	at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454) [axis.jar:]
	at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281) [axis.jar:]
	at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699) [axis.jar:]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-2.jar:1.0.2.Final-redhat-2]
	at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327) [axis.jar:]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-2.jar:1.0.2.Final-redhat-2]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
	at com.adobe.idp.dsc.provider.impl.soap.axis.InvocationFilter.doFilter(InvocationFilter.java:43) [adobe-soap-provider.jar:6.3.0.20170419.1.333177]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
	at com.adobe.idp.um.auth.filter.ParameterFilter.doFilter(ParameterFilter.java:105) [um.jar:]
	at com.adobe.idp.um.auth.filter.CSRFFilter.invokeNextFilter(CSRFFilter.java:142) [um.jar:]
	at com.adobe.idp.um.auth.filter.CSRFFilter.doFilter(CSRFFilter.java:133) [um.jar:]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149)
	at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:150)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:854)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:926)
	at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_74]

Though it is harmless, we could avoid this easily by using IN VM strategy, in case, we invoke it from same jvm.

Esta obra está autorizada con arreglo a la licencia de Reconocimiento-NoComercial-CompartirIgual 3.0 Unported de Creative Commons.  Los términos de Creative Commons no cubren las publicaciones en Twitter™ y Facebook.

Avisos legales   |   Política de privacidad en línea