tomcat unable to publish due to deleted java.orig file - java

I used a merge tool to merge my code with the upstream branch which created a .orig file for one of my java classes. After verifying that everything was working fine I saw not need to keep the .java.orig file around so I deleted it.
Now whenever I try to deploy to tomcat from eclipse I get the following error:
'Publishing to Tomcat v8.0 Server at localhost..' has encountered a problem.
Resource '.../MyClass.java.orig' does not exist.
I've tried removing all applications off the server and removing the server from eclipse and then recreating it but to no avail.
I'm running out of things to try and I'm not sure what dependency tomcat thinks my project has on the .orig file. Any help is appreciated.

Ok so rebooting my machine seemed to have fixed the issue I was able to start tomcat normally after that using the same eclipse workspace. I'm not sure what the underlying issue actually was but the restart seemed to fix it.

Related

Cannot see sources will debugging on local JBoss server

I have a project producing a .war file, I created a local JBoss 7.1 server in eclipse referencing my local JBoss installation. Then I start the local server in debug mode, copy my war file to {JBOSS_HOME}\standalone\deployments, and it deploys it correctly.
But when I add a breakpoint in eclipse, the code stops like it should, but showing me a "Source not found" white page.
How can I link or synchronize the source code to my local server?
Thank you.
Okay so I solved my problem and it seems pretty obvious now that I found it :
My project is generating a projectname.war, and a projectname-sources.jar, I just had to deploy also the projectname-sources.jar...

CAS Redirect Loop

I am trying to get the CAS setup up and running and I am pretty new to this.
I am following through the standard steps similar to this video.
I have created keystore file
Created a certificate
Imported it successfully and add to cacerts file
I have made the necessary changes in the server.xml of tomcat
After all these steps, I started the tomcat, placed the war in the webapp and to test, I tried to access http://localhost:8080/cas/login and https://localhost:8443/cas/login and it is throwing and Redirect loop error.
I have no clue what I am doing wrong. Any help is appreciated!.
It was nothing to do with my configuration.
I watched several videos and understood that my configuration do not have any problems. The problem is with the 4.0.0 release. I do not know if any one else faced the same problem.
My Solution: I took latest source (4.0.2) and built the war using maven and deployed. It worked perfectly.

Can't setup Tomcat 6 in Eclipse - "Could not load the Tomcat server configuration" error

For the last couple of hours, I'm desperately trying to configure apache tomcat6 in Eclipse, and I'm having some difficulties.
I tried everything I could find online, including several posts here in Stack Overflow (most of the problems I found wasn't exactly like mine).
Initially, I followed this tutorial, and after installing tomcat6 like this:
sudo apt-get install tomcat6-common
sudo apt-get install tomcat6
and making sure that the server is running.
Next, I followed the mentioned tutorial, and everything was fine, until I got to stage 5.4 in the tutorial: "Start Server".
When I click Start, I get the following error:
As I said, I tried to look online for an answer, but nothing seems to help...
Does anyone know why am I getting this error and how can I fix this?
This might be a long-shot but do you have correct permissions for the folder where the config file is located?
try to follow the steps mentioned in below link
clipse-could-not-load-the-tomcat-server-configuration
1)Close Eclipse
2)Copy all files from TOMCAT_6_HOME/conf to WORKSPACE_FOLDER/Servers/Tomcat v6.0 Server at localhost-config
3)Start Eclipse
4) Expand the Servers project, click on the Tomcat 6 project and hit F5
5) Start Tomcat from Eclipse
Try to start the server using terminal and then try in eclipse. go to /bin/ execute the command startup.sh. try this.
if you still got error. Execute this configtest.sh will provide you the proper error.
Then try set Classpath for your server. can be done using setclasspath.sh
I was able to solve it, after 3 and a half hours of trying...
Apparently, when I installed tomcat from the command line (sudo-apt-get etc) the /usr/share/tomcat6 folder (the default installation path) was missing some files, including this /conf folder, which required for Eclipse (hence the error message).
But when I removed it, and download tomcat as a tar.gz file from here, and extracted it, it somehow contains more files in it, including the /conf folder.
So then in Eclipse I created a new Server, and provided the path of the new extracted folder, instead of the previous /usr/share/tomcat.
This did the trick.

intermittent ClassNotFoundException for JSP using eclipse

Running Eclipse Indigo, Tomcat 7 on Windows - running the web application on the ROOT context with eclipse wtp plugin I am getting this intermittent problem where eclipse cannot find the compiled JSP. It occurs when first accessing the JSP and cannot be resolved except by stopping the Tomcat server and cleaning the Work directory and the project directory. The compile version is there in the eclipse directory structure:
.metadata\.plugins\org.eclipse.wst.server.core\tmp0\work\Catalina\localhost\_\org\apache\jsp\WEB_002dINF\...
but it still produces this error.
After some research I found this related thread which seems to suggest the problem only occurs when the application is deployed on ROOT.
http://comments.gmane.org/gmane.comp.jakarta.tomcat.user/208071
And a bug has been entered:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=334977
Has anyone had a similar issue to this and knows a solution?
Hi please try to configure value as per first screen shot and change location as per second screenshot and try if that works for you.

eclipse/tomcat: deploy doesn't work any more (ClassNotFoundException)

I'm running Eclipse Helios Service Release 1, with Tomcat 7.0.12 in Linux Ubuntu Natty Narwhal.
I've been happily hot re-deploying my webapp until it stopped working for apparently no reason. The following exception is displayed:
SEVERE: Allocate exception for servlet Index
java.lang.ClassNotFoundException: obliquid.servlet.Index
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
In Servers tab I've "Tomcat v7.0 Server at localhost [Started,Synchronized]
My project appears as a child of Tomcat v7.0 Server
In Properties, Java Build Path, Source I've Project/src Source folder
In Properties, Web Deployment Assembly, I've the following mappings: /WebContent -> /, /src -> /WEB-INF/classes, /test -> /build/classes
My src directory contains a Servlet in obliquid/servlet/Index.java
I tried already to click on Clean Module Work Directory... and Publish
I tried to stop and start the Server from within Eclipse Servers tab
What else should I check? Thank you.
UPDATE Despite now I'm working with the new project, I came back to check the old one, and mysteriously now it's working. I think I won't be able to find what has happened.
However today with the new project, I had 404 errors with no apparent reason and I found out that right clicking on the Tomcat server and selecting "Clean..." can be useful. Maybe it could have helped.
Selecting "Clean..." says: "Clean will discard all publish state and republish from scratch. Are you sure you want to clean all published resources?". Selecting yes, I solved the problem
UPDATE 2 It happened again on the new project. 404 errors, this time they don't go away.
Stop -> Clean... -> Start (404)
Stop -> Clean Tomcat Work Directory... -> Start (404)
Stop -> Clean Tomcat Work Directory... -> Clean... -> Start (404)
Stop -> Remove on the application -> Clean... -> Run As -> Run on Server -> (404)
Exit Eclipse, Start Eclipse
Start the server -> (404)
UPDATE 3 It turned out that this time I just didn't notice an exception caused by a listener-class during startup. After solving the problem, it worked. Guess I should stop working at 3 AM.
While on Tomcat 6 and Eclipse Ganymede I found out the following chain to work like charm:
1 stop server
2 project -> clean
3 project build (I had automatic build disabled)
4 delete server
5 delete Servers folder
6 restart Eclipse
7 create new server, add project and start :)
takes some time but worked like charm. My problem was a irritating Listener start problem, but this seems to be something similar: a property at tomcat. Btw: nowadays I am also a big Glassfish fan.
I found that this procedure is useful:
Click on Servers tab and Stop the server in use if it's running
Right click on the server again and select Clean...
Right click again and select Clean Tomcat Work Directory...
Hopefully the ClassNotFoundException should be gone now.
Another time I had a problem with a class launched at server startup, an exception in a listener class (ServletContextListener). When a ServletContextListener raises an exception during startup the application deployment is aborted, hence the 404 errors. In that case fixing the problem that caused the exception, made the application working again.
EDIT: This shorter procedure worked for me most of the times, but today didn't work and I had to follow Mico's extended procedure. My suggestion is, if you have a similar problem, first try this shorter procedure. If the problem persists, try with Mico's.
I'd recommend that you stop and start the Tomcat server again. Hot deploy does not work forever; there are some issues that will cause you to have to restart after a few redeploys.
I wonder when I see the accepted answer with +25 is it really accurate?
First if you are going to delete the server then whats the point in cleaning it? It will take your time unnecessarily and nothing useful will you gain.
So i will say just 5, 6, 7 steps should do the magic
5 delete Servers folder
6 restart Eclipse
7 create new server, add project and start
This could be something I learned on con-fess 2011. For me this sounds like a classloader problem.
The theory behind:
Java does not only use the type of the class but also the classloader which loaded it to identify the type of an instance. This means a simle operation could fail, e.g.
ClassA a1 = new a1;
ClassA a2 = SomeOtherClass.giveMeInstanceOfA();
a1 = a2;
This example would fail if SomeOtherClass uses a different classloader because Java would say that they are not the same.
The speaker also mentioned that some servers use per default about 45 different classloaders.
What does this mean in practice:
You deploy your webapp to the server, everything runs fine. The server caches the classes and everything he needs to load them somewhere. Now you make a hot deploymen and the server may loads new classes with a new (or different) classloader. This is the point where it starts to become dangerous because from now on you have two different classes in the memory which should be the same. Simple operations like casts (ClassA a = (ClassA) new ClassA()) fail, new Methods within the class are not found (because the server takes a cached version without this method),....
This is the point where I restart the server, clean the working directory (to get rid of the cached versions) and start thinking about hot deployment as critical thing.
If it is possible to try Mikkos procedere and this solves the problem this explanation could help you understand why.
I know this does not solve your problem but could give you some hints what maybe could have happened.
Speaking of hot deployment of Tomcat, you would indeed experience various problems, the least of which is memory leak, which is why you would have to restart the application. I would recommend to try JRebel for fast turnaround of "make and save any changes and then refresh the browser and see the changes immediately". You can find the JRebel hands-on lab, which shows how to use it with Tomcat and Eclipse. http://www.javapassion.com/rebels/jrebel_basics/
I have gained some new experience on programming and I am not anymore starving on Eclipse + Tomcat combination. Several ways here can help you out of the need of the usage of that combination:
First of all, don't use them together!
You can use other available IDEs, e.g. IntellijIdea (that is not free, but is worth of investing) has an property that when you debug a Java code, you can change code on fly and compile the Java files one by one and then it suggests if you'll want to have it updated on server. No restart needed almost never (of course it sometimes gets lost, but mainly it works).
Use standalone tomcat server, not the one inside Eclipse / your IDE. That first trick works only when you debug external server, nothing inside IDE. There comes the second tip: if you happen to change only jsp or html content, those files can be copied to the right place inside tomcat's webapp folder manually with unix cp or windows copy command and if you happen to develop files in same foulder long time, you can copy the folder content (e.g. myFolder/*.jsp) as many times as you wish and no restart is needed at all. The changes come visible when you touch or edit&save the web.xml file inside the webapps folder and then after that with refreshing the visible page on browser. Probably hard refresh with CTRL+F5 is the best way.
Thanks to #Verdan about his comment, otherwise I wouldn't have came back to answer again.
I was able to solve this by disabling the maven nature (right click on project >> maven >> disable maven nature). Then re-enabling it (right click on project >> configure >> convert to maven project). I had tried all of the other tips and tricks above, but this is the one that finally worked.
I was running into the same problem - tried all of the above, Eclipse always freezed when i tried to start the server, even after i deleted all the server configs and created a new one with a freshly downloaded tomcat instance. Anyways, problem wasnt solved until i moved to a new workspace, reimported the projects and created a new server. Seems like an Eclipse bug to me...So in case nothing else works, this is the way to go...
I'm currently struggling with the same problem, but nothing mentioned here does not help me. Anyway, I found out that if I:
stop server in eclipse
run tomcat elsewhere (in my case the xamp distribution)
stop currently running tomcat
start tomcat in eclipse
everything works just fine, of course until I change something in code and try to test it again.

Categories

Resources