Openshift pod complains about missing directories for image - kubernetes

I tested my ApachedMQ image on Ubuntu and it works fine with Docker.
On Openshift deploying the same image does not work.
It should work out of the box, just like Ubuntu, but it always complains about missing directories in the pod, or lack of permissions on directories in the pod. Below you will see errors regarding the former.
I am using the FREE edition of Openshift online v3.x
I am only using the console to deploy from the image.
Below just a sample of the log messages when the pod is ramping up for the deployment.
java.io.FileNotFoundException: /opt/activemq/data/activemq.log (Permission denied)
Caused by: java.io.IOException: Failed to create directory '/opt/activemq/data/kahadb'
Any help would be much appreciated, as this image should IMO, be deployable from the console without any YAML and oc CLI necessary.
Some log trace information:
INFO: Loading '/opt/activemq/bin/env'
INFO: Using java '/docker-java-home/jre/bin/java'
INFO: Starting in foreground, this is just for debugging purposes (stop process by pressing CTRL+C)
INFO: Creating pidfile /opt/activemq/data/activemq.pid
bin/activemq: 484: bin/activemq: cannot create /opt/activemq/data/activemq.pid: Permission denied
Java Runtime: Oracle Corporation 1.8.0_141 /usr/lib/jvm/java-8-openjdk-amd64/jre
Heap sizes: current=62976k free=58714k max=932352k
JVM args: -Xms64M -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/opt/activemq/conf/login.config -Dcom.sun.management.jmxremote -Djava.awt.headless=true -Djava.io.tmpdir=/opt/activemq/tmp -Dactivemq.classpath=/opt/activemq/conf:/opt/activemq/../lib/: -Dactivemq.home=/opt/activemq -Dactivemq.base=/opt/activemq -Dactivemq.conf=/opt/activemq/conf -Dactivemq.data=/opt/activemq/data
Extensions classpath:
[/opt/activemq/lib,/opt/activemq/lib/camel,/opt/activemq/lib/optional,/opt/activemq/lib/web,/opt/activemq/lib/extra]
ACTIVEMQ_HOME: /opt/activemq
ACTIVEMQ_BASE: /opt/activemq
ACTIVEMQ_CONF: /opt/activemq/conf
ACTIVEMQ_DATA: /opt/activemq/data
log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: /opt/activemq/data/activemq.log (Permission denied)
...
log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: /opt/activemq/data/audit.log (Permission denied)
...
Loading message broker from: xbean:activemq.xml
INFO | Refreshing org.apache.activemq.xbean.XBeanBrokerFactory$1#5bcab519: startup date [Fri Mar 16 21:10:18 UTC 2018]; root of context hierarchy
WARN | Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in class path resource [activemq.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: java.io.IOException: Failed to create directory '/opt/activemq/data/kahadb'
ERROR | Failed to load: class path resource [activemq.xml], reason: Error creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in class path resource [activemq.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: java.io.IOException: Failed to create directory '/opt/activemq/data/kahadb'
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in class path resource [activemq.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: java.io.IOException: Failed to create directory '/opt/activemq/data/kahadb'
SOLVED proof::

In order for the image to successfully be deployed, the following have to be done on the cluster:
oc adm policy add-scc-to-user anyuid -z default -n myproject --as system:admin
When deploying set the ACTIVEMQ_DATA environment variable to /tmp
I will continue to find other alternatives including a rebuild of the image, creating a pod with the requisite permissions for the $APACHEMQ_DATA directory.
Below proof of the route working on the playground instance.
It is o.k. to paste it as the playground will expire in the next 10 minutes.

I corrected the image.
The docker file can be found here on my fork:
https://github.com/beezerbt/docker-activemq/tree/master/5.14.5-openshift-v3.9.14
The image for the above can be found here:
https://hub.docker.com/r/beezer/openshift-ready-mq/tags/
Tag::[5.14.5-3.9.14]
Finally, since the image has an ephemeral persistence, a volume can be mapped to /app within the openshift cluster quite easily; however do remember that you must set the volume mount point as something OTHER than /app and then further down in the volume definition on Openshift console, specify where in the container it should be mapped to...which is then /app.

I have created a activemq image which can be deployed in Openshift
https://hub.docker.com/r/rangareddyv/activemq-openshift
Created an image with latest version of activemq and amzn-corretto-jdk-11 as bas image because openjdk has lot of CVE's and alpine does not support the jdk-11

Related

Exception deploying SCDF App with Docker Compose

I am running SCDF with Docker Compose in Ubuntu 20.04 on WSL. I can create and deploy streams using starter sources/sinks without issue but when trying to deploy a custom Spring Cloud Stream app the following happens and I am not sure how to resolve it:
dataflow:>app register --name order-source --type source --uri docker://*******/****:order-producer
Successfully registered application 'source:order-source'
dataflow:>stream create ordering-stream --definition "order-source | log"
Created new stream 'ordering-stream'
dataflow:>stream deploy ordering-stream
Command failed org.springframework.cloud.dataflow.rest.client.DataFlowClientException: SkipperException
SkipperException
org.springframework.cloud.dataflow.rest.client.DataFlowClientException: SkipperException
at org.springframework.cloud.dataflow.rest.client.VndErrorResponseErrorHandler.handleError(VndErrorResponseErrorHandler.java:65)
at org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63)
at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:780)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:738)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:672)
at org.springframework.web.client.RestTemplate.postForObject(RestTemplate.java:416)
at org.springframework.cloud.dataflow.rest.client.StreamTemplate.deploy(StreamTemplate.java:141)
at org.springframework.cloud.dataflow.shell.command.StreamCommands.deployStream(StreamCommands.java:167)
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.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:282)
at org.springframework.shell.core.SimpleExecutionStrategy.invoke(SimpleExecutionStrategy.java:68)
at org.springframework.shell.core.SimpleExecutionStrategy.execute(SimpleExecutionStrategy.java:59)
at org.springframework.shell.core.AbstractShell.executeCommand(AbstractShell.java:134)
at org.springframework.shell.core.JLineShell.promptLoop(JLineShell.java:533)
at org.springframework.shell.core.JLineShell.run(JLineShell.java:179)
at java.lang.Thread.run(Thread.java:748)
This skipper server exception includes this:
Caused by: java.io.IOException: Cannot run program "docker" (in directory "/tmp/1627185411996/ordering-stream.order-source-v1"): error=2, No such file or directory
I can include the verbose server output if that would be helpful.
I was able to resolve the problem by referencing the application's jar file locally with Uri = file:///root/scdf/order-service-0.0.1-SNAPSHOT.jar. The docker-compose.yml file also needs to be inside the same directory as the jar file (~/scdf in this case). I'm still unsure why the Docker Hub Uri reference fails since docker is working for SCDF, all of the other services within Docker Compose, and elsewhere.

Skyve on Wildfly wont restart with StateTransitionException

On restart of Wildfly I get the following error:
java.lang.RuntimeException: org.ehcache.StateTransitionException: Persistence directory already locked by this process: C:\bizhub\workspace\content\SKYVE_CACHE
Shutdown Wildfly if it is running, in the directory named in the exception (in this case C:\bizhub\workspace\content\SKYVE_CACHE) there will be a file called .lock, if this file is removed and wildfly is restarted this should resolve the issue.

JBoss service failure

I get the following exception when I run JBoss:
Failed to start service org.wildfly.network.interface.cluster:
org.jboss.msc.service.StartException in service org.wildfly.network.interface.cluster:
WFLYSRV0082: failed to resolve interface cluster at
org.jboss.as.server.services.net.NetworkInterfaceService.start(NetworkInterfaceService.java:96)
This is rather generic. Does anyone know how to get more details about the root cause?
Any idea which jar file contains org.jboss.as.server.services.net.NetworkInterfaceService class?

Error invoking a remote EJB method from a JSF managed bean in a portlet

I am trying to deploy a JSF portlet into a Liferay portal 6.2 running on top of a JBoss EAP 6.4, with OpenJDK 8. The portlet is deployed as a WAR file, but invokes some methods of an EJB through a remote interface. The EJB is deployed as an EAR file directly on JBoss.
On my developing machine it is working fine. But in a test machine it is not. There are exactly the same WAR and EAR files, the standalone.xml setup is almost the same for both machines, and also the JBoss modules are the same.
The stacktrace printed in the log is the following:
JBWEB000236: Servlet.service() for servlet Adminis Servlet threw exception: javax.portlet.faces.BridgeException: javax.faces.FacesException
at com.liferay.faces.bridge.BridgePhaseRenderImpl.execute(BridgePhaseRenderImpl.java:91) [liferay-faces-bridge-impl-3.2.4-ga5.jar:3.2.4-ga5 (Ephesus / Feb 15, 2014 AD)]
at com.liferay.faces.bridge.BridgeImpl.doFacesRequest(BridgeImpl.java:112) [liferay-faces-bridge-impl-3.2.4-ga5.jar:3.2.4-ga5 (Ephesus / Feb 15, 2014 AD)]
...
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_121]
Caused by: javax.faces.FacesException
at com.sun.faces.context.ExceptionHandlerImpl.handle(ExceptionHandlerImpl.java:139) [jsf-impl-2.1.28.redhat-8.jar:2.1.28.redhat-8]
at org.icefaces.impl.application.ExtendedExceptionHandler.handle(ExtendedExceptionHandler.java:113) [icefaces-3.3.0.jar:]
... 194 more
Caused by: java.util.NoSuchElementException
at java.util.HashMap$HashIterator.nextNode(HashMap.java:1439) [rt.jar:1.8.0_121]
at java.util.HashMap$KeyIterator.next(HashMap.java:1461) [rt.jar:1.8.0_121]
at org.jboss.ejb.client.EJBClientContext.getEJBReceiver(EJBClientContext.java:725) [jboss-ejb-client-1.0.30.Final-redhat-1.jar:1.0.30.Final-redhat-1]
at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:146) [jboss-ejb-client-1.0.30.Final-redhat-1.jar:1.0.30.Final-redhat-1]
...
at com.sun.proxy.$Proxy459.obtenerUsuarioPorCodigo(Unknown Source)
at com.sofis.adminis.delegates.PermisosDelegate.obtenerUsuarioPorCodigo(PermisosDelegate.java:450) [adminis-delegate-1.0.jar:]
at com.sofis.security.web.UsuariosSessionBeanWeb.autenticar(UsuariosSessionBeanWeb.java:1927) [classes:]
at com.sofis.security.web.listeners.SofisAutologinLiferayPhaseListener.afterPhase(SofisAutologinLiferayPhaseListener.java:54) [classes:]
at com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:189) [jsf-impl-2.1.28.redhat-8.jar:2.1.28.redhat-8]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:107) [jsf-impl-2.1.28.redhat-8.jar:2.1.28.redhat-8]
... 198 more
I rised the log level to "org.jboss.ejb.client" and now I see two interesting messages just before the stactrace:
22:13:16,684 DEBUG [org.jboss.ejb.client.EJBClientContext] (ajp-/0.0.0.0:8009-5) org.jboss.as.ejb3.remote.LocalEJBReceiverPreferringDeploymentNodeSelector#4bc9113e deployment node selector selected node for appname=SS-ADMINIS-ear-1.0,modulename=SS-ADMINIS-MAVEN-EJB-1.0,distinctname=
22:13:16,687 DEBUG [org.jboss.ejb.client.EJBClientContext] (ajp-/0.0.0.0:8009-5) Selected node doesn't belong to eligible receivers. Continuing with a random eligible receiver
Note that there is no node name in both messages (two blanks before "node").
In my developing machine, where it works, the first message does include a node name, and the second message does not appear:
18:56:37,902 DEBUG [org.jboss.ejb.client.EJBClientContext] (http-/0.0.0.0:8080-2) org.jboss.as.ejb3.remote.LocalEJBReceiverPreferringDeploymentNodeSelector#6db73304 deployment node selector selected spio node for appname=SS-ADMINIS-ear-1.0,modulename=SS-ADMINIS-MAVEN-EJB-1.0,distinctname=
The only diference is that in my machine I am going directly with the browser to the server ([Browser] -- HTTP --> [JBoss]) while in the testing machine I go through a load balancer ([Browser] -- HTTP --> [Apache] -- AJP --> [JBoss]). That is reflected in the messages (ajp-/0.0.0.0 vs http-/0.0.0.0).
The exception is thrown when I try to invoke a method from the EJB through the remote interface. The reference to the local stub is gotten by means of a lookup, and the result is not null. There are no errors at deploy and the lookup does not throw an error neither.
What can be happening or what am I missing?
A friend of mine found the solution.
Something a did't say is that the testing machine was in fact a docker container. And it seems that there is a bug in JBoss with docker making the former to not read the hostname to pick a node name, so de node name when it starts is empty. So the message above a empty name node being selected is shown, and then the error.
The workaround is to specify a node name with the -Djboss.node.name parameter to JBoss. I put that setting in the standalone.conf, restarted the JBoss and it worked fine. Now, the first message shows the name I specified, and the second message does not appear, nor the exception.

Failed to restart after installed APOC Plugin in Neo4j

I would like to install the APOC plugin for Neo4j. However once generated jar file and restart, neo4j not able to restart again
Follow Guide
https://github.com/neo4j-contrib/neo4j-apoc-procedures/tree/3.1
Error msg:
ERROR Failed to start Neo4j: Starting Neo4j failed: Component ' org.neo4j.server.database.LifecycleManagingDatabase#3b6579d6' was successfully initialized, but failed to start. Please see attached cause exception. Starting Neo4j failed: Component ' org.neo4j.server.database.LifecycleManagingDatabase#3b6579d6' was successfully initialized, but failed to start. Please see attached cause exception.
org.neo4j.server.ServerStartupException: Starting Neo4j failed: Component 'org.neo4j.server. database.LifecycleManagingDatabase#3b6579d6' was successfully initialized, but failed to sta rt. Please see attached cause exception.
at org.neo4j.server.exception.ServerStartupErrors.translateToServerStartupError(Serv erStartupErrors.java:68)
at org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:227)
at org.neo4j.server.ServerBootstrapper.start(ServerBootstrapper.java:91)
at org.neo4j.server.ServerBootstrapper.start(ServerBootstrapper.java:68)
at org.neo4j.server.CommunityEntryPoint.main(CommunityEntryPoint.java:28)
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.server.databa se.LifecycleManagingDatabase#3b6579d6' was successfully initialized, but failed to start. Pl ease see attached cause exception.
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:4 43)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:107)
at org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:199)
... 3 more
Caused by: java.lang.RuntimeException: Error starting org.neo4j.kernel.impl.factory.GraphDat abaseFacadeFactory, /root/NEO4J_HOME/data/databases/graph.db
at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.initFacade(GraphDatabase FacadeFactory.java:193)
at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.newFacade(GraphDatabaseF acadeFactory.java:124)
at org.neo4j.server.CommunityNeoServer.lambda$static$0(CommunityNeoServer.java:57)
at org.neo4j.server.database.LifecycleManagingDatabase.start(LifecycleManagingDataba se.java:89)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:4 33)
... 5 more
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.impl.p roc.Procedures#2200fd80' was successfully initialized, but failed to start. Please see attac hed cause exception.
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:4 43)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:107)
at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.initFacade(GraphDatabase FacadeFactory.java:189)
... 9 more
Caused by: org.neo4j.kernel.api.exceptions.ProcedureException: Unable to register procedure, because the name `apoc.algo.betweenness` is already in use.
at org.neo4j.kernel.impl.proc.ProcedureRegistry.register(ProcedureRegistry.java:81)
at org.neo4j.kernel.impl.proc.Procedures.register(Procedures.java:103)
at org.neo4j.kernel.impl.proc.Procedures.register(Procedures.java:76)
at org.neo4j.kernel.impl.proc.Procedures.start(Procedures.java:209)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:4 33)
... 11 more
the jar file name: apoc-3.1.0.4-SNAPSHOT-al.jar
neo4j version: 3.1.1
The stacktrace says: "the name apoc.algo.betweenness is already in use". So, perhaps you forgot to remove a previous APOC jar file from the plugins directory.