Liferay IDE portlet changes not synchronized on the server - java

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.

Related

How to debug web service with Eclipse Websphere liberty

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:

Auto deploy changed java code in Maven, Eclipse, Glassfish

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.

How to run an OpenShift JBoss AS 7 app on localhost through Eclipse(Kepler)?

I tried to run an OpenShift JBoss AS 7 app through Eclipse as a normal JBoss AS 7 App but it doesn't seem to work. I have the OpenShift JBoss Tools installed in eclipse.
However when I try to run it through Run As --> Run on Server and then selecting the "jboss-as-7.0.1.Final Runtime Server" listed in the "Servers" view, I get the error
"the selection does not contain any resources that can run on a server".
To solve this I changed the project facet to Dynamic Web Module, then I again tried running it on JBoss server, but the application doesn't deploy and I get a 404 error on accessing its localhost url.
I also noticed that the JBoss Server's status in my eclipse "Servers" view is always shown as "Starting"(doesn't change to "Started"), although the Console shows something like "JBoss AS 7.0.1.Final "Zap" started in 2236ms"
Take a look at https://www.openshift.com/blogs/day-28-openshift-eclipse-integration-for-java-developers. That should point you in the right direction.
I am doing right now, what you want to do. I have a Project which is deployable on OpenShift and on my local installation of the jboss 7.1.
It is very strange that eclipse shows your jboss as always starting. I would recommend to delete the server in eclipse and try to add it again. Also you can add the project in the servers view. For that you right click your server and choose "Add and Remove...". You can choose the Project, add it to the server and eclipse is deploying it.
Which version of JBoss Tools are you running ? There have been some issues with detection of the server running in past where you can workaround this issue of the server not launching by changing the "Startup poller" to "web poller" or "timeout poller".
btw. if you needed to change your project to be a dynamic web project that indicates to me you have not actually imported the project as a maven project and had all of JBoss Tools installed (or at least M2e-wtp) which would normtally automatically make the import of the default openshift apps into a dynamic web project.

Tomcat 6.0 and Eclipse. Multiple instances of the server behave differently

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.

Apache Tomcat Not Showing in Eclipse Server Runtime Environments [duplicate]

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

Categories

Resources