Deploy webapp project on tomcat instead of glassfish in Netbeans - java

I have been trying to deploy my project on a Tomcat server but I keep getting this message on Netbeans
Could not start GlassFish Server: HTTP or HTTPS listener port is
occupied while server is not running
I have already tried to shutdown and remove Glassfish but it keeps printing the same message.

Just ran into the answer
Choose your NetBeans project > properties > run > server > (select) Apache Tomcat or TomEE

Related

Deploying the frontend(ReactJS) and backend(SpringBoot) build on the Tomcat server

I have deployed the frontend (ReactJS) and backend build(war) on the Tomcat server in the ubuntu machine.
I copied both build in /var/lib/tomcat/webapps folder.
In ReactJS source code I have added
Pckage.json: "homepage": "http://localhost:8080/buildFolderName"
Index.js: axios.defaults.baseURL = 'https://serverUrl/warfilename/api/'
For this configuration, my application is working fine.
But when we are replacing the serverUrl to localhost:8080 the frontend application is not communicating with the backend APIs.
Showing the error on the browser console: net::ERR_CONNECTION_REFUSED
We want to deploy the same build on a deferent tomcat server rather than creating a build for each server

Not able to debug webservice using eclipse

i have tried the webservice example mentioned in the below link.
https://codezone4.wordpress.com/2012/11/08/restful-web-services-java-mysql-and-json/.
i build the application with maven deployed in tomcat then clicked on the webservice link in the chrome , not able to access my code.
Now i tried to debug with postman .
I clicked on my webservice class -> then debug -> debug configiuration
then i selected remote application
there values of host and port are
Host : localhost
Port : 8080
then it is showing establishing connection for long time and after that it is showing Failed to connect to remote vm .connection timedout
Can you please guide me how to make deugger working in eclipse to debug the rest api call.
I can find quick solution (In Windows Environment with local host):
1) Download tomcat in your favorite drive (E.g. d: drive)
2) Open startup.bat file under tomcat/bin folder in notepad
3) Replace following line (Which appear at the end of file)
call "%EXECUTABLE%" start %CMD_LINE_ARGS%
with
call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%
4) Restart your tomcat as it will start with listening port 8000
5) Open Eclipse->"Run"->"Debug configuration"-> Create "Remote Java Application" and provide following information:
Name: sample-name
Project: your project folder
6) Click on Debug button
Note: Make sure Connection properties will have
Host: localhost
Port: 8000
7) Put debug point in your code
8) Open Postman and Hit sample REST API call as you will see the debug point will appear in your code
That's It!
Quoting from your query,
clicked on my webservice class -> then debug -> debug
The project you created requires the restApplication to be deployed on a running server.
Prior To Testing -> check http://localhost:8080 is up or not, and then publish the war into the server.
choose Debug As-> Debug on Server

java web application with glassfish server not getting deployed

When I run my web project with glassfish server 4.1 , it says module has not been deployed.
GlassFish Server 4.1 is running.
Starting GlassFish Server 4.1
In-place deployment at /Users/shobhnit/NetBeansProjects/WebApplication3/build/web
GlassFish Server 4.1, deploy, null, false
/Users/shobhnit/NetBeansProjects/WebApplication3/nbproject/build-impl.xml:1045: The module has not been deployed.
See the server log for details.
BUILD FAILED (total time: 1 minute 6 seconds)
My glassfish server is not getting started also :
server log screenshot
glassfish server properties

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

How I can seen my created page of site on my OpenShift?

I try create site on Java with Spring help on OpenShift.
I did some actions:
-Registered an account at OpenShift
-Set it
-Created application 'myapp' with 'Tomcat 7 (JBoss EWS 2.0)' Cartridge
-Cloned it by git
-Edited myapp by NetBeans(made simple index.jsp page which can saw by NetBeans Tomcat Local Server 8.0).
-Pushed this project to OpenShift server by 'git push'(there's this data with changes on the server at this moment)
-Deployed on the server(used 'gear deploy' command)
And now I want seen my page on server but can seen only it:
myapp-masakra.rhccloud.com
what I have to do or change?

Categories