Saturday August 05, 2006
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.

Posted by david
( Aug 05 2006, 09:38:16 PM MDT )
Permalink

|

|
Trackback URL: http://blogs.sun.com/david/entry/java_studio_creator_2_and
Posted by 82.128.10.52 on August 25, 2006 at 02:32 AM MDT #
Posted by Augustine on August 25, 2006 at 02:35 AM MDT #
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 07:44 AM MDT #
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 21, 2006 at 05:41 AM MDT #
Posted by Joel R Fradkin on October 03, 2006 at 08:49 PM MDT #
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 10:19 AM MDT #
Posted by Jeff Daily on November 14, 2006 at 01:42 PM MST #
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 18, 2006 at 06:17 AM MST #