ng.thai@comcast.net (1) [Avatar] Offline
#1
Hello,

I am leanrning Liferay.
I run the sample code hello-world-portle.java that from source code for the book Liferay_in_Action.
I got errors below:

editJSP = null
viewJSP = null

Those errors come from the 2 lines below from the cole from hello-world-portle.java:

editJSP = getInitParameter("edit-jsp");
viewJSP = getInitParameter("view-jsp");

Therefore, the program produces error: "null is is not a valid include." That come from teh code below in
hello-world-portle.java:
:

if (portletRequestDispatcher == null) {
_log.error(path + " is not a valid include");

That eror cause program stop process.

Please help me how do I fix this problem?

My email address is ng.thai@comcast.net.

Thanks a lot for your help
afshing (4) [Avatar] Offline
#2
Re: Error on Hello-World-Porlet.java
I have the same problem, and since you didn't get any answer for more than 1 year, I have no hope to get the answer!
Very poor written book!
richard.sezov (279) [Avatar] Offline
#3
Re: Error on Hello-World-Porlet.java
Hey guys,

Don't know why I didn't see this thread before, but thanks for posting in it again, afshing!

The Liferay in Action code was built for Liferay 6.0, as the book was released several months before Liferay 6.1 came out. If you're using Liferay 6.1, use a Plugins SDK for Liferay 6.1, and just generate the project as described in the book, and it will work.

The reason the one in the Liferay in Action doesn't work is that Liferay changed the parameters between 6.0 and 6.1. Instead of view-jsp, etc., the parameters are now view-template, edit-template; etc.

I hope this helps!

--Rich
afshing (4) [Avatar] Offline
#4
Re: Error on Hello-World-Porlet.java
Quick response!

I just found the problem and came to respond to it!
You were faster author! smilie
336032 (2) [Avatar] Offline
#5
Dear all,

I am desperate with this same very first exercise in the book, on chapter 2.4.1.

It says "type create.bat hello-world "Hello World" and you will get "BUILD SUCCESSFUL" but I don't, it does not work. Coming from Windows development, I am new to Java, so I don't exactly understand this first exercise that is supposed to be so simple smilie ... I spent the day on this, I noticed a better behaviour with Windows Firewall off, in which case in .ivy cache it creates several folders and files, but still shows BUILD FAILED :

I try to get help elsewhere too, but as it's very first exercise, I don't really understand what it is supposed to do behing the scene, so it's hard to understand and debug. I understand you mean that "hello-world" is an already existing portlet somewhere available and that the apache ant is going to search it for me, and does not find it, am I correct? If yes, do you know what can prevent to find it and how to move on, and if not, could you please explain what I should do? Should I create the file myself, copy it from the source code you provide?

Here is the result I get:

F:\COEProjects\plugins\liferay-plugins-sdk-6.2\portlets>create.bat hello-world "
Hello World"
Buildfile: F:\COEProjects\plugins\liferay-plugins-sdk-6.2\portlets\build.xml
[ivy:resolve] :: Apache Ivy 2.3.0 - 20130110142753 :: http://ant.apache.org/ivy/
::
[ivy:resolve] :: loading settings :: file = F:\COEProjects\plugins\liferay-plugi
ns-sdk-6.2\ivy-settings.xml
[ivy:resolve]
[ivy:resolve] :: problems summary ::
[ivy:resolve] :::: WARNINGS
[ivy:resolve] module not found: biz.aQute#bnd;2.3.0
[ivy:resolve] ==== asu-gibson: tried
[ivy:resolve] https://gibson.asu.edu/maven/biz/aQute/bnd/2.3.0/bnd-2.3.0.pom

[ivy:resolve] -- artifact biz.aQute#bnd;2.3.0!bnd.jar:
[ivy:resolve] https://gibson.asu.edu/maven/biz/aQute/bnd/2.3.0/bnd-2.3.0.jar

[ivy:resolve] ==== jboss-nexus: tried
[ivy:resolve] https://repository.jboss.org/nexus/content/repositories/releas
es/biz/aQute/bnd/2.3.0/bnd-2.3.0.pom
[ivy:resolve] -- artifact biz.aQute#bnd;2.3.0!bnd.jar:
[ivy:resolve] https://repository.jboss.org/nexus/content/repositories/releas
es/biz/aQute/bnd/2.3.0/bnd-2.3.0.jar
[ivy:resolve] ==== jboss-thirdparty: tried
[ivy:resolve] https://repository.jboss.org/nexus/content/repositories/thirdp
arty-releases/biz/aQute/bnd/2.3.0/bnd-2.3.0.pom
[ivy:resolve] -- artifact biz.aQute#bnd;2.3.0!bnd.jar:
[ivy:resolve] https://repository.jboss.org/nexus/content/repositories/thirdp
arty-releases/biz/aQute/bnd/2.3.0/bnd-2.3.0.jar
[ivy:resolve] ==== maven2: tried
[ivy:resolve] http://repo1.maven.org/maven2/biz/aQute/bnd/2.3.0/bnd-2.3.0.po
m
[ivy:resolve] -- artifact biz.aQute#bnd;2.3.0!bnd.jar:
[ivy:resolve] http://repo1.maven.org/maven2/biz/aQute/bnd/2.3.0/bnd-2.3.0.ja
r
[ivy:resolve] ==== ow2-public: tried
[ivy:resolve] http://repository.ow2.org/nexus/content/repositories/public/bi
z/aQute/bnd/2.3.0/bnd-2.3.0.pom
[ivy:resolve] -- artifact biz.aQute#bnd;2.3.0!bnd.jar:
[ivy:resolve] http://repository.ow2.org/nexus/content/repositories/public/bi
z/aQute/bnd/2.3.0/bnd-2.3.0.jar
[ivy:resolve] ==== primefaces: tried
[ivy:resolve] http://repository.primefaces.org/biz/aQute/bnd/2.3.0/bnd-2.3.0
.pom
[ivy:resolve] -- artifact biz.aQute#bnd;2.3.0!bnd.jar:
[ivy:resolve] http://repository.primefaces.org/biz/aQute/bnd/2.3.0/bnd-2.3.0
.jar
[ivy:resolve] ==== liferay-public: tried
[ivy:resolve] https://repository.liferay.com/nexus/content/groups/public/biz
/aQute/bnd/2.3.0/bnd-2.3.0.pom
[ivy:resolve] -- artifact biz.aQute#bnd;2.3.0!bnd.jar:
[ivy:resolve] https://repository.liferay.com/nexus/content/groups/public/biz
/aQute/bnd/2.3.0/bnd-2.3.0.jar
[ivy:resolve] ==== pentaho: tried
[ivy:resolve] http://repository.pentaho.org/artifactory/repo/biz/aQute/bnd/2
.3.0/bnd-2.3.0.pom
[ivy:resolve] -- artifact biz.aQute#bnd;2.3.0!bnd.jar:
[ivy:resolve] http://repository.pentaho.org/artifactory/repo/biz/aQute/bnd/2
.3.0/bnd-2.3.0.jar
[ivy:resolve] ==== soapui: tried
[ivy:resolve] http://www.soapui.org/repository/maven2/biz/aQute/bnd/2.3.0/bn
d-2.3.0.pom
[ivy:resolve] -- artifact biz.aQute#bnd;2.3.0!bnd.jar:
[ivy:resolve] http://www.soapui.org/repository/maven2/biz/aQute/bnd/2.3.0/bn
d-2.3.0.jar
[ivy:resolve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve] :: UNRESOLVED DEPENDENCIES ::
[ivy:resolve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve] :: biz.aQute#bnd;2.3.0: not found
[ivy:resolve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve]
[ivy:resolve] :::: ERRORS
[ivy:resolve] Server access Error: handshake alert: unrecognized_name url=htt
ps://gibson.asu.edu/maven/biz/aQute/bnd/2.3.0/bnd-2.3.0.pom
[ivy:resolve] Server access Error: handshake alert: unrecognized_name url=htt
ps://gibson.asu.edu/maven/biz/aQute/bnd/2.3.0/bnd-2.3.0.jar
[ivy:resolve] SERVER ERROR: Proxy Error url=http://repository.pentaho.org/arti
factory/repo/biz/aQute/bnd/2.3.0/bnd-2.3.0.pom
[ivy:resolve] SERVER ERROR: Service Temporarily Unavailable url=http://reposit
ory.pentaho.org/artifactory/repo/biz/aQute/bnd/2.3.0/bnd-2.3.0.jar
[ivy:resolve]
[ivy:resolve] :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS

BUILD FAILED
F:\COEProjects\plugins\liferay-plugins-sdk-6.2\portlets\build.xml:5: The followi
ng error occurred while executing this line:
F:\COEProjects\plugins\liferay-plugins-sdk-6.2\build-common-plugins.xml:5: The f
ollowing error occurred while executing this line:
F:\COEProjects\plugins\liferay-plugins-sdk-6.2\build-common.xml:47: The followin
g error occurred while executing this line:
F:\COEProjects\plugins\liferay-plugins-sdk-6.2\build-common-ivy.xml:34: The foll
owing error occurred while executing this line:
F:\COEProjects\plugins\liferay-plugins-sdk-6.2\build-common-ivy.xml:50: impossib
le to resolve dependencies:
resolve failed - see output for details

Total time: 2 minutes 7 seconds

Thank you so much if you can help ...
336032 (2) [Avatar] Offline
#6
Hi,

You need to add this stupid biz.aQute jar in your code, otherwise it won't work, I lost hours on same issue. Not easy at all for unexperienced users in Java & LR to work with the Liferay in Action book; the book is great, but the code evolved so much that nothing works / compiles directly, so you lose more time trying to understand and make smth work than learning, it's a pity.

I hope author will be able to update the book to a recent version of LR and update code sources as well.

Tanguy
265701 (1) [Avatar] Offline
#7
Errors on the Hello-You-Portlet.java - Fixed
To anybody that would like to get this code working in the Chapter 2 example with Version 7 of Liferay, there are several changes required either due to a spelling mistake or a change to the Liferay API.

Item 1: Change the view.jsp code to downcase username in two places.
- <jsp:useBean id="username" class="java.lang.String" scope="request" />
- <p>Hello <% username %>!</p>

This will match the parameter name in the portlet code.

Item 2: Change the edit.jsp code to add a namespace for the "username" item in the form.
- <td> <input type="text" name="<portlet:namespace /> username"></td>

This is necessary due to a change in Version 6.2 of Liferay.

Item 3: Change a couple of lines in HelloYouPortlet.java.
- String addName = actionRequest.getParameter("username") [ change to username from addName]
- prefs.setValue("name", addName); [remove the actionRequest.getParameters as you already have this value in addName]

With these changes, I was able to get the portlet deployed in Liferay and complete the exercise. I was using the Eclipse (Oxygen Release) with the Liferay Plugin SDK from Liferay CE Version 7.0.3.

Hope this helps out anyone.