Glassfish domain reported as not running although it is started - java

I’m using glassfish 3.1.2 on Red Hat Enterprise Linux Server release 5.7 (Tikanga). Glassfish has been installed as part of a piece of bigger software (that I’m developing). It used to work correctly in the past.
I can issue a ‘start-domain’ command. This one will work correctly and glassfish will start. I can see the process and the glassfish admin web console is working fine. However, the command ‘list-domain’ reports my domain as not running. The command ‘stop-domain’ will fail reporting the domain1 as already stopped. This prevents my software to run properly.
As far as I know, nothing has changed on that system. There is no exception/error in the log. I already search the internet for description of similar behaviour. I ensured the embedded firewall (the one coming with the OS) did not prevent the communication. I removed the expired certificate (just in case). I have no idea on what I could do next.
What could I check? Any help appreciated. Add a comment if you need specific details and I will update the question.
Answer to unwichtich's questions:
absolute path to jvm using an absolute path to the admin-cli.jar: /.../java -Duser.home=... -Duser.language=en -Dhttps.protocols=TLSv1.2 -jar /.../glassfish/modules/admin-cli.jar --terse --port 23992 --user admin --passwordfile /.../passwordfile list-domains
There are two lines in the /etc/hosts. The first with the ip mapping to the hostname. The second with 127.0.0.1 mapping to loopback and localhost
My software includes some command line utilities that need to perform operation on Glassfish (like start-domain, stop-domain, list-domains,...).

Related

Jetty web server refusing connections on linux

I am in the process of developing a java web application, and am using the web framework Spark which utilizes Jetty (An http server written in java created by eclipse). Spark makes use of Jetty's embedded webserver functionality, essentially creating a Jetty instance within the app. When creating an executable jar of my application and running on windows, all is well and I can connect to my app locally through http://localhost:81 (I am using port 81). Eventually, I'd like the app to run on a linux server, but upon executing the jar on ubuntu, I am unable to connect to the app locally. I only have a moderate understanding of linux, and cannot figure out why this is happening. I am executing the command 'java -jar G2.jar &' in screen, and it seems to be executing properly. I have ensured that the JDK on ubuntu matches the version installed on my windows machine. I have been testing on an AWS ec2 ubuntu instance and an ubuntu vm, and have had no luck on either.
wget:
wget 127.0.0.1:81
--2016-10-24 21:10:24-- http://127.0.0.1:81/
Connecting to 127.0.0.1:81... failed: Connection refused.
curl:
curl 127.0.0.1:81
curl: (7) Failed to connect to 127.0.0.1 port 81: Connection refused
I have flushed iptables, and even disabled ufw with no luck. Both the ec2 instance and vm are fresh ubuntu installs. I am beginning to think the problem is within Jetty, and that it possibly requires different configuration on linux? The issue is, Spark handles the embedded Jetty instance, and I am unfamiliar with how it does so. Has anybody dealt with this type of issue before?
I fixed the issue. I figured that using the '&' at the end of the command to run the app as a background process would work fine, but guess it does not. Instead, I just used sudo without the '&' and it works now.

The Eclipse plugin cannot communicate with the GlassFish server

I need use Glassfish in a project we're currently working on in Eclipse IDE.
My problem is after installing Glassfish Tools in Eclipse I manage to correctly create a new glassfish server en SERVERS tab but when I try to start it the following error message pop up:
The Eclipse plugin cannot communicate with the GlassFish server....
The Eclipse plugin cannot communicate with the GlassFish server. A
GlassFish Enterprise Server may be running on the same admin or HTTP
port, but with a different root installation.Please also check for
antivirus software, firewall configuration, or VPN setup which might
block some ports.
Actually the problem looks more complex since not only I'm not able to start server but I cannot execute any action on server. Neither deploying, nor clean or whaterever else do work resulting in popping up the above message.
In the internet developers communities I only find clues about CREDENTIAL ERROR but this is not the case.
Looking in the Glassfish log folder there is no trace of any access attempt.
Everythings points at Eclipse plug-in neither be able to communicate with glassfish by any circumstance.
This issue occours either with Glassfish 3.1 (using jdk1.7) and 4.1 (using jdk1.8) and in Eclipse Luna and Mars.
I already tried to create, delete and manage glassfish domains (as suggested in other questions here at StackOverflow) to get over potential "credential-related" issues but no result.
Tried to uninstall and reinstall Glassfish Tools from Eclipse too but still no way.
Both Glasshfish 3.1 an 4.1 start flawlessly manually and NetBeans manage to start them without any problem but, as said, I need to work with eclipse so switching to NetBeans is not the solution (and, please, don't suggest me a manual deploy and server start).
As a last attempt, since I work in Windows, in a console window I tried this:
netstat -a -b
to verify no other service is "taking" port 8080 (although it doesn't seem to be a port problem but a "plug-in communication" one) but it resulted free.
I'm into this mess by days.
Please help.
Thank you
I had exactly the same problem. When I set "preserve sessions across redeployment" in the Eclipse properties dialog for GlassFish, tab "GlassFish", to false (true being the default), everything worked out fine.
I just set the proxy configuration in Eclipse menu Window -> Preferences -> General -> Network Connections (changing the Active Provider value from "Native" to "Manual" and inserting all the needed values for HTTP and HTTPS rows) and added "localhost" and "127.0.0.1" to the section "Proxy bypass".
I have faced the same problem. Generally, the programs that get dynamicly port numbers causes this. Etc: skype, teamviewer.
For me, I solved the problem with starting eclipse before them.
Maybe this works for you too.
I had the same problem, and I solved it by removing the glassfish server from Eclipse, and adding it again.
What I noticed in my own case was that other applications where using port number 4848, so I had to stop all use of port 4848 and restart the domain again ( restart glassfish server )

Tomcat debugging not possible through eclipse

I've made a script called debug.sh and placed it under the bin directory (start it with ./debug.sh) to start Tomcat 8 in debugging mode:
set JPDA_ADDRESS=8000
set JPDA_TRANSPORT=dt_socket
set JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
bash catalina.sh jpda start
But if it started, there is now message which says, that Tomcat is listening on port 8000. Also if I type
netstat -nat
there is no application listening on port 8000.
What exact configuration do I have to set, to remote debug my Tomcat 8 server which is running on a specific IP or do I have just a little problem in my script?
This answer has been updated following the comments, I did not understand the problem in the first place.
I guess you have followed that doc: this is about developing Tomcat itself.
I am not sure you are using the proper way to configure the port (I don't know your specific configuration details). In a standard environment, the ports are configured in the server.xml (note that several different ports are used by Tomcat for the different services).
To remotely monitor your server, you should use a JMX client. As far as I know, Eclipse doesn't include one (or at least not one documented) - you could code one as this is a Java specification (JSR262). You have one in a standard Java environement (JConsole). By default, JMX is not enabled on Tomcat. If you need to enable it, the fine way is to follow the doc.
Tomcat JMX monitoring and JConsole are both available in most versions of Tomcat and the Java runtime.
The following exchange seems to be about your problem.

Analyze stand alone Java Application locally for threads

Respected Experts,
I have a stand alone java application and want to monitor the threads created by it. I am planning to use a tool like JConsole or JVisualVM. However, I am not able to connect these tools locally to my Java Application.
I am using Windows machine. JConsole and Java program are running locally. I have tried to run Java application with following JMV arguments with no success:
java -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false LinkedListTest
When I try to connect using JConsole, my process id is greyed and following message appears:
Note: The management agent is not enabled on this process
I think I should be able to connect JConsole to a stand alone java application. Any thoughts what I am missing here
Thanks and Regards
Thanks for the inputs. I was able to solve the problem and the details are as follows:
As #Holger mentioned, both JConsole and JVisualVM can connect to the local Java Application running without any JMX arguments. The problem that I was facing was machine specific. I restarted the machine and deleted the following directory:
%TMP%\hsperfdata_User.Name
(I was not able to delete this directory without doing a restart)
Restarted JConsole/JVisualVM and was able to connect to local java processes using the process id.
In fact, the use of JVisualVM pointed me towards this fix. On start of JVisualVM, I got an error message stating something like local processes/applications can't be monitored. The message had a link to Troubleshooting guide. I am reproducing the relevant snippet:
Local Applications Cannot Be Monitored (Error Dialog On Startup)
Description: An error dialog saying that local applications cannot be monitored is shown >immediately after VisualVM startup. Locally running Java applications are displayed as Application> (pid ###).
Resolution: This can happen on Windows systems if the username contains capitalized letters. In >this case, username is UserName but the jvmstat directory created by JDK is >%TMP%\hsperfdata_username. To workaround the problem, exit all Java applications, delete the >%TMP%\hsperfdata_username directory and create new %TMP%\hsperfdata_UserName directory.
However, on my machine directory had the following format:
%TMP%\hsperfdata_User.Name
So, my recommendations are:
-check the name of the above mentioned directory for presence of camel case user name
-If not, follow the steps from the Trouble Shooting guide
-If the problem persists, delete the directory (may require machine reboot, as in my case)
-Restart JConsole/JVisualVM
Hopefully, the problem would be resolved.
Thanks and Regards

What is Tomcat Running?

I'm trying to see if a WAR I just built is even running inside of Tomcat (7.0.19). I am deploying to a linux box and so my only two options are the Tomcat admin console (web app) or, hopefully, determining webapp status through the terminal.
I already know how to get in through the console web app; I am wondering if there is any way to see the status (ACTIVE/INACTIVE/TERMINATED, etc) of deployed web apps from the terminal.
Thanks in advance.
PSI-Probe is a great application for monitoring your applications deployed to a tomcat instance. It will tell you if an application is running or down. If the application is not deployed, it will simply not be in the list.
curl --user user:pass http://localhost:8080/manager/text/list
It prints
OK - Listed applications for virtual host localhost
/manager:running:0:manager
/docs:running:0:docs
/examples:running:0:examples
/host-manager:running:0:host-manager
/myapp:running:0:myapp
Your user needs the manager-script role. Documentation: Manager App HOW-TO, List_Currently_Deployed_Applications
You can probably do it using JMX.
Find appropriate MBean that shows this information on local tomcat using regular JConsole. If you want to connect JConsole to remote you will probably have some problems with firewall, so you have other solution.
Take command line JMX client and run it on the monitored host through SSH terminal. I used the following command line JMX client: cmdline-jmxclient-0.10.3.jar
wget http://<username>:<password>#<hostname>:<port>/manager/list -O - -q
(Not sure about Tomcat 7 though)

Categories