How to deploy portlets to Liferay? - java

I have faced problems in trying to install new portlets to Liferay running on Glassfish domain. I figured out the flow very lately and want to share it with others also. So, please read the answer and hope this helps someone :)
(Pre requisites for the problem is that I knew that adding projects running on Glassfish is done with a autodeploy folder, but making them visible on Liferay was another story.)

So, you make first a .war file let's say a portlet of name your_file.war. You wanna have it running on a glassfish domain under Liferay portal.
Steps to success:
1) Navigate to Control Panel -> Plugins Installation on Liferay
2) hit Install new portlets
3) hit Configuration
4) Fill in to Deploy Directory a new place for deployment let's say [your domain]/autodeploy2
5) Check that in the next line target is [your domain]/autodeploy (it is the Glassfish default deployment directory)
6) hit save
Now deployment will be done by copy pasting files to that new directory [your domain]/autodeploy2. The rest of it is handled automatically. Setting takes action imediatedly.
Done with deployment: Make a victory jig and enjoy :)
..you stop dancing and face a bug. You want a new revision to be deployed.. In this case, continue reading.
So, you have built your war again and want to re-deploy. Do the following:
1) undeploy old stuff from (your domain)/autodeploy folder by deleting the war file. Don't delete any other file.
2) result is that your_file.war_UnDeployed file will appear.
3) deploy new file by copying the newly built war in (your domain)/autodeploy2 folder.
4) result is that your_file.war_deployed will appear in (your domain)/autodeploy folder.
Make a dance again :)

There is several methods to deploy plugins (portlets, hooks, filters...) into your Liferay Portal.
If you're using Administration you can do it as Mico descripted. but if you're using Maven, Gradle, Ant, Ivi... you can configure their deployment descriptors and redirect their outputs (that are the wars) to the hotdeploy server folder (If you're using Tomcat, JBoss, Glassfish...).
This approach is quite better because you can create backup webapp folder and restore it whenever you want easily.

Below are not for Glassfish but common startup steps:
To install a portlet in lliferay portal
• first install liferay portal from below link
http://www.liferay.com/en_GB/community/wiki//wiki/Main/Liferay+IDE+Getting+Started+Tutorial
this requires installation of
liferay ide
liferay portal bundled with tomcat
add this tomcat as run server time and start it, it will start liferay portal
• create a portlet application
• open liferay at localhost:8080 and goto Admin -> control panel
• goto Plugins Configuration
• goto Intall tab and give location of war file (some logging error might come
at tomcat console, ignore it)
• again goto home page at localhost:8080 and click + button
• go at the bottom in the list and u will find ur portlet
• click add button present at the right side of it and ur portlet would be added to the page.
Modifying code of portel requires to uninstall and install again the portlet from war file.
All existing added portlets would also be modified.

Related

Project won't launch on Google Cloud Tools for Eclipse

I've been trying to switch from the Google Eclipse Plugin to Cloud Tools for Eclipse, but I can't get a working launch configuration.
When I try to launch the project, the progress shows
Preparing launch delegate...: Launching delegate...
until it is finally aborted with
Server App Engine Standard at localhost (2) was unable to start within
240 seconds. If the server requires more time, try increasing the
timeout in the server editor.
It's a maven project with Java on App Engine.
I have created a hello world maven project which launches fine.
When I examine the org.eclipse.wst.server.core/tmpX folder of the hello world project, I see various files and directories such as index.jsp, META-INF and WEB-INF, with WEB-INF/lib containing the maven dependency jars.
The same folder for my project contains only WEB-INF/classes which contains a wierd collection of files, including another WEB-INF with an empty lib
I'm running "Google Cloud Platform for Eclipse 4.5 and later 1.2.0.201706082053" on Oxygen Release (4.7.0), although the issues has always existed since I first tried to migrate end of 2016
Any suggestions?
tomcat unable to start within 240 seconds, go to server view Double click on your server, you can see Right corner of the server property Window max Time out option, change it to more the 240 second. and also check your configuration.

Running webapplications on spring TC server with IntelliJ IDEA [duplicate]

Using Netbeans, I develop sites with Tomcat as the local server to manage it.
In Netbeans it was "Install, write hit Run and it works"
How do I pull the same thing off in IntelliJ?
I can't find step-by-step instructions for this.
NOTE: Community Edition doesn't support JEE.
First, you will need to install a local Tomcat server. It sounds like you may have already done this.
Next, on the toolbar at the top of IntelliJ, click the down arrow just to the left of the Run and Debug icons. There will be an option to Edit Configurations. In the resulting popup, click the Add icon, then click Tomcat and Local.
From that dialog, you will need to click the Configure... button next to Application Server to tell IntelliJ where Tomcat is installed.
Here is step-by-step instruction for Tomcat configuration in IntellijIdea:
1) Create IntellijIdea project via WebApplication template. Idea should be Ultimate version, not Community edition
2) Go to Run-Edit configutaion and set up Tomcat location folder, so Idea will know about your tomcat server
3) Go to Deployment tab and select Artifact. Apply
4) In src folder put your servlet (you can try my example for testing purpose)
5) Go to web.xml file and link your's servlet like this
6) In web folder put your's .jsp files (for example hey.jsp)
7) Now you can start you app via IntellijIdea. Run(Shift+F10) and enjoy your app in browser:
- to jsp files: http://localhost:8080/hey.jsp (or index.jsp by default)
- to servlets via virtual link you set in web.xml : http://localhost:8080/st
Which version of IntelliJ are you using? Note that since last year, IntelliJ exists in two versions:
Ultimate Edition, which is the complete IDE
Community Edition, which is free but does not support JavaEE developments.
(see differences here)
In case you are using the Community Edition, you will not be able to manage a Tomcat installation.
In case you are using the Ultimate Edition, you can have a look at:
The FAQ for Netbeans users (see question How do I configure a web framework for my project?).
IntelliJ Ultimate edition "Help": Run/Debug Configuration: Tomcat Server
You can also debug tomcat using the community edition (Unlike what is said above).
Start tomcat in debug mode, for example like this:
.\catalina.bat jpda run
In intellij:
Run > Edit Configurations > +
Select "Remote"
Name the connection: "somename"
Set "Port:" 8000 (default 5005)
Select Run > Debug "somename"
Please verify that the required plug-ins are enabled in Settings | Plugins, most likely you've disabled several of them, that's why you don't see all the facet options.
For the step by step tutorial, see: Creating a simple Web application and deploying it to Tomcat.
The problem I had was due to the fact that I was unknowingly editing the default values and not a new Tomcat instance at all. Click the plus sign at the top left part of the Run window and select Tomcat | Local from there.
In Netbeans you can right click on the project and run it, but in IntelliJ IDEA you have to select the index.jsp file or the welcome file to run the project.
this is because Netbeans generate the following tag in web.xml and IntelliJ do not.
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

not able to deploy portlet war in liferay

I am tying to place war file into tomcat's deploy folder. It is not getting deployed. When I try to deploy it using install plugins from control panel, I am getting error like.
eDeployer:971] Not updating SamplePorject because version 6.2.1 is newer than version 6.2.0.1
I noticed that, I am using Liferay 6.2 GA1 sdk and try to deploy in folder. Later on I changed my SDK to Liferay 6.2 GA2. but Still I am getting the error.
Do I need to change the run time environment as well.
my generated war is having version 6.2.0.1.
Add liferay-versions=6.2.0+ in .../WEB-INF/liferay-plugin-package.properties file.
Liferay appears to store its own version in the RELEASE_ table in the database (BUILDNUMBER column) and compare artifacts that you try to deploy against that version. I ran into a similar error trying to deploy a .lar file. I was able to work around it - you can try to update the database, or find the manifest or other entries in your artifact that have 6.2.1, but ultimately that will end in tears and you probably are best off updating your runtime, unless the SDK provides some way to target previous versions at build time.
Old thread, but maybe it still helps anyone.
The error you are getting is at AutoDeploy process. In that process, Liferay takes your war and injects some files in it. Finally the generated war goes to your auto deploy destination dir (auto.deploy.dest.dir).
By default this dest dir is the same as your hot deploy dir, and in your case there is already one war for the same plugin in that folder, as you tried the autodeploy first. That's why you're getting versioning conflicts.
You should remove the war from autodeploy folder before trying to deploy it from Control Panel. And then look for the actual reason of your hot deploy not working.
Uninstall the portlet with the higher version.Log in as admin then go to:
Control Panel > Manage Apps
Find portlet with higher version
Click on the Actions button then select uninstall
Then click Control Panel > Install
Install portlet with the lower version

Issue Glassfish 4 doesn't appear glassfish-web

I'm trying to create a descriptor file for my Java web application project.
For this project i am using:
Netbeans 8.0 &
GlassFish 4
When I try to create the glassfish descriptor file. Netbeans shows into the dialog window that is going to create a file called sun-web.xml instead of glassfish-web.xml.
I was looking for this on the internet and found that the first one sun-web.xml is created for version older than 3, and the version 4 should create a file with the name glassfish-web.xml.
I'm following a tutorial where a person is using the same tools that I have. But in the tutorial he can create a glassfish-web.xml file.
Another error raise when I click the finish button with the intention of create the sun-web.xml file and an error popup raise a show me this message:
"Deployment Configuration for this project not found. Deployment descriptor version could not be set properly"
Can't anyone help me please ???
Thank you a lot!!
You should be able to use that sun-web.xml file fine, it might change in a couple of ways like for example when you want to add a security role mapping, NetBeans won't be able to automatically fill in the security role names from your web.xml, but if you fill them in manually and correctly you should be fine.
Actually, I had the same problem, so what I did was erase all versions of Glassfish (I use OSX so I erased the folders from Applications > Netbeans > GlassFish and from Users/MyUser/GlassFish_Server), added a new server in NetBeans Services > Servers > right click add server and follow the wizard, when you get to step 2 (Server location) click download now and that will reinstall glassfish, restart NetBeans and now when you try to create a Glassfish descriptor it should be properly named as glass fish-web.xml
Hope this helps :)
I simply changed version Java EE 7 to Java EE 5 when creating new project at 3rd step Server and Settings and it could create glassfish-web.xml. I'm using same versions of Netbeans and Glasssfish. Hope may this will help you.

Can't Save "Is a Tomcat Project" setting in Eclipse Project Properties

I have a Spring MVC project that I've been deploying to Tomcat (installed both locally and on a server). I'm using Eclipse Indigo as my IDE. To deploy, I had been right clicking and choosing "run on server", which would run fine on localhost. For deploying a WAR to the actual server, I had been right clicking on Project, selecting Export, and going through the wizard to deploy a WAR file.
My Eclipse/Java is rusty, but I did remember that when I used it a couple of years back, I was using the Sysdeo plugin for Tomcat that would give me an option for Deploy to War right from the right click context. So, I poked around and found "Mongrel", which I installed. With that in place, I went to Mongrel under preferences, and set up my Tomcat version, so that I can click the little start/stop Tomcat icons and start/stop the server. This was successful.
What I can't now do for the life of me is, in Project Properties->Tomcat, choose "Is a Tomcat Project". I check the checkbox and then click Apply and/or OK to dismiss the window, and when I open it again, my setting is not recorded. I have tried checking the box and adding other options (like context name, path for a WAR file export, root sub-directory, and activating dev loader), but nothing I do "sticks".
Can someone tell me what I'm missing, or at least point me in the right direction? I'm stumped.
Thanks in advance.
I know this may be a late answer, but as I had the same issue today, I figure I could post my findings here.
I had the exact same problem as yours when I installed mongrel from the eclipse marcket place.
The solution for me was to uninstall mongrel, delete the plugin folder in the plugin directory of eclipse and then get the plugin from the project page on sourceforge.

Categories

Resources