Deploy java-application on tomcat - java

I have developed a java webservice application that I have been running on my dev-computer and in the meanwhile been setting up a dedicated ubuntu based linux server.
I have installed oracle-jre, mysql and apache tomcat 7 on this linux server and
after reading documentation I understand that I can either copy the deployed project archive (.WAR) or I can simply copy the project folder, into the servers /webapps/ folder from my development computer. Then restart tomcat7 and it should automatically run the webapp.
On my dev-computer with Eclipse IDE the webservice works properly as expected, but I cannot access the POST URL methods at all on the server
e.g. localhost:8080/Webservice/rest/account/login
(The installation on the server seems to be O.K as the Apache examples all work properly.)
I cannot see any logs in the /logs/ directory, in fact the folder is completely empty, so I cannot debug whats actually happening. Why aren't logs writing to the Catalina.out file?
Am I deploying this correctly as explained above?
Do I need to configure Eclipse or any project settings to reflect the change from the eclipse IDE / dev-computer to the server? E.g Is there any real difference?
A lot of questions there, but I wanted to clarify as much as possible,
Cheers,
Oliver

I fixed this issue by reinstalling tomcat.

Related

How to enable Hot deployment in JBoss using Redhat server connector extension in VSCode

I have made a small maven based web application in VSCode and trying to deploy it on JBoss using the Redhat Server Connector Extension.
But the hot deployment of the class files does not work in simple running JBoss server.
But Hot deployment does work in debug mode as 'Hot Code Replace' by setting the property 'java.debug.settings.hotCodeReplace' to 'auto'.
My inputs are from below links:
https://devblogs.microsoft.com/visualstudio/hot-code-replacement-for-java-comes-to-visual-studio-code/
and other SO links like:
How do I get Java "hot code replacement" working in JBoss?
Hot deploy on JBoss - how do I make JBoss "see" the change?
But it couldn't help.
Can you suggest something more about how it is simply possible in running JBoss?
(PS: Auto Build feature in VSCode is already enabled.
And It works fine in eclipse).
Hot deployment of web applications in VSCode's integrated RedHat Server connector can occur in following ways:
Exploded war folder: A folder is extracted from the original war and deployed to JBoss using the Exploded option. Here, the static changes like change in jsps and HTML are automatically reflected in the running application.
Hot code Replacement: Hot code replacement (HCR) is a fast debugging technique in which the Java debugger transmits new class files over the debugging channel to another JVM.
HCR only works when the class signature does not change; you cannot remove or add fields to existing classes when using HCR. However, HCR can be used to change the body of a method.
(source: https://devblogs.microsoft.com/visualstudio/hot-code-replacement-for-java-comes-to-visual-studio-code/)
Maven Install/build: It is actually not a preferred technique which someone will want but it is useful also. In this technique, you run maven: install which builds the project again and install it onto the server again.
Currently, VSCode for java and the server connector extension are new as compared to already available IDEs like Eclipse. So, we might expect more powerful functionality in coming future.

What are the drawbacks of deploying a website using the Eclipse IDE?

I started my journey into web applications about three years ago and I'm happy to say that I've finally deployed a working website. My concern is that to deploy the website I use the Eclipse IDE and a Tomcat webserver. So basically I right click the project in Eclipse and then choose "Run As > Run on Server" and then select the Tomcat server I downloaded - from that point on the console spits out some startup messages and my website is online and ready for use. What are are some of the drawbacks of deploying a project this way. I've read just briefly about WAR files and adding them to Tomcats Webapps folder but I could neither get that working nor did I understand completely the process...so is it acceptable to just deploy the project the way I have been doing thus far by running it in Eclipse?
Generally Development machine and deployment server is different.
On Deployment server one may not have eclipse always.
WAR file is just a webarchive which includes all the necessary files. WAR makes your project portable.
Export WAR from eclipse place it in tomcat webapps in any machine and restart tomcat.
You should have your webapp successfully running on that machine.
That's a fine way for deploying a server when you're learning, or always have the server (the only server!) running on your development machine.
If you need to push to a remote machine, it won't work, and you'll need to learn other methods then, but for now, what you're doing is fine.

tomcat - caching issue on class files

I am developing a plain java web application(JSPs/Servlets) using Netbeans 7.4 on Apache Tomcat 7.0. I have problems on my production server (windows Server 2008 R2 Enterprise) whereas it works perfect on my localhost. I suspect it to be cache issue.
The problem is that I am deploying a new version of my application to my production server, but it serves the old application. At first I thought it is a cache problem, but after cleaning work and app directory and restarting tomcat (tried all combinations...), nothing seems to be changed.
My server directory structure is like below:
Tomcat 7.0
webapps
myapp
ROOT
ROOT.war
images
otherapp
work
conf
etc.
JSP files are changed or created as expected but the class files persist to behave like before.
Did you have any similar problem? Since I had no similar ones before I am stuck about the possibilities? If you can give me some pointers, I would appreciate it.

How do I register a Tomcat 7.0.41 server on NetBeans 7.3?

I have just downloaded NetBeans 7.3 for JavaEE and installed it with Tomcat 7.0.41 Everything went fine and I can run NetBeans, start and stop Tomcat from within the IDE and add and remove servers at will.
However when I try and create a Java web Application project my server list is empty.
The message I get at the bottom of the wizard for creating projects is "No servers are registered in the IDE. To register a server, click the "Add..." button.
I have Googled and got nothing and looked at the NetBeans docs and got nothing, help me
I am running Netbeans 7.3, Java 1.7, Tomcat 7.0.41 and Windows xp-3.
This Problem is solved by just Restarted Netbeans Software
Thanks to all
I know the original problem was solved, but I had a very similar issue, and in my case simply restarting Netbeans did not help, so I wanted to help anyone with my issue. It sounds stupid, but I wanted to warn people that they need to be sure to download the right tomcat zip file.
Tomcat lists several zip files on their server, and I should have been using the Windows-64 zip file. Instead, I downloaded the first file, which just said "zip". I am not sure what configuration this was. It ran in windows 7, but created the same sort of mysterious pattern in Netbeans. In the Services tab, I could clearly see Apache Tomcat listed under Servers. If I started the service it worked fine. However, when I right clicked on my project and attempted to resolve missing server problem, it would not list tomcat in the list. The list is filtered to only show servers that are valid with the version of Java EE 6 or whatever you are using. In my case, apparently the original tomcat I downloaded was not valid.
You have to register the server inside Netbeans.
Simply a matter of going to the servers tab under tools & adding a new server & browsing to the installation location.
Follow the tutorial on the link below here (start at the time I have set):
Tutorial
Try this remove all server from the IDE and then double click the netbeans exe go to customize select the the tomcat server alone and then install
sample
Go to Tools -> Plugin -> Update Plugin.Worked for me, give it a try.

Setting build path in eclipse java

I have searched stackoverflow before posting this question.
In eclipse i am running a tomcat server. I deleted the .class files from the work folder of the tomcat server. From then on I am facing the issue saying the class couldnot be found.
I re-built the project. Didnt help
Can you please suggest how to fix this issue.
You should NOT run Tomcat as a normal program inside Eclipse. You should use the EE version of Eclipse, and then add Tomcat in the server view. This will allow you to deploy Dynamic Web Projects directly to Tomcat or any other supported server.
delete the server from eclipse server view and create it again.

Categories