java.lang.NullPointerException: Cannot get property 'controller' on null object - jenkins

I am using the Jenkins-as-a-Configuration tool to launch my Jenkins server but when I port-forward to my local host on port 8080 and try accessing the server, I am greeted with the error java.lang.NullPointerException: Cannot get property 'controller' on null object. Not sure why this is suddenly happening as I have been able to access it prior.

Related

Error querying artifacts: An existing connection was forcibly closed by the remote host

I got the script that just needs to be runned, but it throws some errors.
artifactUrl already exists, script shouldn't be a problem
Console:
Console
I should've got a new container with url and other specs. I need it for local sever for Dynamics BC.

Run testcontainer test OK in local environment but failed in jenkins

Background
In my application, it needs to connect to zookeeper to get some useful information. So I start a zookeeper container in my integration test with port binding like -p 2859:2181.
zookeeper = new GenericContainer<>("zookeeper:3.6.1")
.withEnv("ZOOKEEPER_CLIENT_PORT", "2181")
.withExposedPorts(2181);
zookeeper.setPortBindings(Arrays.asList("2859:2181"));
zookeeper.start();
Then I use the following command to run the test. It goes smoothly connecting to localhost:2859 without any problems.
mvn -Dtest=xxxIntegrationTest.java test
Problem
However, when I use jenkins to run the same test with same command, it cannot connect to localhost:2859, complaining that
2020-10-28 12:16:04.282 INFO [main-SendThread(localhost:2859)] Opening socket connection to server localhost/127.0.0.1:2859. Will not attempt to authenticate using SASL (unknown error)
2020-10-28 12:16:04.283 WARN [main-SendThread(localhost:2859)] Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:350)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1068)
I don't know why it behaves differently in these two senarios. Could anyone give me some suggestions?

ActiveMQ Artemis GUI Jolokia access in docker container

I'm running ActiveMQ Artemis inside of docker containers for our three environments (DEV/QA/PROD).
The management console typically runs on port 8161 and so I included this in the artemis create statement when I created the broker.
--http-host 0.0.0.0 --http-port 8161
So this causes the following two changes that I can see:
bootstrap.xml gets the host/port:
<web bind="http://0.0.0.0:8161" path="web">
<app url="redhat-branding" war="redhat-branding.war"/>
<app url="artemis-plugin" war="artemis-plugin.war"/>
<app url="dispatch-hawtio-console" war="dispatch-hawtio-console.war"/>
<app url="console" war="console.war"/>
</web>
jolokia-access.xml gets the host/port:
<allow-origin>*://0.0.0.0*</allow-origin>
I'm trying to access the ActiveMQ Artemis Hawtio management console from a remote computer, but the exposed docker ports are not 8161. They're the mapped ports 38161, 48161, & 58161.
So when I login to the management console, I get:
Operation unknown failed due to: java.lang.Exception : Origin http://10.0.20.2:58161 is not allowed to call this agent
Uncaught TypeError: Cannot read property 'apply' of undefined (http://10.0.20.2:58161/console/app/app.js:16:14127)
Uncaught TypeError: Cannot read property 'apply' of undefined (http://10.0.20.2:58161/console/app/app.js:16:14127)
...
I believe the problem here is that your jolokia-access.xml using this:
<allow-origin>*://0.0.0.0*</allow-origin>
However, you're attempting to access the console via http://10.0.20.2:58161 which isn't allowed based on your jolokia-access.xml. Therefore you need to change the jolokia-access.xml to allow the IP:port you're actually going to use to connect.
You can read more about the jolokia-access.xml in the Jolokia security documentation.
For clarity's sake, the meta-address 0.0.0.0 is basically the "no particular address" placeholder and in the context of binding a listener to a network interface it means the listener should bind/listen to all interfaces. However, in the context of <allow-origin> for Jolokia security it doesn't mean allow all origins. The <allow-origin> supports literal matches and wild-cards (as noted in the documentation linked above). Therefore, if 0.0.0.0 is specified it attempts to literally match 0.0.0.0. There is no way to disable Jolokia security from the create command. If you were to pass something like --http-host 10.0.20.* to the create command then 10.0.20.* would be used to bind the webserver in bootstrap.xml which would fail.
There is the option of using --relax-jolokia which will disable strict checking which may help your use-case.
Just you need to make change on the jolokia-access.xml file to edit cors :
<allow-origin>*://*</allow-origin>
For more information about this you can refert to : https://medium.com/#hasnat.saeed/setup-activemq-artemis-on-ubuntu-18-04-76bb4975308b

getting java.net.SocketException: Invalid argument:inside docker container

I have a java program that runs inside a docker container.
This program tries to connect to a Ipv4 socket.
I get the following Invalid argument exception
Caused by: java.net.SocketException: Invalid argument: /135.250.15.104:6524
at sun.nio.ch.Net.connect0(Native Method)
at sun.nio.ch.Net.connect(Net.java:454)
at sun.nio.ch.Net.connect(Net.java:446)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:648)
at io.netty.channel.socket.nio.NioSocketChannel.doConnect(NioSocketChannel.java:209)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.connect(AbstractNioChannel.java:199)
at io.netty.channel.DefaultChannelPipeline$HeadContext.connect(DefaultChannelPipeline.java:1089)
at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:543)
at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:528)
at io.netty.handler.ssl.SslHandler.connect(SslHandler.java:415)
at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:543)
at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:528)
at io.netty.channel.ChannelOutboundHandlerAdapter.connect(ChannelOutboundHandlerAdapter.java:47)
at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:543)
at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:528)
at io.netty.channel.DefaultChannelPipeline.connect(DefaultChannelPipeline.java:914)
at io.netty.channel.AbstractChannel.connect(AbstractChannel.java:208)
at io.netty.bootstrap.Bootstrap$2.run(Bootstrap.java:167)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:357)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
Now I have tried setting -Djava.net.preferIPv4Stack=true JVM option, but no luck.
I am using open-jdk 8 and from java:openjdk-8u72-jre is the entry in my DockerFile .
Note that the same IP address is ping-able from the docker container.
The problem was solved when I used --net=host see docker reference in my docker run command and network_mode : "host" in my docker-compose file see compose reference.
Also see a related stackoverflow post.
The problem seems to get exposed only when the socket connection uses a per-defined local socket address instead of letting the NIO choose a free local address.
But the exception stack trace says "Invalid argument" for the remote address which kind of is weird and that is why it took time for me to figure out the problem.

start elasticmq server and access it

I have started elasticmq server which runs in my localhost. But when I access it with the browser localhost:9324 it is showing error message as
Request is missing required form field 'Action'
So how can I access it in the browser. Please help.

Resources