I have the next setting:
An EJB deployed in a glassfish 3.2.1 application Server.
Trying to deploy a Springboot app as WAR over a Wildfly 11 App Server.
In my springboot app, I added the maven dependency for glassfish client (gf-client):
<dependency>
<groupId>org.glassfish.main.appclient</groupId>
<artifactId>gf-client</artifactId>
<version>5.1.0</version>
</dependency>
When I try to deploy the springboot app in wildfly, the server writes on log the following message:
[org.jboss.as.ejb3.deployment] (MSC service thread 1-7) WFLYEJB0473: JNDI bindings for session bean named 'TimerBean' in deployment unit 'deployment "gestion-garantias-fcd.war"' are as follows:
java:global/gestion-garantias-fcd/TimerBean!org.glassfish.ejb.persistent.timer.TimerLocal java:app/gestion-garantias-fcd/TimerBean!org.glassfish.ejb.persistent.timer.TimerLocal java:module/TimerBean!org.glassfish.ejb.persistent.timer.TimerLocal java:global/gestion-garantias-fcd/TimerBean java:app/gestion-garantias-fcd/TimerBean java:module/TimerBean
10:31:38,790 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC000001: Failed to start service jboss.deployment.unit."gestion-garantias-fcd.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."gestion-garantias-fcd.war".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment "gestion-garantias-fcd.war" at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:172) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:2032) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1955) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYEE0041: Component class org.glassfish.ejb.persistent.timer.TimerBean for component TimerBean has errors: WFLYJPA0033: Can't find a persistence unit named __EJB__Timer__App in deployment "gestion-garantias-fcd.war" at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor$1.handle(ModuleJndiBindingProcessor.java:157) at org.jboss.as.ee.component.ClassDescriptionTraversal.run(ClassDescriptionTraversal.java:54) at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.processClassConfigurations(ModuleJndiBindingProcessor.java:186) at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.deploy(ModuleJndiBindingProcessor.java:143) at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:165) ... 5 more
10:31:38,797 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "gestion-garantias-fcd.war")]) - failure description: { "WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"gestion-garantias-fcd.war\".INSTALL" => "WFLYSRV0153: Failed to process phase INSTALL of deployment \"gestion-garantias-fcd.war\" Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYEE0041: Component class org.glassfish.ejb.persistent.timer.TimerBean for component TimerBean has errors: WFLYJPA0033: Can't find a persistence unit named __EJB__Timer__App in deployment \"gestion-garantias-fcd.war\""}, "WFLYCTL0412: Required services that are not installed:" => ["jboss.deployment.unit.\"gestion-garantias-fcd.war\".beanmanager"], "WFLYCTL0180: Services with missing/unavailable dependencies" => [ "jboss.deployment.unit.\"gestion-garantias-fcd.war\".weld.weldClassIntrospector is missing [jboss.deployment.unit.\"gestion-garantias-fcd.war\".beanmanager]", "jboss.deployment.unit.\"gestion-garantias-fcd.war\".batch.artifact.factory is missing [jboss.deployment.unit.\"gestion-garantias-fcd.war\".beanmanager]" ] }
I bolded what I think is the main cause for the error.
Basically, the error happens because in gf-client exists an internal app called ejb-timer-service-app, and it contains a persistence configuration (persistence.xml). That config specifies a persistence unit called __EJB__Timer__App, which references to a datasource which normally is created in all glassfish installations (jdbc/__TimerPool).
I don't know where is that app (ejb-timer-service-app) into gf-client, but I tried to do an exclusion over the gf-client dependency. Exactly, I tried to exclude the next dependency:
<groupId>org.glassfish.main.ejb</groupId>
<artifactId>ejb</artifactId>
But the error stills present.
Then, I opted for use some individual embeeded dependencies in gf-client. the dependencies list is here:
<dependency>
<groupId>org.glassfish.main.deployment</groupId>
<artifactId>deployment-client</artifactId>
<version>5.1.0</version>
</dependency>
<dependency>
<groupId>org.glassfish.main.common</groupId>
<artifactId>glassfish-naming</artifactId>
<version>5.1.0</version>
</dependency>
<dependency>
<groupId>org.reactivestreams</groupId>
<artifactId>reactive-streams</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.main.ejb</groupId>
<artifactId>ejb-client</artifactId>
<version>5.1.0</version>
</dependency>
<dependency>
<groupId>org.glassfish.main.orb</groupId>
<artifactId>orb-connector</artifactId>
<version>5.1.0</version>
</dependency>
<dependency>
<groupId>org.glassfish.main.ejb</groupId>
<artifactId>ejb-container</artifactId>
<version>5.0</version>
</dependency>
The first error (Can't find a persistence unit..) dessapeared. But now, another error was found:
Caused by: javax.naming.NamingException: Lookup failed for 'java:global/gyf_electronicdocument_guaranteeCrediro_ear/gyf_electronicdocument_guaranteeCredioro_business/GuaranteeCOBean!com.gyf.electronicdocument.guaranteeCredioro.to.GuaranteeRemote' in SerialContext[myEnv={org.omg.CORBA.ORBInitialPort=3701, java.naming.factory.initial=com.sun.enterprise.naming.SerialInitContextFactory, java.naming.ldap.version=3, org.omg.CORBA.ORBInitialHost=127.0.0.1, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NamingException: Unable to acquire SerialContextProvider for SerialContext[myEnv={org.omg.CORBA.ORBInitialPort=3701, java.naming.factory.initial=com.sun.enterprise.naming.SerialInitContextFactory, java.naming.ldap.version=3, org.omg.CORBA.ORBInitialHost=127.0.0.1, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is java.lang.RuntimeException: Orb initialization erorr]] at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:467) at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:414) at javax.naming.InitialContext.lookup(InitialContext.java:417) at javax.naming.InitialContext.lookup(InitialContext.java:417) at javax.naming.InitialContext.lookup(InitialContext.java:417) at com.gyf.gestiongarantias.config.DocumentoElectronicoEJBConfig.ejbWarranty(DocumentoElectronicoEJBConfig.java:40) at com.gyf.gestiongarantias.config.DocumentoElectronicoEJBConfig$$EnhancerBySpringCGLIB$$e5ce1c3b.CGLIB$ejbWarranty$1() at com.gyf.gestiongarantias.config.DocumentoElectronicoEJBConfig$$EnhancerBySpringCGLIB$$e5ce1c3b$$FastClassBySpringCGLIB$$b2972094.invoke() at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) at com.gyf.gestiongarantias.config.DocumentoElectronicoEJBConfig$$EnhancerBySpringCGLIB$$e5ce1c3b.ejbWarranty() at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ... 92 more
Caused by: javax.naming.NamingException: Unable to acquire SerialContextProvider for SerialContext[myEnv={org.omg.CORBA.ORBInitialPort=3701, java.naming.factory.initial=com.sun.enterprise.naming.SerialInitContextFactory, java.naming.ldap.version=3, org.omg.CORBA.ORBInitialHost=127.0.0.1, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is java.lang.RuntimeException: Orb initialization erorr] at com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:310) at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:453) ... 107 more
Caused by: java.lang.RuntimeException: Orb initialization erorr at org.glassfish.enterprise.iiop.api.GlassFishORBHelper.getORB(GlassFishORBHelper.java:167) at com.sun.enterprise.naming.impl.SerialContext.getORB(SerialContext.java:323) at com.sun.enterprise.naming.impl.SerialContext.getProviderCacheKey(SerialContext.java:330) at com.sun.enterprise.naming.impl.SerialContext.getRemoteProvider(SerialContext.java:360) at com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:305) ... 108 more Caused by: java.lang.NullPointerException at org.glassfish.enterprise.iiop.api.GlassFishORBHelper.getORB(GlassFishORBHelper.java:139) ... 112 more
I tried to use several dependencies for mitigate this error, but I have exhausted my alternatives.
So my questions are:
Should I configurate a persistence unit in my springboot app with the same names like in the persistence.xml?
Is there any dependency that I should exclude?
If gf-client is not the best way, What dependencies of the glassfish repository shoud I use for my case?
Is there any other method for call remote EJB under these conditions exposed in my case?
Thanks in advance, and hope you well.
IMO, you should create the a persistence unit. I think it needed for gf to run probaly