I would like to deploy my project on tomcat server.
When i develop the project, i using eclipse with tomcat, and everything is ok.
I would like to deploy directly to tomcat server now.
I put my project folder under tomcat's webapps folder, and restart tomcat server.
But it shows 404 error when i open http://localhost:8080/myproject/
why this happen, and how can i figure it out?
It is not straight forward when you invoke Tomcat from within Eclipse. Please read the FAQ section at https://wiki.eclipse.org/WTP_Tomcat_FAQ
It explains how if you start Tomcat from within Eclipse, the binaries of original directories of Tomcat are used, but the web apps etc are stored separately in the Eclipse Workspace.
Related
Some facts about the application:
It consists of several modules, one of which is a GWT client module
Spring 3
GWT 2.6.1 (+ compatible GXT)
Is packaged as .war and can be deployed to a standalone Tomcat
Chrome add-on does not work anymore, so until recently I had to rely on Eclipse + embedded Jetty + Firefox 24 to be able to launch the app in DevMode and debug it
The other day I decided to try to launch it in IntelliJ IDEA and see if the debugging would work there.
Observations after deploying the app via a local Tomcat configuration in IntelliJ:
The app is deployed just fine (wither using war or exploded war artifact). Basically, Intellij takes the work directory from the standalone Tomcat installation and moves it into its installation folder (eg. .IntelliJIdea2019.1/system/Tomcat/Unnamed_MYAPP). Config files get also copied to the config dir.
The webapps dir of Tomcat stays within the original Tomcat installation and the app is deployed there
At first I thought the breakpoints are not recognized at all. However, it turned out that I was testing breaking only within the GWT client module; when I later tried some other module - the execution stopped as expected.
Now, what's interesting is that when I would develop and debug with Jetty, if I made a change to the GWT client-module, I could simply reload the page and it would appear.
With Intellij and Tomcat, it's the opposite. Breakpoints do not work as mentioned, but also refreshing, eg. via Update classes (instead of full redeployment) does not work, whereas for the other module it does.
Is there a way to somehow adjust my artifact so that GWT module as well can be debugged?
My exploded war artifact looks like this:
< output root >
META-INF
MANIFEST.MF
WEB-INF
classes
GWT module compile output
lib
web.xml
webapp directory contents
GWT client module GWT compiler output
Actually, it was a silly situation - I was expecting the execution to stop at the breakpoints set in the Java code of the gwt-aware module -- but since it was already transpiled to Javascript -- that was impossible.
The only way for breakpoints to stop in such a module is to use the DevMode.
I'm working on a Java EE project made by someone else. They put this project in a VM and I can access to it to run the app. But the problem is that I can't find all the files of the project. Indeed, the project is using the model-view-controller and I find only the .jsp files (view). The app uses JBoss, Tomcat, Maven and Catalina. I have to start JBoss and Tomcat and then, in localhost, the app is running. So it works. I'm asking myself if there is a place defined by one of those technologies where I can find the other files. Because, they should be on the VM because the project is running well.
Can someone know if there is a global repertory for those files ?
Your VM will most likely contain only a runtime environment for the web application, consisting of a JBoss installation (including Tomcat) and the deployed application (in webapps folder), typically as a decompressed (exploded) WAR. See Deployment for an in-depth description of the web application's structure.
If you plan on modifying the application, the runtime environment will not help you much, because it typically does not contain the Java sources, but only their class files. You will instead need a development environment, consisting of your favourite IDE and the web application project, checked out from some revision control system (CVS, SVN, Git etc.) at best. This is the place where you can write/change code and JSPs and eventually build a WAR (e.g. using Maven) for deployment in the runtime environment.
Seems to me you should rather look for your files in a development environment.
I am trying to get JRebel working with a fairly large enterprise web application which uses Ant + Ivy for building/dependency management, Spring 2.0 framework and Spring MVC, and all this has to be built and deployed to Tomcat.
I have JRebel enabled on Tomcat and the Project itself. Remoting is not enabled as I assume that if Tomcat and the project are on the same machine, this is not needed. When I start the Tomcat server from within STS, JRebel appears to load fine and I see no (apparent) significant errors.
However, any changes to the project do nothing with regard to deployment, and I see no JRebel messages in the console. The project itself is a somewhat nonstandard layout and does not have the traditional WEB-INF/src structure. When I enabled JRebel on it within STS, it just dumped a rebel.xml file in the root directory.
For reference, the project is based on this codebase and has the same general structure: https://github.com/NCIP/c3pr/tree/master/codebase
While the JRebel guides are good, they only show JRebel being used with very simple projects and do not go into very much depth into exactly how the service works.
Any suggestions, resources, or ideas are greatly appreciated.
thanks
Did you actually recompile (doesn't matter if you use Eclipse or javac) those classes that you changed? It might be a good idea to check if you have "Build automatically" enabled under the "Project" menu.
They way how JRebel works is that it actually monitors the compiler output folder (usually "bin" folder or "build/classes" or something similar).
This folder (or folders) is specified in the rebel.xml file and the file must be in the classpath of your application while you run it (WEB-INF/classes or on the jar file root or in the exploded dir).
Can you make sure, that rebel.xml is actually in the applications classpath?
Also, you should see the message in the console that says something like:
"JRebel: Directory '/path/to/project/bin' will be monitored for changes.".
And also, if you see the JRebel banner in your console, it is useful to check if the license is found (if it is not found then JRebel will not work).
Sometimes there may also be some mismatch when your Eclipse compiles classes to the "bin" folder and your build scripts compile them to under "build/classes" and only one of these locations is specified in the rebel.xml file. In this case, JRebel will monitor only one of them and then it is confusing too.
Wishing the best,
Sigmar
I have problem with configuration of maven project in IntelliJ. I deploy my application to JBoss, when I start JBoss server via IntelliJ, application is deployed without any additional actions, but when I try to redeploy application after some changes, IntelliJ try to make project with it's own make process, and it fails. I have to make project via maven and restart server to redeploy application. Can I somehow tell intelliJ to use maven while redeploy application? I cannot see such option in Run/Debug configuration window.
I think you are using exploded artefacts (present icon) Server, Deployment Section. Right?
There you can choose the external artefact and disable the make flag.
I always using exploded artefacts, because of the hot code deployment. So I do no need to deploy artefacts again and again.
Please be aware if there is already an artefact (e.g. foobar.war) in the same location (maven target directory), you have to change the name of the exploded artefact (e.g. foobarE.war). Idea is creating a folder named foobarE.war.
I'm using eclipse indigo IDE, apache tomcat 6.0 server, m2e plugin,jdk 1.6 softwares in my project.
After i make some changes in java code i do clean & maven build and the start the tomcat embedded server using maven i.e. 'tomcat:run' plugin command. But after following all steps i don't see my changes reflecting at all.
Now after i build all classes i see that all the class files are generated inside 'target' folder which i confirmed with the time at which it was generated.So i believe these class files are not getting published to embedded tomcat server of maven for some reasons.
P.S - I don't start/stop or use tomcat server configured in eclipse as i believe embedded tomcat server of maven doesn't use tomcat server in eclipse and it works by itself.Please correct me if i'm wrong here.
Please help me out.
[Update]:
Might be useful for someone who is facing similar issue.
The above problem was because of eclipse project settings file getting corrupted as i was encountering the same problem when i imported the same projects in different workspaces.But when i included modified codes alone in new workspace,it worked fine. All my changes were getting reflected.
use tomcat7:run
Then configure backgroundProcessorDelay see http://tomcat.apache.org/maven-plugin-2.1/tomcat7-maven-plugin/run-mojo.html#backgroundProcessorDelay with > 0