Java Studio Creator 2 and Liferay Portal Server Update

I thought I would give some update on Java Studio Creator 2 portlets running on Liferay portal server.

Liferay 4.0

To get Java Studio Creator 2 update 1 portlets to work correctly on  Liferay 4.0 you will need to remove the "lib/portlet.jar" file and the "tld" folder from the WAR file.  I have a defect filed against Java Studio Creator to permanently remove the "portlet.jar" file from the portlet since all portal servers will most likely supply this at the container level.

Liferay 4.1

The good news is that you  don't have to worry about removing the "portlet.jar" file nor the "tld" folder from the WAR file in 4.1.  There are, however, some other issues.

 Apparently Liferay 4.1 does not support the Servlet 2.4 spec in a web.xml.

I've tried with both

<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

and

<web-app version="2.4">

But both trigger the following exception.


org.dom4j.DocumentException: Error on line 3 of document  : Document is invalid: no grammar found. Nested exception: Document is invalid: no grammar found.
        at org.dom4j.io.SAXReader.read(SAXReader.java:482)
        at org.dom4j.io.SAXReader.read(SAXReader.java:365)
        at com.liferay.portal.service.impl.PortletLocalServiceImpl._readWebXML(PortletLocalServiceImpl.java:983)
        at com.liferay.portal.service.impl.PortletLocalServiceImpl.initWAR(PortletLocalServiceImpl.java:259)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)



I've done some debugging in the liferay code and the exception is thrown in this part of the code.

PortletLocalServiceImpl.java -
    private List _readWebXML(String xml) throws DocumentException, IOException {
        List servletURLPatterns = new ArrayList();

        if (xml == null) {
            return servletURLPatterns;
        }

        SAXReader reader = new SAXReader(true);

        reader.setEntityResolver(new EntityResolver());

=====>        Document doc = reader.read(new StringReader(xml));

        Element root = doc.getRootElement();

        Iterator itr = root.elements("servlet-mapping").iterator();


I'm not familiar with the 3.6 codebase so I don't know if dom4j's SAXReader was used or if it always used the "true" option to validate the schema.  In any case, apparently it has a problem resolving the schema for servlet 2.4.

Work Around:

In Java Studio Creator 2 update 1, choose the J2EE 1.3 as the target WAR type when you do the export WAR.  The dialog will look like this.

export war
Comments:

pls can u give me ur e-mail address. i am working on liferay portal developing portlets with sun studio creator. after following what u said my porlets is still not working. so i need to post u the error so u can help me. pls

Posted by guest on August 24, 2006 at 07:32 PM MDT #

I Like what u are doing keep up the good work

Posted by Augustine on August 24, 2006 at 07:35 PM MDT #

Augustine,
Please try the Creator forum to find answers about your portlet development first. Post your question and the problem you are having so the community can get involved. If you can't find what you are looking for there, the Creator team will jump in to help.
Thanks!
-David

Posted by David Botterill on August 25, 2006 at 12:44 AM MDT #

Hello!

o What happens if you don't remove "lib/portlet.jar" file and the "tld" folder from the WAR file?

o Just using "standard" components and not using "basic" components of creator for liferay portlet development is very unsatisfying. Have you made experience with basic tables bound to dataproviders in liferay?

Thank you in advance

Posted by DonAdrano on September 20, 2006 at 10:41 PM MDT #

I did the 1.3 and it works great! I did remove the jsf lib from the sar in jboss and replace with the creator standard.jar and jstl.jar. I also had to remove the portlet.jar. I did not remove the tld but my portlet loses content when I mouse over the header bar so maybe thats associated.

Posted by Joel R Fradkin on October 03, 2006 at 01:49 PM MDT #

Here are some answers DonAdrano.
o What happens if you don't remove "lib/portlet.jar" file and the "tld" folder from the WAR file?

In 4.0, the portlet.jar would cause a ClassCastException because the class was found by multiple class loaders.

o Just using "standard" components and not using "basic" components of creator for liferay portlet development is very unsatisfying. Have you made experience with basic tables bound to dataproviders in liferay?

Yes. You should have no problems using dataproviders and basic tables. Please always be aware, however, that when you are using absolute positioning, if the table is too long (number of rows), the content will bleed onto the content below it.

Posted by David Botterill on October 04, 2006 at 03:19 AM MDT #

One follow-up to using long tables - Java Studio Creator surrounds the portlet with a DIV tag so if you modify that DIV tag's style attribute so that overflow is handled with a scrollbar. In the case of large portlets, the content should be contained (no bleeding.) I have no problems deploying an EE1.4 exported WAR from Java Studio Creator to Liferay 4.1.2. Perhaps they fixed the problem by now? I use Liferay's autodeploy option and just copy my WAR file to that location. Checking the log files shows Liferay manipulating the web.xml file in some way, but I'm not sure how. I checked the web.xml file after Liferay successfully deployed it, and it reads web-app version="2.4".

Posted by Jeff Daily on November 14, 2006 at 05:42 AM MST #

i'am the same DonAdrano
i try diff way, portlet deploy and work but whith trouble
>> my portlet loses content when I mouse over the header bar so maybe thats associated.
how to resolve it ???

Posted by earl on November 17, 2006 at 10:17 PM MST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

David Botterill

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today