Blank White Screen at localhost:8080 with Tomcat 8 on OSX 10.8.5 - macos

I followed this tutorial exactly: http://examples.javacodegeeks.com/enterprise-java/rest/jersey/jersey-hello-world-example/
But I just see a blank white screen when I go to: http://localhost:8080/JAXRS-HelloWorld/rest/helloWorldREST/JavaCodeGeeks?value=enjoy-REST
I started tomcat by running the command catalina run
Should I be doing something differently to deploy the webapp?

I have just tested the sample application on Tomcat 8 and it works without any issue.
As expected it prints out the below message in the browser when called.
"Hello from: JavaCodeGeeks : enjoy-REST"
There are couple of things that I can think of might causing the problems in your case.
You are missing any of the steps specified in the tutorial.
You are not deploying the "JAXRS-HelloWorld.war" into Tomcat properly.
I hope have setup your CATALINA_HOME properly in order to call the "catalina run" in commadline.
To resolve your problems.
Instead of following the steps in the tutorial, download the attached project and generate the war file as specified and deploy it and see if it works.
To deploy the project in tomcat, you have to copy the "JAXRS-HelloWorld.war" file into $CATALINA_BASE/webapps folder and then start the server.
There are couple of ways to start the Tomcat server. One that you have chosen is the commandlne. To start the Tomcat server from caommandline either you have to change directory(cd $CATALINA_BASE/bin) to Tomcat home bin folder and the call catalina.bat/catalina.sh with run or start command Or set the CATALINA_HOME enviorenment variable and then call the same command from anywhere in your commandline.
Note:
Also check the Tomcat logs for specific issues or errors.

Related

JHipster Spring Boot executable war config not recognized

I am trying to experiment with a JHipster 4.3 app using Hazelcast. I have a setup of 3 Linux/CentOS7 VMs, each with latest 8 131 java/jdk on them. I build my war file for -Pprod and deploy to a dir at:
/var/jhiphaze/jhiphaze-0.0.1-SNAPSHOT.war
I have set this up as a service using systemctl. I am able to start | restart | etc.
I now have a need to debug into the application and would like to start the app up in debug mode. I read in the Spring Boot docs that I can place a file of the same base name with the extension of ".conf" and Spring Boot executable script will read the settings in the conf and start the app up with that. So I have a file:
/var/jhiphaze/jhiphaze-0.0.1-SNAPSHOT.conf
with the following line:
JAVA_OPTS="-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=y"
This has no effect on the run of the war, it starts up fine but does not listen and the console out indicates that the app is not listening on 8787 (or any port).
I also tried on my windows workstation, simply running from cli using:
java -jar jhiphaze-0.0.1-SNAPSHOT.war
in the project /build dir with the jhiphaze-0.0.1-SNAPSHOT.conf placed in the same directory. It is ignored there as well. The same argument in the conf file work at the cli:
java -jar -agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=y jhiphaze-0.0.1-SNAPSHOT.war
works fine, pauses and waits for me to connect. Note that I used suspend=n for most of my attempts as I did not want the service start to fail while waiting for debugger to connect.
How can I get the executable war to recognize its partner .conf file?

Error configuring wildfly as a windows service

I am using wildfly 10.1 in standalone mode and need to use it as a service.
I copied the service files to the bin folder and then installed the service from the command prompt.
This works well, except that it is impossible to stop the service without killing the process using taskkill.
As a fix, I tried replacing
set DESCRIPTION="WildFly Application Server"
with
set DESCRIPTION=WildFly Application Server
in the service.bat file as mentioned here. But this is causing the service not to start. The system log says:
The Wildfly service terminated with the following service-specific
error: Incorrect function.
How can I fix this issue and get the service starting and stoppping normally?
Add System variable JAVA_HOME to System variable and try to start the service. It worked for me.

How to start tomcat server manually

I installed tomcat 7 in my windows 7.Then ran C:\apache-tomcat-7.0.57\binstartup.bat,one window will open for 1 second and closes.when i hit http //localhost/8080 ,its not dsiplaying anything.I just checked C:\apache-tomcat-7.0.57\conf/server.xml and port is 8080.
Can somebody help on this.
Read RUNNING.txt and create C:\apache-tomcat-7.0.57\bin\setenv.bat file that sets JRE_HOME (or JAVA_HOME) path for Tomcat.
Sample from Tomcat 7 RUNNING.txt file using Java 6 JRE:
set "JRE_HOME=%ProgramFiles%\Java\jre6"
exit /b 0
You need to set Java_Home in Cataline.bat first in order to run TomCat server.
Additional Information for running project using Tomcat Server.
You can cd into the folder where tomcatXX/bin is through command line and run "run startup". So, when you , run startup on command line it tries to run script from startup.bat file, probably it crashed because port to be used by TomCat to run server is already in use. If you try to point your url to localhost:8080, if TomCat's home page appears, that would be because your server is already running. You should ideally also try to point to Windows -> Preference -> Runtime Environment. Check if Tomcat server is added in list under Server Runtime Environment window, if not try to add that server by clicking Add button, and trying to locate where Tomcat/bin is stored. If that still doesn't help, I would suggest you to also try right clicking a project on your IDE then click Run As, then click Run Configuration, it will give you option to run application using TomcatServer. List of servers will be found on left side of Run Configuration window.

Unable to debug tomcat server using eclipse

I'm using:
Spring Tool Suite Version: 3.2.0.RELEASE
Tomcat v7.0.42
When I just run my tomcat server everything is fine but I'm unable to debug it even locally. It produces following error:
Startich Apache Tomcat v7.0.42 at localhost has encoutered a problem.
Server Apache Tomcat v7.0.42 bat localhost was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor.
I've tried the following:
increase the timeout.
remove all the apps before starting the debugging.
install new instance of tomcat (the only configuration that I've did on fresh install is turning on Use Tomcat installation and Never publish automatically).
But it didn't help, I still can only run the tomcat, without the debug option. Does anyone know how to make this debugging work?
When I've used new, clear workspace for Spring Tool Suite, debugging started to work.
Cheers,

tomcat debugging

I am working on a project where the backend code is in Java.
I want to debug this code and am running tomcat in the debug mode correctly .
I have the Java code in Eclipse where I set up a new debug config for Remote Java Application and start the debugging.It shows no error but it is not breaking at the breakpoint.
So the Tomcat Webapps folder has only a copy of the Servlet classes and my Java code is in a folder at some other place.
Is this the reason that I am not being able to link them properly
You have to start tomcat with the JPDA options in order to debug remotely. Under *nix, issue "catalina jpda start" instead of "catalina start".
If you want to do a remote debug to figure out a problem in code, then your code locally must be the same. Also remember to connect to the correct port, 8000, I believe.

Resources