Apache James 3 unexpectedly quits after few seconds - jaxb

I always get this whenever I try to add domain
Error connecting to remote JMX agent : Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
java.net.ConnectException: Connection refused (Connection refused)]
usage: java org.apache.james.cli.ServerCmd --host <arg> <command>
-h,--host <arg> node hostname or ip address
-p,--port <arg> remote jmx agent port number
AddUser <username> <password>
RemoveUser <username>
ListUsers
Although I discovered that James quits some seconds after starting, I have jaxb jar file, I have put it in every lib folder there is to put.
Is there anything I am doing wrong? Am I to specify input mysql details and if so where, I can't seem to figure this out.

Related

Just installed mongodb cant connect to server on Ubuntu 22.04

I just completed an installation of mongodb in my computer and, after starting and enabling it I keep getting the same error:
MongoDB shell version v4.2.23
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
2022-11-10T16:25:32.787+0100 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect#src/mongo/shell/mongo.js:353:17
#(connect):2:6
2022-11-10T16:25:32.788+0100 F - [main] exception: connect failed
2022-11-10T16:25:32.788+0100 E - [main] exiting with code 1
I uninstalled and installed multiple times and tried solutions that worked for other people in similar posts but I can not make it work.
I have a feeling it have something to do with the port it is looking for (27017) but I do not know how to check if that is the problem and, if so, how to fix it.
Thanks!
Here are a few things to consider:
Check if the MongoDB process is running (you can verify using ps, netstat (check listen port) command in the server.
See if your MongoDB service runs locally. That is because by default, the listen address of MongoDB is localhost/loopback.
Check if the firewall is running and you have allowed the port.
Verify if you are able to use telnet to command the port 27017 from the application server.

connect to DB from nb: could not translate host name to address error

I'm having trouble connecting to a DB from a jupyter nb on a mac.
psycopg2 complains about an OperationalError. My code:
import sqlalchemy as db
# build connection string
connection_string = f"postgresql://{db_cred['username']}:{db_cred['password']}#{db_cred['host']}/{db_cred['database']}"
# create engine
engine = db.create_engine(connection_string)
# connect
conn = engine.connect()
returns
OperationalError: (psycopg2.OperationalError) could not translate host name "db.production.info" to address: nodename nor servname provided, or not known
Needless to say, the DB credentials are correct. The documentation on these errors isn't very helpful, and most proposed solutions revolve around Docker, which I'm not using in this case.
The only exception was this thread, which proposes using the IP address instead of the host name. I did that, and get the following different error:
OperationalError: (psycopg2.OperationalError) connection to server at "192.XXX.XX.XX", port XXXX failed: Connection refused
Is the server running on that host and accepting TCP/IP connections?
Any idea what am I doing wrong?
So the problem turned out to be that an SSH tunnel was necessary.
From a shell script, execute the command:
ssh -L 9999:db.production.info:[port number] -N [username]#192.XXX.XX.XX
this will tunnel db.production.info:[port number] to your localhost on port 9999.
You can then adapt the connection string as
'postgresql://username:password#localhost:9999/[the DB name]'

Cron job "connection refused"

I have a daily cron job which is supposed to restart a server (which listens on port 8443) at 4am if a configuration file has been updated. The command it executes works successfully if executed from the command line. When run as a cron job, it shuts down the server successfully but then fails to restart it, reporting a "connection refused" error:
java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
To try and track this down, I edited crontab to run the job one minute in the future. There is nothing reported in /var/log/syslog:
Jul 5 10:31:39 foo crontab[20375]: (user) END EDIT (user)
Jul 5 10:33:01 foo cron[535]: (user) RELOAD (crontabs/user)
Jul 5 10:33:01 foo CRON[20381]: (user) CMD ($HOME/my-server restart >>$HOME/my-server.log)
I have a chain containing a REJECT rule in iptables, but it also has a LOG rule which logs all rejections, so that doesn't look like what's causing this.
Does anyone have any ideas?

CArtAgO java.rmi.ConnectException Connection refused in a distributed environment

I am trying to connect remotely to a JaCaMo application by CArtAgO infrastructure.
In the server my jcm file is like this:
mas testsvr {
agent bob
workspace world
platform: cartago(infrastructure)
class-path: lib // java class path
asl-path: src/agt, src/agt/inc // agent source path
}
And a client application is like this:
mas testclient {
agent alice
platform: cartago()
node n1 running # 10.0.0.14
class-path: lib // java class path
asl-path: src/agt, src/agt/inc // agent source path
}
When I've run with a server listening I got the following output:
CArtAgO Http Server running on http://127.0.1.1:3273
Jason Http Server running on http://127.0.1.1:3272
Looking for rmi://10.0.0.11/cartago_node
java.rmi.ConnectException: Connection refused to host: 127.0.1.1; nested exception is:
java.net.ConnectException: Connection refused
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:130)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:227)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:179)
at com.sun.proxy.$Proxy6.join(Unknown Source)
at cartago.infrastructure.rmi.CartagoInfrastructureLayer.joinRemoteWorkspace(CartagoInfrastructureLayer.java:62)
at cartago.CartagoService.joinRemoteWorkspace(CartagoService.java:372)
at cartago.NodeArtifact.joinRemoteWorkspace(NodeArtifact.java:99)
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:497)
at cartago.ArtifactOpMethod.exec(ArtifactOpMethod.java:39)
at cartago.Artifact.doOperation(Artifact.java:407)
at cartago.Artifact.access$200(Artifact.java:32)
at cartago.Artifact$ArtifactAdapter.doOperation(Artifact.java:1275)
at cartago.WorkspaceKernel.serveOperation(WorkspaceKernel.java:1136)
at cartago.WorkspaceKernel.access$000(WorkspaceKernel.java:48)
at cartago.WorkspaceKernel$EnvironmentController.run(WorkspaceKernel.java:1477)
When I've run without a server listening the output was:
CArtAgO Http Server running on http://127.0.1.1:3273
Jason Http Server running on http://127.0.1.1:3272
java.rmi.ConnectException: Connection refused to host: 10.0.0.11; nested exception is:
java.net.ConnectException: Connection refused
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:342)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Naming.java:101)
at cartago.infrastructure.rmi.CartagoInfrastructureLayer.joinRemoteWorkspace(CartagoInfrastructureLayer.java:58)
at cartago.CartagoService.joinRemoteWorkspace(CartagoService.java:372)
at cartago.NodeArtifact.joinRemoteWorkspace(NodeArtifact.java:99)
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:497)
at cartago.ArtifactOpMethod.exec(ArtifactOpMethod.java:39)
at cartago.Artifact.doOperation(Artifact.java:407)
at cartago.Artifact.access$200(Artifact.java:32)
at cartago.Artifact$ArtifactAdapter.doOperation(Artifact.java:1275)
at cartago.WorkspaceKernel.serveOperation(WorkspaceKernel.java:1136)
at cartago.WorkspaceKernel.access$000(WorkspaceKernel.java:48)
at cartago.WorkspaceKernel$EnvironmentController.run(WorkspaceKernel.java:1477)
So, it shows that the client found the server but something wrong happened and the connection was refused. What is happening? Which is the default CArtAgO's connection port?
CArtAgO uses Java RMI, the default port is 20100. For LipeRMI connection the default port is 20101. Other constants can be checked in http://www.emse.fr/~boissier/enseignement/maop17-spring/doc/api/cartago-api/index.html?constant-values.html
It is suggested to leave server and client with no restrictions checking whether iptables INPUT, FORWARD and OUTPUT are showing ACCEPT for any case. You can use the following command:
$ iptables -L -v
On linux with JaCaMo application running you can see if the port 20100 was opened by the app (you can use ss or netstat). The response should be "LISTEN" for 20100 port
$ ss -tnl | grep 20100
or
$ netstat -tuplen | grep 20100
It is also necessary to have DNS working for the machines because the connection will use names. You may test it by command ping using machine names. From clients:
$ ping name_server
From server (ping clients)
$ ping name_client1
In case of no DNS server to solve names, it is necessary to edit /etc/hosts file. Considering the server named 'myserver_hostname' on ip 192.168.0.1 and client named 'myclient_hostname' on ip 192.168.0.2, the file on both machines, server and client, may be like this:
127.0.0.1 localhost
#127.0.1.1 myserver_hostname -- RMI will not use it anymore
192.168.0.1 myserver_hostname
192.168.0.2 myclient_hostname

Chef-server-ctl reconfigure/ Creating Admin User on chef server

I am fairly new to Linux (and brand new to chef) and I have ran into an issue when setting up my chef server. I am trying to create an admin user with the command
sudo chef-server-ctl user-create admin Admin Ladmin admin#example.com
examplepass -f admin.pem
but after I keep getting this error:
ERROR: Connection refused connecting...
ERROR: Connection refused connecting to https://127.0.0.1/users/, retry 5/5
ERROR: Network Error: Connection refused - Connection refused
connecting to https://..., giving up
Check your knife configuration and network settings
I also noticed that when I ran chef-server-ctl I got this output:
[2016-12-21T13:24:59-05:00] ERROR: Running exception handlers Running
handlers complete
[2016-12-21T13:24:59-05:00] ERROR: Exception
handlers complete Chef Client failed. 0 resources updated in 01 seconds
[2016-12-21T13:24:59-05:00] FATAL: Stacktrace dumped to
/var/opt/opscode/local-mode-cache/chef-stacktrace.out
[2016-12-21T13:24:59-05:00] FATAL: Please provide the contents of the
stacktrace.out file if you file a bug report
[2016-12-21T13:24:59-05:00] FATAL:
Chef::Exceptions::CannotDetermineNodeName: Unable to determine node
name: configure node_name or configure the system's hostname and fqdn
I read that this error is due to a prerequisite mistake but I'm uncertain as to what it means or how to fix it. So any input would be greatly appreciated.
Your server does not have a valid FQDN (aka full host name). You'll have to fix this before installing Chef server.

Resources