I'm trying to build a Docker image 'from payara/server-full', but I need to copy both my application and an ActiveMQ resource adapter to $DEPLOY_DIR
.
Following the example at https://hub.docker.com/r/payara/server-full/:
FROM payara/server-full:174
COPY domain.xml /opt/payara41/glassfish/domains/domain1/config/
COPY sqljdbc4.jar ${PAYARA_PATH}/glassfish/domains/${PAYARA_DOMAIN}/lib
COPY activemq-rar.rar $DEPLOY_DIR
COPY my-app.ear $DEPLOY_DIR
EXPOSE 8080 8181
I'm constantly getting and error in my application:
[#|2018-02-23T20:30:09.450+0000|SEVERE|Payara 4.1|javax.enterprise.system.core|_ThreadID=1;_ThreadName=main;_TimeMillis=1519417809450;_LevelValue=1000;|
Exception while loading the app : EJB Container initialization error
com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Resource adapter activemq-rar is not deployed
at com.sun.enterprise.connectors.inbound.ConnectorMessageBeanClient.getActiveResourceAdapter(ConnectorMessageBeanClient.java:321)
at com.sun.enterprise.connectors.inbound.ConnectorMessageBeanClient.setup(ConnectorMessageBeanClient.java:166)
at org.glassfish.ejb.mdb.MessageBeanContainer.<init>(MessageBeanContainer.java:236)
at org.glassfish.ejb.mdb.MessageBeanContainerFactory.createContainer(MessageBeanContainerFactory.java:63)
at org.glassfish.ejb.startup.EjbApplication.loadContainers(EjbApplication.java:225)
at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:290)
at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:100)
at org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:209)
at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:318)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:497)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:220)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:508)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:544)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:540)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:539)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:570)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:562)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:561)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1469)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:111)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1851)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1727)
at com.sun.enterprise.admin.cli.embeddable.CommandExecutorImpl.executeCommand(CommandExecutorImpl.java:169)
at com.sun.enterprise.admin.cli.embeddable.CommandExecutorImpl.run(CommandExecutorImpl.java:94)
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher.runCommand(GlassFishMain.java:235)
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher.doBootCommands(GlassFishMain.java:275)
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher.launch(GlassFishMain.java:130)
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 com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:104)
at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:54)
|#]
It doesn't appear to be deployed:
$ docker container exec -i -t 113e78a53c7a /bin/bash
payara@113e78a53c7a:~$ ls glassfish/domains/domain1/applications
__internal ejb-timer-service-app my-app
$ ls deployments/
activemq-rar.rar my-app.ear
The reason why RAR isn't deployed may be that the app is getting deployed first. Check the generated post-boot-commands.asadmin
to see the order of exection of asadmin commands at boot.
To make the deployment order deterministic, create your own post boo commands file and set the docker environment variable POSTBOOT_COMMANDS
to point to it to use it instead of the generated command file.