tomcat - caching issue on class files - java

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.

Related

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.

Problems with Java JRun Cache

Jrun4 came bundled with our install of Coldfusion. Recently we decided to create a new server within JRun to accomodate a new webapp that will always need to be run over SSL.
Long story short. The app was deployed when a bug was found and quickly fixed, recompiled and we redeployed the webapp. As far as JRun is showing the new webapp gets deployed and is being served however, when hitting the webapp none of the new changes are being served up. To verify that the changes are indeed present, I have actually verified the checksum differences and also run a java decompiler on the modified class files and the changes are present. I have added console messages to the app to verify that they get printed to console, none of the new messages appear.
The procedures I have attempted:
Hot deployed the war file, console stated the file was redeployed
Turned off the JRun server hosting the file and restarted it with the modified file.
Completely deleted the existing JRun server hosting the webapp. Shutdown JRun. Restarted and created a new JRun server to host the webapp.
Opened javacpl.exe, Java Control Panel, and deleted all temporary files, applets and applications included.
Downloaded TOMCAT and deployed the same war to the webapps directory, everything showed up correctly. I cannot use tomcat though as the company would need to allow it to be used.
I am now at the point that I think I may need to reimage the entire server and deploy the webapp on a fresh JRun install however, there really must be a better way.
The problem was due to an older version of the war being programmatically added to the java classpath that jrun was using.
This was causing it to reference classes from the classpath rather then the newer deployed classes.

Deploy java-application on tomcat

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.

Hot deploy with WebLogic server?

I have an enterprise application running on a WebLogic server.
When I modify any Java class, I have to build the .ear file and deploy to the server every time. Even for a small modification, I need to build the whole application and deploy to the server. The server is taking around 10 minutes to do this.
Is there any other way to do this?
When I was working with Tomcat, we used to update the .class files directly in the webapps project folder so that we didn't need to re-build the entire application.
Yes - there is a feature called FastSwap.
Using FastSwap to speed up dev
Using FastSwap Deployment to Minimize Redeployment
When you create a weblogic domain, you define it will be started in Development or Production mode.
To modify that, update the value of production-mode-enabled to true or false in config/config.xml
For more details check the following link or Weblogic documentation.
Difference between DEV and PROD mode in Weblogic 10.3
About your question on Weblogic Plugin, I suppose your're talking about OEPE (Oracle Enterprise Pack for Eclipse), which will deploy your application to a running domain that will be in dev or prod mode according to the mentioned in the config.xml

Remote Development Workflow with Tomcat and Eclipse

Currently, I have tomcat installed on the production server to serve my java webapps. I develop in eclipse at my personal workstation and then I use an ant script to build the project into a war file and deploy that on the server.
This setup works well when I am on the same network as the server because deploying is almost instantaneous. However, now that I am working remotely uploading the war file to the server is slow and in most cases very redundant (there are about .5 GB of static media included in the war file).
Is there a better way to update my webapp on tomcat from eclipse and if so what are the best options for implementing such a solution with minimal effort?
Checkout rsync. It transmits just the updates to the file, so it will greatly speed up your process. Also depending on how complex your application is you might look into installing jetty on your personal workstation. It works well with eclipse and lets you check the new code almost instantaneously.
What it sounds like you want is to have the exploded war file(your root app/result of ant compile) sit in your tomcat web-apps folder. Tomcat will deploy it based on the host or context tag in server.xml.
This way, you can just drop your $app/WEB-INF/classes into the application and, if context reload is enabled, the new files will be deployed immediately.

Categories