How to build .war file in IDEA to deploy to Liferay?
Asked Answered
C

3

2

I have a sources of existing portlet. I changed it a bit to fix some errors and now I need to deploy fixed sources to liferay. I build war file using artifact option and deploy this war file as usual. But I still can't add my portlet on the page because I do not see it in the list. What am I doing wrong?

I use Idea 11.1 and liferay 6.0.6 if it's important.

Seems like problem with wrong war file, because others war files (which I did not compile myself) was deployed successfully.

And also, if it's important I created war files when building artifact, and do not use Ant.


logs:

09:37:09,430 INFO  [PortletAutoDeployListener:71] Copying portlets for D:\odesk_work\liferay\liferay-portal-6.0.6\deploy\Comply-Activities-portlet-6.0.5.2.war
  Expanding: D:\odesk_work\liferay\liferay-portal-6.0.6\deploy\Comply-Activities-portlet-6.0.5.2.war into D:\odesk_work\liferay\liferay-portal-6.0.6\tomcat-6.0.29\temp\20120409093709483
  Copying 1 file to D:\odesk_work\liferay\liferay-portal-6.0.6\tomcat-6.0.29\temp\20120409093709483\WEB-INF
  Copying 1 file to D:\odesk_work\liferay\liferay-portal-6.0.6\tomcat-6.0.29\temp\20120409093709483\WEB-INF\classes
  Copying 1 file to D:\odesk_work\liferay\liferay-portal-6.0.6\tomcat-6.0.29\temp\20120409093709483\WEB-INF\classes
  Copying 1 file to D:\odesk_work\liferay\liferay-portal-6.0.6\tomcat-6.0.29\temp\20120409093709483\META-INF
  Copying 119 files to D:\odesk_work\liferay\liferay-portal-6.0.6\tomcat-6.0.29\webapps\Comply-Activities-portlet
  Copying 1 file to D:\odesk_work\liferay\liferay-portal-6.0.6\tomcat-6.0.29\webapps\Comply-Activities-portlet
  Deleting directory D:\odesk_work\liferay\liferay-portal-6.0.6\tomcat-6.0.29\temp\20120409093709483
09:37:12,456 INFO  [PortletAutoDeployListener:81] Portlets for D:\odesk_work\liferay\liferay-portal-6.0.6\deploy\Comply-Activities-portlet-6.0.5.2.war copied successfully. Deployment will start in a few seconds.

looks like it crash when deploying it. becouse when I try to deploy valid portlet there are some additional info in logs like

09:13:37,874 INFO  [PortletHotDeployListener:220] Registering portlets for Comply-Activities-portlet
09:13:37,976 INFO  [PortletHotDeployListener:369] 1 portlet for Comply-Activities-portlet is available for use

UPD: Maybe someone will provide me with instruction how to build *.war properly? I think it will be enough.

Cabstand answered 8/4, 2012 at 20:43 Comment(5)
Is "as usual" you deploy it "as usual to your app server" or "as usual through Liferay's deploy directory"? What do you see in the log file? Any problems? "1 portlet for ...your plugin... ready for use"?Fleischman
as usual I mean pasting to deploy dir.Cabstand
logs are also ok. I think that the problem is in wrong war, not in liferay, because I deploy other portlets without any troublesCabstand
what are you using to build the war?Shamus
Initially I build this file creating war artifact with IDEA artifacts. But now I build it with Ant and it works. But i think it possible to make it work using IDEA sources only, but I'm such a busy now that have no time to check my idea.Cabstand
S
1

Make sure liferay-display.xml is in the WEB-INF directory in your war and that it's content is ok.

It should contain something like this:

<?xml version="1.0"?>
<!DOCTYPE display PUBLIC "-//Liferay//DTD Display 5.2.0//EN"     "http://www.liferay.com/dtd/liferay-display_5_2_0.dtd">

<display>
<category name="${liferay.category}">
    <portlet id="yourPortletID" />
    <portlet id="yourPortletID2" />
            <!-- more portlet ids -->
</category>
</display>

Maybe the build system is missing it when it creates war.

If not, put it in there manually and see if that works.

edit

Ok. Now having more information it looks like you're including servlet-api in your war. That jar (and classes inside it) are provided by portal (or, more specifically by the servlet container). The same goes for portlet-api. You shouldn't include them in the deployed application.

Check if those dependencies are specified as <scope>provided</scope> in your pom.xml.

Shamus answered 8/4, 2012 at 23:38 Comment(5)
I remove it from package but it's not help anywayCabstand
what does it say in that other log you pasted before? the one which talked about Servlet.class?Shamus
It was not in the log, but in command prompt. Actually today I work on the bit different environment and couldn't reproduce itCabstand
@Cabstand the one you posted before should be resolved by deleting servlet-api. Maybe there's another dependency provided by the portal inside your war. Check for portlet-api, your database driver if you have one in lib folder of the portal, etc.Shamus
cheeked but without any succeed. I try to remove library until I do not get 09:18:10,267 ERROR [PortletBagFactory:115] java.lang.ClassNotFoundException: com.structuredria.portlet.database.DatabasePortletCabstand
E
0

Try first undeploy the portlet from bundles/tomcat/webapps - delete the portlet dir. And then deploy the portlet again.

Extensometer answered 8/4, 2012 at 22:4 Comment(0)
C
0

Build project with ant, create war and now it works. But maybe it possible to do that without using ant, only with IDEA. I need to check it.

Cabstand answered 9/4, 2012 at 13:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.