JRebel not working on external tomcat 7 - java

For some reason I can't get JRebel work on external Tomcat 7 with Eclipse. Everything works fine if I use server runtime in IDE, but if I launch server from command line and deploy application externally, JRebel doesn't reflect my changes to server.
Here is how I configured and deployed my project:
Enabled JRebel on project from projects configuration tab
Startup set to Run locally from command line
Created catalina-jrebel.bat according to generated configuration
Built project using maven
launched server using catalina-jrebel.bat run
Deployed war file on server from Tomcat's application manager
Now, if I modify my sample Servlet and save, nothing happens. Application behavior doesn't change, nothing in console.
Am I missing something, and how to debug the problem?
Here is the content of catalina-jrebel.bat
#echo off
set REBEL_BASE=C:\Users\tutoivon\.jrebel
set JAVA_OPTS="-javaagent:C:\SLO\eclipse\plugins\org.zeroturnaround.eclipse.embedder_6.4.4.RELEASE\jrebel\jrebel.jar" %JAVA_OPTS%
call "%~dp0\catalina.bat" %*

Some things you can check by yourself:
Server starts up with JRebel banner - so you can be sure JRebel Agent was actually attached to server.
In the banner it says that you have valid license - no license, no reloading.
The built .war contains a rebel.xml inside WEB-INF/classes - this helps JRebel to find the location of classes updated by IDE.
The paths in rebel.xml are absolute and correct, no placeholders (e.g. ${rebel.workspace.path}) are used - if placeholders are used, then they must be defined by passing e.g. -Drebel.workspace.path=/path/to/workspace to JAVA_OPTS. If done correctly, JRebel will also log a line such as JRebel: Monitoring directory '/path/in/rebelxml' in server log.
If you still can't get it to work after these steps, contact support#zeroturnaround.com.

Related

Rest service in Java runs from Tomcat server but not inside Eclipse

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.

Intellij tomcat local run configuration - what happens behind the scenes?

I've been using tomcat run configuration without any problems - it does a excellent job. However I kind of don't like the fact that it is not documented anywhere (or is it?) how this magic actually happens.
I suppose it somehow makes tomcat reference app created from artifact within target directory (if using maven). I also noticed that when using manager-gui app there are no other applications deployed so it must not use tomcat/webapps dir.
What I am curious is:
How does it start tomcat to point at the application outside tomcat home?
Does it deploy my app using {project_dir}/target/{appName}?
Where is the manager-gui app?
Where are the logs and conf files?
I'm using IntelliJ IDEA 15.0.3, Tomcat 8.0.15 and JDK 1.8.0_31
This is an excerpt from C:\Program Files (x86)\JetBrains\IntelliJ IDEA 15.0.2\bin\idea.properties:
#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to IDE system folder. Make sure you're using forward slashes.
#---------------------------------------------------------------------
# idea.system.path=${user.home}/.IntelliJIdea/system
idea.system.path=D:/dev/IntelliJ-Settings/system
In File --> Settings... --> Build, Execution, Deployment --> Application Servers I've defined this: (look at Tomcat base directory)
D:\catalina-base-idea contains the global Tomcat configuration for IntelliJ.
When I deploy my webapp using IntelliJ run configuration, the web app will be deployed to D:\dev\IntelliJ-Settings\system\tomcat (see idea.properties).
The above explains question 1.
Question 2: afaik, target is only used for building, not for deploying.
Question 3: there is no manager app within D:\dev\IntelliJ-Settings\system\tomcat\webapps
Question 4: logs are within D:\dev\IntelliJ-Settings\system\tomcat\webapps\yourApp . The global Tomcat config is located in D:\catalina-base-idea.
You can configure the Tomcat for IntelliJ so that it uses a port other than 8080. So you can start your standard Tomcat and IntelliJ Tomact at the same time.

Update files on a tomcat server, via Eclipse

I've recently found out how to remotely debug my java files on a Tomcat server via eclipse and was wondering something. I am wondering if I could import the same files into Eclipse that are currently housed in the webapps folder on my tomcat server, and instead of having to go to that filepath anytime I need to make a code change with the files in the tomcat server, be able to make them directly in Eclipse which I would be using to debug anyway.
Currently I've tried importing the same project folder from the webapps folder in Tomcat into Eclipse and made a small code change, relaunched my server, but am not seeing the change in my tomcat library.
When importing into Eclipse does it make it's own separate instance of the files, instead of actually being able to import the same exact files as in the tomcat server?
If you double-click the Tomcat server in the 'Servers' view inside Eclipse, you will see a configuration tab "Server Locations".
By default, eclipse doesn't make changes to the tomcat 'webapps' folder, it uses folders under its workspace.
Changing that option to 'Use tomcat installation' will make the changes be visible from the tomcat/webapps folder on your file system.

Unable to open "Tomcat web application manager"

I am new to java web programming and eclipse-apache Tomcat. I have small login web-application which includes (one jsp page , one servlet class).
I want to configure/deploy this application on apache web application manager. I mean I don't want to run this application in eclipse. I hope you understand my point.
Whenever I run my server in eclipse it run successfully. But when I want to open apache default page by typing http://localhost:8080 or http://localhost:8080 to configure my app It wouldn't open.
Please advice me.
To deploy a web application on Tomcat, you need to first compile your web application into a WAR file. Then, take that WAR file (let's assume it's called "MyApp.WAR") and put that into the tomcat/webapps directory. Restart the tomcat service. Tomcat will extract that WAR to a folder in the webapps directory. After that, any request to localhost:8080/MyApp will go to your webapp.
Make sure you have java installed, and add JAVA_HOME to your environment variable. (it is the path to java installation directory for e.g. C:\Program Files\java\jdk-1.6)
i.e
JAVA_HOME=C:\Program Files\java\jdk-1.6
install TOMCAT from here "http://tomcat.apache.org/download-70.cgi"
make sure you do not install it in you "c:\program files" due to some permission issues.
Lets say you installed tomcat at "c:\webserver\apache-tomcat\" this is your CATALINA_HOME, add it to your environment variable
i.e CATALINA_HOME=c:\webserver\apache-tomcat\
to acess tomcat webapp manager you need to configure user in %CATALINA_HOME%\conf\tomcat-users.xml
Add a role and a user :
Have your WAR file ready with you (this is how you create WAR "How to make war file in Eclipse")
move your WAR file to "%CATALINA_HOME%\webapp" directory. lets say "TestWeb.WAR" is your application with index.jsp page in it.
Now go to your %CALALINA_HOME%\bin and launch the startup.bat file (you would be using startup.bat to start and shutdown.bat to stop tomcat)
once tomcat is up and running check http://localhost:8080 is working fine.
P.S. If port 80 is already in use then try configuring your tomcat to some other unused PORT here "http://www.mkyong.com/tomcat/how-to-change-tomcat-default-port/"
go to your browser type http://localhost:8080/TestWeb/index.jsp
now you can to lot of configuration to your web app like having a default page and all
Hope this help you !
Normally eclipse uses Tomcat as an eclipse project, hence it uses metadata.
Server > Double click on the tomcat server instance > Server Location > Select "Use Tomcat installation"
Update: Tested just now. Set Deploy path to webapps folder. Works fine :)

Tomcat interrogation with eclipse under linux/mac

I added my local tomcat 8.0.14 with eclipse successfully. My local tomcat is located at /Users/masum/tool/tomcat-8.0.14. I can see it form eclipse runtime Environment as well. Whenever I deploy any webapp to eclipse's tomcat. It doesn't appear in local tomcat-8.0.14/webapps directory. I expected it should go there. But it doesn't.
Also is I do any changes in tomcat/conf/server.xml. These changes doesn't effect in eclipse integrated tomcat. Also if local tomcat is running, port number conflicts with eclipse's tomcat. I have to stop local tomcat to work with eclipse tomcat. Looks like two different instance of tomcat.
My question is where does eclipse tomcat physically located? If I deploy any web app in eclipse tomcat where it actually goes? How can I configure Tomcat so that I can control it both from eclipse and also manually?
Thanks in advance.
Double click your tomcat server in the servers tab. In the servers tab you will see "Server path" under server locations. This is the location of eclipse's tomcat working directory. If you stop tomcat and undeploy all web apps, start and stop again, you will be able to select other options. Click "Use custom location" to set the location to a place of your choosing. In project Explorer you should see a tomcat folder. Under that folder you will find server.xml and the other config files, which you can modify as needed.

Categories

Resources