I am using Tomcat 6.x and Eclipse J2EE Kepler. For reasons mentioned in my other question, I sometimes need to delete the Tomcat from the Servers list and re-add it.
The weird thing is: after I re-add the server, two configuration files server.xml and context.xml revert to a previous state! let's call it S. I cannot really tell what S is - it definitely is a state I once had, but it lacks some newer changes. For this reason my webapp does not work and I have to revert these two files in the workspace/Servers folder.
I'd love to fix this by updating S. However, I am unable to find the source of S, where Eclipse takes it from - I tried fulltext-searching my computer for files that look like the server.xml and context.xml, but to no avail. Specifically, I updated these two files in the conf/ folder of my Tomcat installation, but it did not help.
Where could Eclipse be keeping S? In some weird DB in the workspace metadata? Could it be using the local history?...
Thanks for any insights!
If you are working on Eclipse then there should be a folder called Servers in your workspace. When you start your server for the first time, it copies over the tomcat conf files into this eclipse project. So no matter if you change your actual context.xml from outside, eclipse will override it with what is stored in the 'Servers' folder.
If you still need the eclipse to take control of your tomcat installation directory, you need to primarily update this file from within the eclipse.
Related
I am unable to find another article that solves my problem but am happy to hear about one if you know the answer.
I have a RESTful service built in Java with Eclipse. It uses Spring and all of its bells and whistles.
After much work with configuration files, I am able to build the service into a war file, deploy it to my Tomcat webapps folder, and run it from standalone Tomcat. However, it still throws several errors on start when I try to start it from a service defined within Eclipse. The errors are the same errors that I was seeing before I got the config files correct for standalone Tomcat. The errors are about the inability to create the required beans because of references to properties that can't be found.
How did I get it running in Tomcat? I added a couple of .properties files to define properties needed by the beans that get launched at startup and then added a 'set CLASSPATH=...' line to the setenv.bat file in the Tomcat bin folder. This new line adds the properties files into the CLASSPATH. That seems to have fixed everything from standalone Tomcat.
So, my question is, "How do I make these same changes inside my Eclipse server?" I have added the properties folder with the property files under the config folder in Eclipse, just like it is in my native Tomcat folders, but I do not know how to modify the CLASSPATH string to specifically point to my .properties files (as I have done in the setenv.bat file for standalone Tomcat).
I think I understand the problem, but have no idea about the solution.
Thanks for listening.
Dave
Eclipse does not use any *.sh/*.bat files to startup Tomcat. In order to modify the way the server is started you have to open the configuration UI of the server by double-clicking on the server in the Servers view.
From there you will be able to modify the classpath of the system classloader through "Open launch configuration".
Another important setting is "Server path" which tells Eclipse, the value of $CATALINA_BASE. You can modify it only after removing all modules and cleaning the server. It is useful to set it to an easily accessible directory: this way you can verify directly that Eclipse didn't mess up your application deployment (sometimes it "forgets" to copy some libraries).
The "Configuration path" setting tells Eclipse where to find the files (but not subdirectories) that will be copied into $CATALINA_BASE/conf.
Remark: if your application requires you to add libraries to the top classloader, there is probably a problem in your project. The "missing" libraries should be added to WEB-INF/lib of your application instead: look into the "Deployment assembly" of your Eclipse project configuration.
When I go to server configuration in Eclipse, it let me choose three different configurations for server location
Workspace metadata
Installation folder
Custom location
How does the workspace metadata option actually work? Does it create a copy of server runtime from installation path to workspace metadata, deploy there and run that instance? Does this provide any other benefit besides not messing the actual CATALINA_HOME?
In short, what is exactly org.eclipse.wst.server.core under .metadata/.plugins and what's it relation to CATALINA_HOME given as Tomcat installation folder?
When I'm running and deploying Tomcat from Eclipse using installation folder as server location, I couldn't get JRebel to reload the changes, even if log shows the class is being monitored, instrumented etc. When I switched to user workspace metadata as server location, JRebel started working.
I cannot answer for sure what's the difference, but to best of my knowledge, it simply changes where the Tomcat picks up apps it's supposed to deploy.
Why does JRebel work with workspace metadata selection and not installation setting? Chance is that you haven't got JRebel configured correctly, namely you're missing a rebel.xml (you said classes were instrumented, but from what directory? Project build or workspace metadata?). How it could work for you with workspace selection is that perhaps you have automatic publishing enabled on server, this also updates class files in the metadata deployment directory whenever the incremental compilation occurs (it's probably using exploded deployment there). If JRebel cannot find rebel.xml, it picks up the classes from their original location and as those classes are updated, JRebel also reloads them.
I am curious about following error :
Publishing to JBoss 7.1 runtime server - MyEAP has encountered problem
Error renaming C:\(some path) to (MyEAR proj path)\(my war file)\META-INF\MANIFEST.MF
you can change these settings in server etc...
I have created a simple EAR project along with a dynamic web project with stuts2. I am deploying EAR file and everything is working fine but whenever I make changes to any file and save I get this error message. What is the exact meaning of this message?
Thanks
Maybe the problem to be that it is necessary to configure a scanner for external deployments.
See: 'Publishing to JBoss 7.1 Runtime Server...' has encountered a problem
In previous versions of JBossAS, there was an exposed JMX server with
an option to mark a folder as one that the deployment scanner should
look at. This option still exists in AS7, but, we haven't integrated
with the management ability yet. THis means we can't do it on the fly,
currently, in the current toolset is a bit hurt by this missing
feature.
It is still possible in the raw configuration of the server, howerver.
This means you can mark your server directly to scan some external folder by modifying
your configuration and adding a deployment scanner. The instructions for it are over here:
https://community.jboss.org/wiki/DeployingAnApplicationFromAnExternalDeploymentLocation
To make use of this, double-click your jboss-7 server inside eclipse
to open the server editor. You can then switch over to the second
page, "Deployments", where you can change the deployment method to
"custom" and set any folder that's on the same filesystem as your
eclipse installation. Once this is done, you can add that folder to
your server's deployment scanner lists as per the wiki above.
I've got a Java Web Project which I'm deploying to a Tomcat embedded in Eclipse's Servers Plugin, alas, when I navigate to the location of that webapp after publishing/starting the server, the .class files are all missing. I can navigate as far as ProjectName\WEB-INF\classes\path\to\packages\ -> All packages are empty.
Any Idea how to solve this problem?
Edit
Build Automatically is checked and it compiles just fine for another web project I've just included, just not for the one specified
Edit 2
Reinstalled Eclipse (because why not) - nothing's changed, works for Project #2, doesn't work for Project #1. Not even the path to the packages is existant now. The content of the src folder (that's supposed to be moved to WEB-INF/classes) isn't there at all - but the resources (I've got a resources folder with the same deployment assembly command) are.
A few steps to perform to restore sanity...
Refresh your project. It is possible that something was modified on the file system external to Eclipse.
Kick of Project -> Clean.
Now look at your project (not the deployed location) on the file system. Do you see the expected files in the /bin directory (or whatever you may have changed class output directory to)?
Let's now try exporting a war using the wizard. File -> Export -> Web -> WAR or something like that. Check the WAR contents. Are you .class files there?
If everything is good so far, there is nothing wrong with your project. The Tomcat server adapter just got confused.
In the Servers view... Make sure Tomcat is running. Next right click on Tomcat and select add/remove projects. Remove your project. Confirm that your web app is no longer accessible.
Now re-add your project via add/remove projects or invoke one of the run as actions.
The above should reset Tomcat server adapter and hopefully things should work as expected.
Check if you had deleted or moved your external JARs associated with the project on your IDE. I had moved it and ran into the same issue.
this might be a tall order or it might be ridiculously simple. I wanted to run this game on my website: https://github.com/ajanata/PretendYoureXyzzy
Unfortunately I have no clue how to make something like this work. There didn't seem to be an installation file, so I can only imagine it's painfully obvious to anyone familiar with this sort of thing. I recently ordered a trial of a shared Tomcat server, since I'm assuming that's needed to run all the Java goodies.
If there are any simple instructions I should follow to install this, it would be much appreciated if you could share them!
You need to download the source from the Github link you provided and then download Eclipse - Java EE. You then open Eclipse and choose File->Import->General->Existing Projects Into Workspace and choose the folder you just downloaded. You can then choose Export->Web->WAR file and export the WAR file.
You then download and setup Tomcat as described here (ignore the parts after Tomcat is running and you can access it at http://localhost:8080) and install the WAR as described here.
If you are feeling exceptionally lazy I have built the war here. You just need to drop it into the webapps folder in your Tomcat installation and then restart your server. You can then access it at:
http://localhost:8080/cah.
Hard to say without looking deeper into the project, if they create a .war file somehow, just copy the .war file into [tomcat home]/webapps directory and your application will be deployed. You can then acces it at yourmachine:8080/warname
where warname == the name of the war file without the .war extension.
There appears to be a SQL script with the project as well, not sure if there is some database you might need to setup which could get tricky.