I am new very much new to maven and spring technologies. I want to know how can we auto deploy the java server code without rebuilding the maven or without restarting the glass fish server? Currently I have to restart the server if any change I do in java code. I have also use one option in Eclipse to "Automatically publish when resources change" but no use.
You may want to take a look at JRebel, it reloads changes made to your code instantly without having to restart your application server.
The recent version of HotSwap Agent works very well for me with Eclipse and Payara Server (server derived from and compatible with GlasFish).
It's free and opensource and supports Java 8, including lambdas. It supports reloading of resources in a webapp running on GlassFish/Payara, including JAX-RS annotations, CDI bean definitions etc., without restarting whole application.
The only drawback is that you need to install the DCEVM plugin into the JDK, which has to be activated by a command line argument -XXaltjvm=dcevm. But this isn't intrusive and doesn't affect your JDK if you avoid the argument - you can activate it just for GlassFish/Payara Server when you add it to the JVM options in the domain configuration. When adding the -XXaltjvm=dcevm option, you also have to remove -client and -server option, because they take precedence.
So, essentially these steps are needed with the recent version of HotSwap agent and practically with any version of GlassFish and Payara Server:
install DCEVM as altvm into the JDK (run the installer with admin rights)
copy the hotswap-agent.jar into lib/ext in your domain directory
add the following arguments as JVM options in your domain configuration: -XXaltjvm=dcevm -javaagent:/path/to/hotswap-agent.jar
run the server in debug mode from your IDE
in Eclipse, all works out of the box, just avoid using the Publish button for the server. Check that "Never Publish automatically" is checked in the server Overview, when you double click on the server in the Servers view
in Netbeans, you need to disable "Deploy on save" in project configuration and enable "Apply code changes after save" in global Java Debugger options
There is some information in this Payara issue, although it isn't an easy to follow guide. Some more info in this HotSwap issue.
Related
First thing's first: I'm trying to develop an web service that is integrated with third party JCE(using Security.addProvider to use that jar which is packed into my WAR), but somehow when I deploy the WAR on my Websphere 8(with Java 1.8), it keep telling me that it cannot find the specified algorithm(AES) that I need unless I drag the JCE into Websphere's JRE and change its java security configurations.
Since I have no idea about the root cause, so I installed light-weighted websphere using the Eclipse's plugin install manager. Then I start the light-weighted server, select my web project and set it to debug on this server. But the Next screen I saw is "Context Root Not Found", even I changed the URL to the servlet.
I'm not familiar with WAS and it's liberty plugin, but isn't it suppose to run my project on it? like the Tomcat? Can anyone tell me how to run my WAR in it, so I can debug it? please?
First off, it looks like there is a misunderstanding on what Liberty is. When you say "light-weighted server" I'm assuming you mean Liberty, which is accurate -- Liberty is indeed a light-weight server.
However, WebSphere traditional and Liberty are two different products/servers. Liberty is not a plugin for WebSphere traditional.
A Java EE application running on WAS should behave very similarly to an application running on Liberty, because they are both Java EE compliant application servers. Since debugging and developing an application on Liberty will be easier/faster than on WAS, I would recommend using Liberty.
To debug your application on Liberty using the Eclipse WDT plugin:
Open eclipse with the WebSphere Developer Tools (WDT) plugin installed (you can get WDT here).
Follow this article to create a server using WDT. You can skip the parts about creating a sample application since you already have one.
Open the "Servers" view (using Window->Show View->Other...->Servers) and find your server:
Right click the server and do Add and remove... then add your application to the server
Set a breakpoint in your application code in Eclipse
Start the server in debug mode (by pressing the bug icon shown in step 3)
In the Eclipse menu, select Debug->Debug As->Debug on Server:
Platform
Liferay 6.2 EE Tomcat bundle deployed locally
Liferay 1DE - various version in the past 1 year
Liferay 6.2 EE plugins SDK
JDK 6 or 7
Mac OSX or Windows
Problem
We run into an issue intermittently with the Liferay IDE where a portlet java class changes are do show up the Tomcat server.
The setup is as follows:
A portlet is deployed on the server and is also configured to publish and synchronize on the local server (by drag and drop).
Any changes saved to any of the java class result in a expected publish to the server automatically without a need to do a ant deploy/ Liferay -> SDK -> deploy.
These changes can be seen in the browser after the publish
Intermittently, this automatic publish sync of the java classes does not work and the changes can't be seen in the browser.
Stopping and starting the server seem to have no effect.
Has anyone see this behavior?
I am working with a similar platform
Liferay 6.2 EE Tomcat bundle
Liferay Developer Studio 2.2.2
Liferay 6.2 SDK
JDK 7
Windows 10
To "synchronize" the changes in your IDE with your local server is about the way in which you deploy your portlet.
Although these initially steps are not explicitly necessary - I strongly recommend them for consistency
The first steps to clean your local environment
Stop the local server
Right click the server and clean
Empty your webapps folder leaving only root
Empty your temp folder
Remove all files and directories from tomcat-X.x.x/work/Catalina/localhost except _
Next open your local server settings by double clicking on your local server instance. In the top right corner you should see a publishing fold. Click to expand and select the following options
Automatically publish when resources change
Update context path
Under the Liferay Settings fold (bottom left) you should have the following setting selected
Development (portal-developer.properties)
Enabling Developer Mode turns off certain caching options that default to true when operating in standard mode. Despite the official documentation it does not eliminate the need "to redeploy to see your portal modifications".
Instead of direct deploying from ANT, right click on your server -> add -> then select your desired portlet
This creates a directory in webapps with your portlet similar to ANT direct deploy - this is the only way automatic publishing will work.
The problem above happened to a few of my team members local Liferay environments.
I have been able to work around this by following the steps below:
Undeploy the portlet by removing the portlet from the Tomcat home/webapps/ folder
Stop the Tomcat server Liferay IDE
Cleanup the temp folder under Tomcat home/tmp/ folder related the portlet in question
Start the tomcat server via the Liferay IDE
Deploy the portlet to the Tomcat server
The publish sync process seems to start to work after these steps.
I am not sure if there is a better solution.
Hope this helps someone.
I have Tomcat 6.0 installation on my Win7 PC. I used 64/32bit windows installation.
In Eclipse I was able to set paths and set server to use my Tomcat installation. Everything seems working fine until I run server from inside Eclipse.
I noticed that http://localhost:8080/index.html page is not available (Tomcat default home page). I also can't access http://localhost:8080/axis2. I have Axis2 installed too.
Since I am struggling to make simple axix2 web service for long time, I am thinking maybe this Eclipse instance of Tomcat is adding to my issues?
When I start Tomcat from windows GUI everything works as I expect.
Any ideas?
Thanks.
Eclipse does by default not take control over the Tomcat installation and all of its pre-deployed webapps, instead it just uses its sole server engine and uses the workspace metadata as deploy space. When you start such a server configuration from inside Eclipse, all of the pre-deployed webapps will just be plain ignored, including Tomcat's default homepage.
To let Eclipse take control over the Tomcat installation, you need to doubleclick the Tomcat server entry in Servers view to get its configuration, then at the left column, under Server Locations, you need to select Use Tomcat installation (note, when it is grayed out, read the section leading text! It needs to be published without any projects).
Yes, this is normal. In the Package Explorer, you can click the Servers folder and view the configuration files that the Eclipse instance is using, specifically server.xml and context.xml. You can edit this configuration to match your specific requirements.
You may also want to check out the section titled Tomcat Publishing Options in this link here: http://www.eclipse.org/webtools/releases/2.0/newandnoteworthy/server.php
I favor this approach because when WTP inevitably corrupts my configuration once every two weeks, I don't have to reinstall Tomcat, I can just delete the server and reconfigure it.
I'm working on a project in Eclipse Version: 3.5.2
My colleague and I both checked out the same maven project from svn. I'm trying to debug it by running it in Tomcat.
He can see the run-as server option when he right-clicks the project, but I can't.
What did I forget to do?
I can't even see the server option under Window->Show View->Other
Thanks
Deployment of applications on Java EE Application Servers or containers is possible only when you have WTP installed. From the screenshots posted, I can infer that either WTP is unavailable or it hasn't been loaded by Eclipse (for some unfortunate reason).
You ought to perform one of the following:
You can get a copy of the Eclipse IDE for Java EE developers, which contains WTP by default. If you need the Galileo edition, you will need to look into the Galileo archives. Also, you should use a JDK to start Eclipse. WTP might not be available if you use a JRE.
If you do not wish to install Eclipse with WTP from scratch, install the WTP plug-ins. Use the Galileo update site for this.
If you are sure that you have WTP installed, but you are unable to find that Galileo has loaded the plug-ins, then you will need to inspect the contents of the .metadata\.log file in your workspace. This would give you a hint as to why the plug-in was not loaded. Start Eclipse with the -clean flag, to get Eclipse to detect the plug-in if it hasn't done so previously.
Note: If WTP has been installed, you should be able to confirm this by view the list of loaded features, as shown below.
Here's are some instructions I wrote up when I configured my Eclipse to work with Tomcat. Hopefully it'll help you.
Open Servers Window
Open the Servers view.
If servers view is not open, select menu item Window/Show View/Other...
Select Servers under the Server section.
Add New Server
Right Click in the Servers View select New/Server
Expand Apache and select Tomcat v5.5 Server
Click Next.
Select the directory of your Tomcat installation. (ie c:\tomcat)
Click Finish
This will be the solution for all your questions. A must read pdf.
Did you create a Web Project? If you right click on the project and go to Properties > Project Facets is Dynamic Web Module selected. This works for me.
In case of web application 3.0 in my case i have taken war file of project and deleted existing app from eclipse and replaced it with war it worked for me
This question already has answers here:
How do I import the javax.servlet / jakarta.servlet API in my Eclipse project?
(16 answers)
Closed 1 year ago.
I have tomcat 5.5 installed, running and verifiable at http://localhost:8080/. The Tomcat menu option appears in the Eclipse menu bar and I can start and stop Tomcat from there. In Eclipse, it does not show as a Server Runtime Environment in Window - Preferences - Server - Runtime Environments, nor does it appear in the list of environments that can be added when I click the "Add" button. All I see is the J2EE Runtime Library.
Edit:
Running on Windows XP.
Eclipse version is 3.5.1
In my case I needed to install "JST Server Adapters". I am running Eclipse 3.6 Helios RCP Edition.
Here are the steps I followed:
Help -> Install New Software
Choose "Helios - http://download.eclipse.org/releases/helios" site or kepler - http://download.ecliplse.org/releases/kepler
Expand "Web, XML, and Java EE Development"
Check JST Server Adapters (version 3.2.2)
After that I could define new Server Runtime Environments.
EDIT: With Eclipse 3.7 Indigo Classic, Eclipse Kepler and Luna, the steps are the same (with appropriate update site) but you need both JST Server Adapters and JST Server Adapters Extentions to get the Server Runtime Environment options.
You need to go to Help>Eclipse Marketplace . Then type server in the search box it will display Eclipse JST Server Adapters (Apache Tomcat,...) .Select that one and install it .Then go back to Window>Preferences>Server>Runtime Environnement, click add choose Apache tomcat version then add the installation directory .
I had the same problem and I solved it with the following steps
Help > Install New Software...
Select "Eclipse Web Tools Platform Repository (http://download.eclipse.org/webtools/updates)" from the "Work with" drop-down.
Select "Web Tools Platform (WTP)" and "Project Provided Components".
Complete all the installation steps and restart Eclipse. You'll see a bunch of servers when you try to add a server runtime environment.
Window > Preferences > Server > Runtime Environments (as you said)
Add
Apache > Apache Tomcat 5.5
That has worked for the past 3 versions of Eclipse at least. If there is not such an option on your eclipse, get a fresh installation (for Java EE developers).
nor does it appear in the list of environments that can be added when I click the "Add" button. All I see is the J2EE Runtime Library.
Go get "Eclipse for Java EE developers". Note the extra "EE". This includes among others the Web Tools Platform with among others a lot of server plugins with among others the one for Apache Tomcat 5.x. It's also logically; JSP/Servlet is part of the Java EE API.
You may get more success if you do a "search" for the runtime env from the preferences screen instead of hitting "add" - see this demo on youtube. http://www.youtube.com/watch?v=EOkN5IPoJVs&playnext_from=TL&videos=rVnITzSU2Z8 - When you hit search, you are prompted to point to the tomcat directory and then it SHOULD add it as a server runtime environment. Unfortunately for me, that is not the case (I get "no new server runtime environments were found") But you might have more success.
Scenario 1:
You had Eclipse showing server and now after removing the particular version you want to configure at Eclipse a new local server instance. But you can not move further.
This happens due to reason Eclipse still looks for configured version of Tomcat directory, which directory is no longer there.
There is no need till LUNA to make fresh installation!
All we need is to REPLACE the new server run time environment into eclipse after removing old one, which is non-existent. Eclipse will
Help -> check for updates upon Eclipse update solved the issue