Foren

Home » Liferay Portal » English » 3. Development

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
Sudheer Chekka
Portlets not getting registered (liferay in non-root context)
13. August 2008 09:35
Antwort

Sudheer Chekka

Rang: New Member

Nachrichten: 13

Eintrittsdatum: 1. Juli 2008

Neue Beiträge

Hi,

I have installed liferay on an existing tomcat server (i.e. not as a ROOT project).
I am having a problem when hot deploying a new portlet with this set up. I get a "...copied successfully" message followed by "Root WebApplicationContext: initialization completed..." message but I don't get the "Registering portlets for..." message.
And so this portlet won't show up in the "Add Application" list.

The same portlet registers successfully if I hot deploy in a setup where liferay is running as ROOT on a tomcat server.

What could be the problem ?

Thanks,
Sudheer.
Krista M Leopold
RE: Portlets not getting registered (liferay in non-root context)
2. November 2009 12:44
Antwort

Krista M Leopold

Rang: New Member

Nachrichten: 24

Eintrittsdatum: 6. Oktober 2009

Neue Beiträge

I realize it is a year later, but I have this same question and don't think I need to ask it in a new thread. I will simply pose the question a different way: is there a trick to auto-deploying a hook in a non-root context? I have liferay running successfully. I have been able to successfully deploy my hook on an unmodified bundle, using the SDK. But on my test server (the non-root context), I have tried both transferring the war file directly to the the deploy directory (tomcat_home/../deploy) and uploading it via the plugins installer. Neither works.

All I want to do is modify the registration page (custom_attributes.jsp) to take a few more parameters. This has to be a common thing... can someone point me to the right resources, please?

I need it to deploy on
Tomcat 6.0.18
Liferay 5.2.3
Solaris 10 OS

(using the tomcat bundle on Windows XP for the initial test that worked.)

My appreciation for any and all answers, tips, tricks, and general love.

Krista
Tomáš Polešovský
RE: Portlets not getting registered (liferay in non-root context)
3. November 2009 13:01
Antwort

Tomáš Polešovský

LIFERAY STAFF

Rang: Expert

Nachrichten: 492

Eintrittsdatum: 13. Februar 2009

Neue Beiträge

Hi Krista,

I am not sure if I can help you in your manner of love, but maybe some hints to the Liferay ;)

The hooks (and other plugins) are registered using com.liferay.portal.kernel.servlet.HookContextListener (and other *ContextListener) in the web.xml. The definition is (or should be) written at least during deploy. Check if you have it in your deployed web.xml.

The 2nd hint - did you deploy the application yourself? There must be some jars (portal-kernel.jar, portal-service.jar, ...) in the tomcat's lib directory beside the Liferay war.

Is something in the logs?

-- tom
Krista M Leopold
RE: Portlets not getting registered (liferay in non-root context)
5. November 2009 07:43
Antwort

Krista M Leopold

Rang: New Member

Nachrichten: 24

Eintrittsdatum: 6. Oktober 2009

Neue Beiträge

I appreciate your hints, Tomas. Very loving, indeed!

1) I checked my deployed app: web.xml has an entry for HookContextListener. There are no other Context Listeners included in the file. Am I missing one? Here are the full contents of that file:

1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">            
3<web-app>
4        <display-name>customjsp-hook</display-name>
5        <listener>
6                <listener-class>com.liferay.portal.kernel.servlet.HookContextListener</listener-class>
7        </listener>
8</web-app>


2) I did deploy the application myself. I tried two methods. First, on my workstation, using the tomcat bundle and the SDK, I built a .war following the directions in this tutorial: Custom Attributes and JSP Hooks . It worked on my machine, as expected. However, when I dropped it into the auto-deploy directory on my test server (the Solaris box, running apache and tomcat and liferay non-context), it failed. The second method was to create an sdk directory on my test server and follow the instructions again, this time letting the ant deploy command take care of everything. This also failed. In both cases, I see the same thing in the catalina logs:

 114:59:13,273 INFO  [AutoDeployDir:183] Processing customjsp-hook-5.2.3.1.war
 214:59:13,282 INFO  [HookAutoDeployListener:53] Copying web plugin for /usr/local/deploy/customjsp-hook-5.2.3.1.war
 3  Expanding: /usr/local/deploy/customjsp-hook-5.2.3.1.war into /usr/local/tomcat6/temp/20091105145913296
 4  Copying 1 file to /usr/local/tomcat6/temp/20091105145913296/WEB-INF/classes
 5  Copying 1 file to /usr/local/tomcat6/temp/20091105145913296/WEB-INF/classes
 6  Copying 1 file to /usr/local/tomcat6/temp/20091105145913296/WEB-INF
 7  Copying 15 files to /usr/local/tomcat6/webapps/customjsp-hook
 8  Copying 1 file to /usr/local/tomcat6/webapps/customjsp-hook
 9  Deleting directory /usr/local/tomcat6/temp/20091105145913296
1014:59:14,438 INFO  [HookAutoDeployListener:59] Web plugin for /usr/local/deploy/customjsp-hook-5.2.3.1.war copied successfully. Deployment will start in a few seconds.
1114:59:52,822 INFO  [PluginPackageUtil:1153] Reloading repositories
12Loading jar:file:/portal/liferay-main/WEB-INF/lib/portal-impl.jar!/content-types.properties


/usr/local/tomcat6 is our tomcat home, but /portal/liferay-main is the directory where liferay is running.

I'm investigating whether what Ray says in his blog here has anything to do with it, but the sdk automatically adds those numbers -- I can't get rid of them without modifying the build script, which I hesitate to do. Whatcha think?

Again, I thank you for your help!!!
Tomáš Polešovský
RE: Portlets not getting registered (liferay in non-root context)
5. November 2009 10:45
Antwort

Tomáš Polešovský

LIFERAY STAFF

Rang: Expert

Nachrichten: 492

Eintrittsdatum: 13. Februar 2009

Neue Beiträge

Hi,

The numbers are not a problem. If you want to check it, you can rename your war file and delete the numbers (customjsp-hook.war). But I don't think it would help you.

Check the rules for developing a hook (as I wrote here Creating a Hook). The war file should meet these requirements:
1, It contains liferay-plugin-package.properties
2, It contains liferay-hook.xml
3, The war file name contains “-hook” string
4, The war file name doesn’t contain “-portlet” string

I see that the points 3, and 4, are OK. But I don't know about the 1, and 2, you should check them.

UPDATE:

Maybe the HookContextListener isn't called (the application isn't initialized). Try to create another ContextListener and print on the std. output some debug info.

Or you can mail me your war file and I can check if it is problem with the file of with the Tomcat.

--tom
Krista M Leopold
RE: Portlets not getting registered (liferay in non-root context)
6. November 2009 12:29
Antwort

Krista M Leopold

Rang: New Member

Nachrichten: 24

Eintrittsdatum: 6. Oktober 2009

Neue Beiträge

I finally have my hook working! Thank you so much Thomas for your patience and advice. Here is the configuration that works for me:

Set up: Tomcat 6.0.18 on Apache 2 Server, Liferay 5.2.3, Solaris 10
tomcat home is /usr/local/tomcat.
Web Apps directory is /portal
liferay home is /portal/liferay-main

portal-ext.properties:
 1
 2portal.ctx=/liferay-main
 3liferay.home=/portal/liferay-main
 4auto.deploy.listeners=\
 5com.liferay.portal.deploy.auto.HookAutoDeployListener,\
 6com.liferay.portal.deploy.auto.LayoutTemplateAutoDeployListener,\
 7com.liferay.portal.deploy.auto.PortletAutoDeployListener,\
 8com.liferay.portal.deploy.auto.ThemeAutoDeployListener,\
 9com.liferay.portal.deploy.auto.WebAutoDeployListener,\
10com.liferay.portal.deploy.auto.exploded.tomcat.LayoutTemplateExplodedTomcatListener,\
11com.liferay.portal.deploy.auto.exploded.tomcat.PortletExplodedTomcatListener,\
12com.liferay.portal.deploy.auto.exploded.tomcat.ThemeExplodedTomcatListener
13
14auto.deploy.enabled=true
15auto.deploy.deploy.dir=/usr/local/deploy
16#auto.deploy.deploy.dir=/portal/liferay-main/deploy
17auto.deploy.dest.dir=/portal/
18auto.deploy.tomcat.conf.dir=/usr/local/tomcat6/conf/Catalina/localhost
19auto.deploy.tomcat.lib.dir=/usr/local/tomcat6/lib/ext


In the SDK environment where I built my hook, this is my build.$krista.properties file:
1
2    app.server.dir=/usr/local/tomcat6
3    app.server.classes.portal.dir=${app.server.portal.dir}/WEB-INF/classes
4    app.server.lib.global.dir=${app.server.dir}/lib/ext
5    app.server.lib.portal.dir=${app.server.portal.dir}/WEB-INF/lib
6    app.server.portal.dir=/portal/liferay-main



Also in the SDK environment, here is my liferay-plugin-package.properties file. The trick for me here was to remove items that I had mistakenly put on the required-deployment-contexts line.:

 1name=customjsp
 2module-group-id=liferay
 3module-incremental-version=1
 4tags=
 5short-description=This hook contains a custom Create Accounts JSP
 6change-log=
 7page-url=https://127.0.0.1/liferay-main
 8author=Liferay, Inc.
 9licenses=MIT
10required-deployment-contexts=


I really hope that helps someone else with their non-root hot deployments!
Tomáš Polešovský
RE: Portlets not getting registered (liferay in non-root context)
7. November 2009 14:15
Antwort

Tomáš Polešovský

LIFERAY STAFF

Rang: Expert

Nachrichten: 492

Eintrittsdatum: 13. Februar 2009

Neue Beiträge

That's great you've done it.

required-deployment-contexts, Hmm. Such a simple thing can cause such a big problem emoticon

Thank you for letting know.