Glassfish: There is no cluster named localhost in this domain - java

I am new to glassfish and java ee programming. I am using Netbeans. When I try to deploy my web application to glassfish server, my project output shows
The module has not been deployed.
And in the glassfish server log:
WARNING: There is no cluster named localhost in this domain.
SEVERE: There is no instance named localhost in this domain.
Any comment would be helpful. thanks guys.

In glassfish/domains folder is there a domain called domain1 (default name). if not you need to create a new domain. if there is one then make sure under glassfish/domains/domain1 a file domain.xml points to all instances of localhost

Related

Two war files deployed in same docker container is not accessible

I have deployed two war file in docker container, say app1.war and app2.war. app1.war is calling internally app2.war to access few services. I am able to access service in app1.war from browser and internally when app1.war tries to call service in app2.war I am getting following error
I am using Apache server and each request will be first hit to apache server and then directed to the services running in container. Apache server is running in my host as a service.
I have created Dockerfile by taking tomcat as base and copied app1.war and app2.war in webapps folder and expose port is 8080
and build image as
docker build -t myapp .
execute it as
docker run -it -p 9999:8080 myapp
http://localhost:9999/app1/service1 ----- this is accessible and this URL is internally calling a service which is deployed in app2 http://localhost:9999/app2/calculation
on hitting http://localhost:9999/app2/calculation URL I am getting below error
Connection error for URL[http://localhost/app2/calculation/]. Exception: [I/O error on POST request for "http://localhost/app2/calculation/": Connect to localhost:80 [localhost/127.0.0.1] failed: Connection refused (Connection refused); nested exception is org.apache.http.conn.HttpHostConnectException: Connect to localhost:80 [localhost/127.0.0.1] failed: Connection refused (Connection refused)].
I am looking for a solution for this issues and want to know where exactly the issue is. Any response is highly appreciated.
Your app2 deployed on Tomcat is exposed on port 8080 within the container, not 9999. Therefore, you're getting error when trying to access it on port 9999 from within the container. If you change internal endpoint to 8080 for app2, it should work.
Now, deploying 2 war files on the same Tomcat like this is actually an anti-pattern in containerized world. The usual architecture would be to have 2 separate images/containers, each having its own war file.

Running multiple Spring boot executable jars on self contained server as Linux services

I have deployed my first spring boot web application executable jar in self contained tomcat server successfully and accessing it on port 8080 but when I deployed my second app on different port using init.d on port 42000 I am unable to access it. I have looked the log in /var/log the application starts successfully without any errors. What would be the causes for my problem?

Trying to run Glassfish server on OpenShift in a DIY cartridge

I'm trying to run Glassfish on OpenShift in a DIY cartridge and I have a problem because I'm receiving an error saying that I can't bind the port 8080.
I have been talking with Openshift support and they have told me that I must remove a ruby file that is binding the 8080 port.
Error:
[#|2015-04-21T17:58:27.887-0400|SEVERE|glassfish3.1.2|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=1;_ThreadName=main;|Shutting down v3 due to startup exception : Permission denied: 8080=com.sun.enterprise.v3.services.impl.monitor.MonitorableSelectorHandler#15ac5d5|#]
I think that I have done this, because I have removed a .rb file in the git directory but the problem persists.
Does anyone have any suggestions?
You need to make sure that your glassfish server is binding to port 8080 on your gear's ip address, which is your OPENSHIFT_DIY_IP environment variable.

Moskito inspect monitoring tool integration with Java web application issue

I have an issue setting up an rmi port on Apache Tomcat server
(set JAVA_OPTS=%JAVA_OPTS% -DlocalRmiRegistryPort=9401)
Here are the steps i have done and getting the error respectively.
Issue with MoSKito tool while configuring RMI port on Tomcat
I am also tried to configure MoSkito inspect on my java web application. as part of it, i have been trying to make RMI port using "set JAVA_OPTS=%JAVA_OPTS% -DlocalRmiRegistryPort=9401" on catalina.bat. there is no error as such but 9401 is not getting connected.
Steps followed:
1) My OS is Windows 7
2) I have installed Apache Tomcat v7
3) I have downloaded Moskito inspect .war file from http://www.moskito.org/download.html and
4) Installed Moskito inspect on my tomcat server, the MoSKito inspect web UI is loading good.
5) I have created a sample java web application and deployed on same tomcat server. and web application also working good.
6) Now i have taken step to configure RMI port 9041 using below command on \bin\catalina.bat file(since i am on Windows OS).
I have put the below command on top of the file in \bin\catalina.bat
set JAVA_OPTS=%JAVA_OPTS% -DlocalRmiRegistryPort=9401
7) and started tomcat server, and then opened Moskito application on browser and gone to Quick Connect option on and given localhost and rmi port 9401 to call remote invocation.
Its failed.... its always giving error as MoSKito encountered an error:
Cannot connect to localhost#localhost:9401, due: Can not resolve manually set reference. Server at localhost, port: 9401 is down or not properly configured
[net.anotheria.moskito.webui.util.APILookupUtility.findRemote(APILookupUtility.java:168), net.anotheria.moskito.webui.util.APILookupUtility.findRemote(APILookupUtility.java:142), net.anotheria.moskito.webui.util.APILookupUtility.getAdditionalFunctionalityAPI(APILookupUtility.java:113),
Q1: How to set -DlocalRmiRegistryPort=9401 on tomcat on Windows OS.
Q2: Once we set port, how to ensure port is set properly and its up and ready state for connection.
Q3: Once port is set properly, then how to set / configure specified java web application needs to be configured for MoSKito, since we could have more than one java web application on same tomcat server.
Please guide me, thank you :)
in order to be able to connect to a MoSKito monitored application you have to enable an agent that binds itself to port 9401 and answers your replies. To do so, you have to add a dependency to your pom (if you are using maven):
<!-- Enabling MoSKito Inspect Embedded -->
<dependency>
<groupId>net.anotheria</groupId>
<artifactId>moskito-inspect-remote</artifactId>
<version>${moskito.version}</version>
</dependency>
Please keep in mind that the current MoSKito version is 2.5.4
If you are using a servlet 3.0 compatible container (tomcat 7, jboss wildfly) you are done. If you are using an older container you may need to add following to your web.xml:
<listener>
<listener-class>net.anotheria.moskito.webui.embedded.StartMoSKitoInspectBackendForRemoteListener</listener-class>
</listener>
If you are using no container at all, you can start it manually:
net.anotheria.moskito.webui.embedded.StartMoSKitoInspectBackendForRemote.startMoSKitoInspectBackend()
Now for you questions:
Q1: via catalina.bat. You were doing it correctly.
Q2: if the agent is configured everything will work correctly.
Q3: You may want to check out step by step guide here:
http://blog.anotheria.net/msk/the-complete-moskito-integration-guide-step-1/
Regards
Leon

Tomcat home page is not coming properly

After installing Apache tomcat8 I am getting below home page.
I just installed tomcat8, start service and hit url
http://localhost:8080/
I haven't created any project.
It looks to me that the page in your screenshot is being served up by Oracle Application Express (APEX), not Tomcat.
APEX typically uses port 8080, and if you started this before starting Tomcat, Tomcat will be unable to use port 8080. To confirm that this is the case, take a look in your Tomcat stderr log file (it should be under C:\Tomcat 8.0\logs and have a name like tomcat8-stderr.2014-09-21.log). It will quite probably contain an exception whose stacktrace begins as follows:
21-Sep-2014 12:09:15.607 SEVERE [main] org.apache.coyote.AbstractProtocol.init Failed to initialize end point associated with ProtocolHandler ["http-nio-8080"]
java.net.BindException: Address already in use: bind
at sun.nio.ch.Net.bind0(Native Method)
I would recommend that you change Tomcat to use another port. To do this, open your server.xml file (in C:\Tomcat 8.0\conf\). There should be a Connector element in here with an attribute port="8080": change this port number to 8081 (say) and restart Tomcat.
Ok, try this
1- Download a tomcat version.
2- unzip it in a folder. (let say C:\Java)
3- open a command prompt window
4- Type C:\Java\ your tomcat installation \bin\startup.bat
5- Access http://localhost:8080
Looks like you have not started tomcat yet.
Are you sure you have followed a guide like this ?

Categories