PDA

View Full Version : Resin 4 and Liferay portal integration problem


igor
11-15-2010, 08:21 AM
I have some integration problem with Liferay portal 6.x and Resin 4.0.12. Portal is deployed as ROOT application. There is a simple resin-web.xml that contains only authenticator tag. Portal works.

When someone wants to deploy a portlet, there is a problem. Portlet is deployed as a war and is a web application. Lets say that I have deployed portlet called 'ip-geocoder-portlet' (or whatever). On the filesystem, folder 'webapps\ip-geocoder-portlet ' exist. Once again, it is just a common web app, with jsps, WEB-INF classes, libs and so on. Portlet doesn't have any resin-web.xml.

Now, I want to invoke jsp page from the portlet (not through the portal, just for the purpose of this demonstration):

http://localhost:8080/ip-geocoder-portlet/view.jsp

What I got as result is the following server error:
-------------------------------------------------------------
C:\liferay\bundles\resin-4.0.12\webapps\ROOT\WEB-INF\work\_jsp\_view__jsp.java:9:
package com.liferay.ipgeocoder.model does not exist
import com.liferay.ipgeocoder.model.IPInfo;
^
C:\liferay\bundles\resin-4.0.12\webapps\ROOT\WEB-INF\work\_jsp\_view__jsp.java:10:
package com.liferay.ipgeocoder.util does not exist
import com.liferay.ipgeocoder.util.IPGeocoderUtil;
...
-------------------------------------------------------------

It says that package doesn't exist - but it is there; in WEB-INF/classes of the portlet.

The same thing applies for the libs - portlet application (i.e. web application deployed in different context then ROOT) does not see any libs.


My guess is that Resin continues to operates inside the ROOTs context, and not the ip-geocoder-portlet, because of the following error line:
-----------------------------------------------------
...webapps\ROOT\WEB-INF\work\_jsp\...
-----------------------------------------------------

I would expected that resin compiler compiles jsps to
'...webapps\ip-geocoder-portlet\WEB-IN\work\_jsp\...'


The question is: how to make portlet (or any other web app deployed in different context) independent from the ROOT application? Or: how to make my JSP files be aware of my classes and libs (when deployed as web app in different context then ROOT)? Do I miss some configuration?


Would you be so kind to help me with this issue?

reza
11-23-2010, 03:35 PM
Igor,

Just to be sure, where do your classes and libraries reside? Are they in the ROOT web application? If so, you cannot expect them to be accessible in the class-path of another web application unless you explicitly place the classes and libraries into that web application as well. Alternatively, you can place the shared libraries in $Resin/lib so that they are accessible to all web applications.

Hope it helps,
Reza

igor
11-29-2010, 11:10 AM
Let me give some more hints on my problem:) I have the following web apps:

/ROOT - the liferay portal itself
/ip-geocoder-portlet - some simple portlet, used for testing purposes

when I go to the existing jsp: http://localhost:8080/ip-geocoder-portlet/view.jsp I've got some similar errors, where the first one is:
-----------------------------------------------------------------
C:\liferay\bundles\resin-4.0.13\webapps\ROOT\WEB-INF\work\_jsp\_view__jsp.java:9:
package com.liferay.ipgeocoder.model does not exist
import com.liferay.ipgeocoder.model.IPInfo;
-----------------------------------------------------------------

The package "com.liferay.ipgeocoder.model" and the class "com.liferay.ipgeocoder.model.IPInfo" do exist in the /ip-geocoder-portlet/WEB-INF/classes/

In the view.jsp page, this class is imported with the:

<%@ page import="com.liferay.ipgeocoder.model.IPInfo" %>

So, everything what is going on above is inside /ip-geocoder-portlet web application. Still, WEB-INF/classes seems invisible to the web application. From the first line of above error report, I see that /ip-geocoder-portlet/view.jsp is compiled in the ROOTs work folder, which seems invalid. In Tomcat, for example, it works as expected: view.jsp is compiled correctly.

So to put it simple, i have 2 web applications, where one is the ROOT. JSP imports in second web applications are not recognized, although they are there in the second WEB-INF/classes.

reza
11-30-2010, 08:56 PM
Igor,

If this is what we suspect it is, it is a very serious class-loading issue. What version of Resin are you using? I'll try to replicate the issue on my end and enter a bug report.

If you can, please set the log levels to finer or finest, post the log entries and Resin configuration.

Thanks,
Reza

igor
12-01-2010, 09:33 AM
Of course. Attached is the resin 4.0.13 config and the finest log. As you can see from the access.log, all what i did is:


start the portal
go to the http://localhost:8080/ip-geocoder-portlet/view.jsp in web browser.

reza
12-01-2010, 08:10 PM
Igor,

In a very simple web application, I am able to access WEB-INF/classes deployed classes into a simple test JSP. I am thinking there is something a bit more involved going on in your case, probably due to the differences in Tomcat and Resin class-loaders.

Does this happen when you type in the portlet URL directly or only when you try to access it from the portal? It makes a difference since this might be related to this bug: http://bugs.caucho.com/view.php?id=4284.

I'll continue trying to replicate this.

Thanks for your patience,
Reza

igor
12-07-2010, 05:27 PM
It happens when I type that manually, but also when portlet (deployed as a web app) is accessed by portal (deployed as ROOT).

The related issue seems like what I am experiencing, but it says its fixed in 4.0.14, which is not released yet;)

btw, if you want to investigate the issue more, i can give you some steps how to reproduce it on liferay - it would not be time consuming since a lot of steps are automatized with ant.

reza
01-06-2011, 01:28 AM
Igor,

I am still having a hard-time reproducing this bug. Is there any way you could pare it down to a simple application that would demostrate the problem?

Thanks,
Reza

igor
01-21-2011, 09:22 AM
Huh, Ill try. If you have time, you can try it on liferay portal as well - the process of deploying to resin is automated, it just takes time to download all the source.

igor
01-23-2011, 09:46 PM
Here is a little help:

Checkout latest Liferay portal sources from SVN trunk (e.g. using SmartSVN). For public access, you can use: svn://svn.lilferay.com/repos/public/portal/trunk

Invoke 'ant' to compile everything.

Add file in portal folder named 'app.server.<username>.properties', where username is your OS username. Enable resin:

app.server.type=resin

Invoke following to download Resin and configure it: ant -buildfile build-dist.xml unzip-resin

Deploy portal with 'ant deploy'

Every time you can invoke 'ant all' to clean everything and redeploy it again.

This should be enough to start portal on resin (start it with resin/bin/run.bat)

after that it is about to deploy portlet war, let me know if you need some.

thank you!

reza
01-26-2011, 03:46 PM
Igor,

I managed to deploy the LifeRay root application so far. Everything is functional, but I did run across what looks like a JSP compilation bug: http://bugs.caucho.com/view.php?id=4361. I am trying to deploy one of the demo portlets (Google Maps Portlet) next. Other than deploying and running the portlet war, do I need to do anything else?

I am simply using the Resin bundle for LifeRay 6.0.5 Community Edition. The bundle comes with Resin 3.1.10, but I am running the code on 4.0.14 instead (seems fairly straight-forward). Just out of curiosity, have you tried running on Tomcat?

Thanks,
Reza

P.S.: I'm a little surprised as to how heavyweight this application is; I could not run it without JVM memory parameter tweaks on my commodity developer machine and even then things are very sluggish :-0. It might be because it is a demo, though.

reza
01-26-2011, 08:14 PM
Igor,

I was able to reproduce the issue but do not have the time at the moment to drill down any further. I did enter a bug report for it: http://bugs.caucho.com/view.php?id=4362.

If possible, it will be extremely helpful to demonstrate the issue in a stripped down JSP/Servlet in order to easily identify and fix the bug.

Thanks,
Reza

igor
02-09-2011, 07:49 AM
Great Reza, at least the issue is confirmed, thank you! I will try to isolate the issue, but as you know, so many things to work on... btw, resin is not open sourced, i.e. source is not available?

Yes, I am using it with the Resin 4.0.13/4.0.14. The same scenario works on Tomcat, JBoss, Websphere... and other app servers.

Liferay portal is really big, there is a tone of things inside that are hungry for the memory;) Take also in count that demo is working on hsqldb, a lot of things are note compiled/initialized yet etc. But it can work just fine in production;)))

thank you!

reza
02-09-2011, 03:29 PM
Igor,

The source code for Resin Open Source is available (e.g. http://www.caucho.com/download/resin-4.0.15-src.zip), but the code for Resin Pro is not.

Thanks,
Reza

kevin Thomas
05-07-2011, 12:28 PM
Hi Reza,

Just out of curiosity, have you tried increasing Tomcat's maxHttpHeaderSize to see if that running!



With Regards
Kevin Thomas
Attune Infocom Inc
http://www.attuneinfocom.com
Email : contact@attuneinfocom.com
Liferay portlet Development (http://www.attuneinfocom.com/liferay-portal.html)

reza
05-09-2011, 10:18 PM
Kevin,

Not sure I follow? What does Tomcat configuration have to do with Resin?

Thanks,
Reza