Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PortletDevelopment: How to access page properties?

398 views
Skip to first unread message

nis...@gmail.com

unread,
Oct 8, 2007, 3:57:34 AM10/8/07
to
Hi guys,

I am trying to access the Navigation three of portal. I have used following code to generate sample tree. While compiling this code jsp it gives excetion on NavigationSelectionModelHome class not found. and package not on classpath.

In fact I want to use Model API of portal server. But I am not sure how to load this api in classpath.

try{
Context ctx = new InitialContext();
NavigationSelectionModelHome home = (NavigationSelectionModelHome)
ctx.lookup("portal:service/model/NavigationSelectionModel");
if (home != null) {
NavigationSelectionModelProvider provider =
home.getNavigationSelectionModelProvider();
NavigationSelectionModel model =
provider.getNavigationSelectionModel(request, response);

Hope you can help me in this context.

Thanks in advance.

JSP is attached with full code

Jaydeep.

nis...@gmail.com

unread,
Oct 8, 2007, 6:46:56 AM10/8/07
to
There are hundred of JARs. And It should be some standard way to include the class to classpath.

B'cos exception is comming in theme resourece.

Can u tell me which jar file contains Model API

radhakris...@gmail.com

unread,
Oct 8, 2007, 6:30:12 AM10/8/07
to

Search for com.ibm.portal.model.NavigationSelectionModelHome in the JAR's in /PortalServer/shared/app and include that JAR.

Thanks,
Mohan

Jim Barnes

unread,
Oct 8, 2007, 7:14:37 AM10/8/07
to
Is this compilation at run time or in RAD? If in RAD just to your web project add the portal server runtime, and the portal server JDK, if at run time, where are you putting the jsp? as a web app, how did you install it?
IBM Certified System Administrator -- WebSphere Portal V6.0, V5.1, V5.0
IBM Certified Solution Developer -- WebSphere Portal V5.1, v6.0

The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM

nis...@gmail.com

unread,
Oct 8, 2007, 8:05:25 AM10/8/07
to
It is compilation at run time. To be more clear it is not Web project or not at all in my web project. It is part of Default.jsp in theme in Portal server.

I am adding jsp (attahced in first post) in Default.jsp. And after I start my portal server. It Just shows following errors on console followed by stack trace.


[10/8/07 14:02:18:868 CEST] 520f88cc PortalServer E com.ibm.wps.services.dispatcher.DispatcherServiceImpl handleRequest EJPFD0004E: Fejl under kald til programfordeler. - StackTrace follows...
[10/8/07 14:02:19:048 CEST] 520f88cc PortalServer E com.ibm.wps.services.dispatcher.DispatcherServiceImpl handleRequest TRAS0014I: The following exception was logged javax.servlet.ServletException: Unable to compile class for JSP
C:\BDRAD\Workspaces\MEPWorkspace\.metadata\.plugins\com.ibm.wtp.server.core\tmp1\cache\localhost\WebSphere_Portal\wps\wps.war\themes\html\BDTheme\_Default.java:3: package com.ibm.portal.model does not exist
import com.ibm.portal.model.NavigationSelectionModelHome;
^

C:\BDRAD\Workspaces\MEPWorkspace\.metadata\.plugins\com.ibm.wtp.server.core\tmp1\cache\localhost\WebSphere_Portal\wps\wps.war\themes\html\BDTheme\_Default.java:4: package com.ibm.portal.model does not exist
import com.ibm.portal.model.NavigationSelectionModelProvider;
^


An error occurred between lines: 12 and 26 in the jsp file: /themes/html/BDTheme/./breadcrumb.jsp

Generated servlet error:
C:\BDRAD\Workspaces\MEPWorkspace\.metadata\.plugins\com.ibm.wtp.server.core\tmp1\cache\localhost\WebSphere_Portal\wps\wps.war\themes\html\BDTheme\_Default.java:273: cannot resolve symbol
symbol : class NavigationSelectionModelHome
location: class org.apache.jsp._Default
NavigationSelectionModelHome home = (NavigationSelectionModelHome)
^


An error occurred between lines: 12 and 26 in the jsp file: /themes/html/BDTheme/./breadcrumb.jsp

Generated servlet error:
C:\BDRAD\Workspaces\MEPWorkspace\.metadata\.plugins\com.ibm.wtp.server.core\tmp1\cache\localhost\WebSphere_Portal\wps\wps.war\themes\html\BDTheme\_Default.java:273: cannot resolve symbol
symbol : class NavigationSelectionModelHome
location: class org.apache.jsp._Default
NavigationSelectionModelHome home = (NavigationSelectionModelHome)
^


An error occurred between lines: 12 and 26 in the jsp file: /themes/html/BDTheme/./breadcrumb.jsp

Generated servlet error:
C:\BDRAD\Workspaces\MEPWorkspace\.metadata\.plugins\com.ibm.wtp.server.core\tmp1\cache\localhost\WebSphere_Portal\wps\wps.war\themes\html\BDTheme\_Default.java:276: cannot resolve symbol
symbol : class NavigationSelectionModelProvider
location: class org.apache.jsp._Default
NavigationSelectionModelProvider provider =
^
Note: C:\BDRAD\Workspaces\MEPWorkspace\.metadata\.plugins\com.ibm.wtp.server.core\tmp1\cache\localhost\WebSphere_Portal\wps\wps.war\themes\html\BDTheme\_Default.java uses or overrides a deprecated API.
Note: Recompile with -deprecation for details.
5 errors

nis...@gmail.com

unread,
Oct 8, 2007, 8:43:40 AM10/8/07
to
This is the Build level from console when I start server
---------------------------------------------------------------------------
Build Level: wp510_083 (2004-11-19 11:38)


These are first few lines from console when server is started
---------------------------------------------------------------------------
WebSphere Platform 5.1 [BASE 5.1.1.1 cf10435.07] [JDK 1.4.2 cn1420-20040626] running with process name localhost\localhost\WebSphere_Portal and process id 1944
Host Operating System is Windows XP, version 5.1
Java version = J2RE 1.4.2 IBM Windows 32 build cn1420-20040626 (JIT enabled: jitc), Java Compiler = jitc, Java VM name = Classic VM
was.install.root = C:/rad_6/Portal51UTE/AppServer
user.install.root = C:/rad_6/Portal51UTE/AppServer
Java Home = C:\rad_6\Portal51UTE\AppServer\java\jre
ws.ext.dirs = C:/rad_6/Portal51UTE/AppServer/java/lib;C:/rad_6/Portal51UTE/AppServer/classes;C:/rad_6/Portal51UTE/AppServer/classes;C:/rad_6/Portal51UTE/AppServer/lib;C:/rad_6/Portal51UTE/AppServer/lib/ext;C:/rad_6/Portal51UTE/AppServer/web/help;C:/rad_6/Portal51UTE/AppServer/deploytool/itp/plugins/com.ibm.etools.ejbdeploy/runtime;C:/rad_6/PORTAL~1/PORTAL~1/shared/ext;C:/rad_6/PORTAL~1/PORTAL~1/shared/ext/wp.collaborator.jar;C:/rad_6/rwd/eclipse/plugins/com.ibm.etools.webservice.consumption.soap_6.0.0/runtime/worf.jar
Classpath = C:/rad_6/Portal51UTE/AppServer/properties;C:/rad_6/Portal51UTE/AppServer/properties;C:/rad_6/Portal51UTE/AppServer/lib/bootstrap.jar;C:/rad_6/Portal51UTE/AppServer/lib/j2ee.jar;C:/rad_6/Portal51UTE/AppServer/lib/lmproxy.jar;C:/rad_6/Portal51UTE/AppServer/lib/urlprotocols.jar;C:/rad_6/rwd/eclipse/plugins/com.ibm.etools.websphere.tools.common_6.0.0/wteServers.jar;C:/rad_6/rwd/eclipse/plugins/com.ibm.etools.websphere.tools.common_6.0.0/wasToolsCommon.jar
Java Library path = C:\rad_6\Portal51UTE\AppServer\bin;C:\rad_6\Portal51UTE\AppServer\java/bin;C:\rad_6\Portal51UTE\AppServer\java/jre/bin;C:\rad_6\eclipse\jre\bin;.;C:\rad_6\eclipse\jre\bin;C:\Perl\bin\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\IBM\Personal Communications\;C:\Program Files\IBM\Trace Facility\;C:\Program Files\Rational\ClearCase\bin;C:\Program Files\Rational\common

nis...@gmail.com

unread,
Oct 8, 2007, 8:26:46 AM10/8/07
to
I am using WebSphere Portal Server 5.1


Jim Barnes

unread,
Oct 8, 2007, 8:29:32 AM10/8/07
to
5.1.0.? which point release?

Jim Barnes

unread,
Oct 8, 2007, 8:21:49 AM10/8/07
to
can you let me know what version of portal you are on? these classes should already be in the classpath for the portal

Jim

Jim Barnes

unread,
Oct 8, 2007, 8:49:11 AM10/8/07
to
Just as a followup I ran your JSP on my 5.1.0.4 system and it worked fine.

Jim Barnes

unread,
Oct 8, 2007, 8:47:16 AM10/8/07
to
There in lies part of the problem, the model SPI was introduced in 5.1.0.1, you are running on 5.1.0.0, you need to upgrade your rad test environment. you can use the rad product updater to do this, and go to 5.1.0.4

nis...@gmail.com

unread,
Oct 8, 2007, 9:16:48 AM10/8/07
to
Thanks Jim,

I don't have right to update version.

But I have confired with one persone here the version.He says we are having 5.1.0.3

Do I have any other way of using Model API.

I am thanks ful to you for you quick replay and putting your time to run jsp.

Jim Barnes

unread,
Oct 8, 2007, 9:34:07 AM10/8/07
to
Not in the test environment, there is alot besides just the public api that would need to be copied over, as your test environment is 5.1.0.0, you really need to get it to at least 5.1.0.1 if you want to test the model api locally. if your production version is 5.1.0.3 the jsp runs on that as well and I have tested it there as well.

mgg...@gmail.com

unread,
Oct 8, 2007, 10:11:52 AM10/8/07
to

Try this jar,
wp.model.api.jar

Jim Barnes

unread,
Oct 8, 2007, 10:15:30 AM10/8/07
to
I would not recommend copying that jar over from your 5.1.0.3 environment to your local test environment which is 5.1.0.0 it could cause all kinds of issues. The bigger issue here is that the model SPI was not available until 5.1.0.1 of portal or later. So you need to get your 5.1.0.0 test environment upgraded if you want to do local testing

nis...@gmail.com

unread,
Oct 9, 2007, 3:11:09 AM10/9/07
to
Thank to all of you guys there for all your replay.

But if we come back to original question. I need to get the Navigaition tree.

All the labels and pages with name and url.

on WebSphere Portal server 5.1.0.0. If there is any way please suggest me.

Jaydeep

Jim Barnes

unread,
Oct 9, 2007, 7:10:46 AM10/9/07
to
you can just go through the navigation loop, and only for pages that are in the navigation path print those out.

you can try something like this, not sure if it works in 5.1, it did work for 5.0
com.ibm.wps.model.ModelUtil modelUtil = com.ibm.wps.model.ModelUtil.from( request );
com.ibm.wps.model.NavigationModelUtil navModelUtil = com.ibm.wps.model.NavigationModelUtil.from (request);
if (modelUtil != null) {
com.ibm.portal.navigation.NavigationSelectionModel selectionModel = modelUtil.getNavigationSelectionModel();
java.util.Iterator selectionNodeIterator = selectionModel.iterator();
while (selectionNodeIterator.hasNext()) {
com.ibm.portal.navigation.NavigationNode currentNode = (com.ibm.portal.navigation.NavigationNode)selectionNodeIterator.next();
href="<%=navModelUtil.createSelectionChangeURL(currentNode)%>"><%=modelUtil.getTitle(currentNode)%></a>

but my recomendation would be to get your admin to upgrade you to at least 5101 since you are on 5103 in production and then you can use the SPI. There is no way to get the SPI in 5100

Jim Barnes

unread,
Oct 11, 2007, 6:46:16 AM10/11/07
to

nis...@gmail.com

unread,
Oct 16, 2007, 4:57:13 AM10/16/07
to
Thanks Jim.

I have tried with Model Api. Its working fine in JSP page. I have tried in one of the portlet.

But when I tried with making Java file of same code and call that class in same JSP it give these exception. Jsp and java file is in same portlet project. Jsp works Java files gives these exeptions.

org.apache.jetspeed.portlet.PortletException: Unresolved compilation problems:
The import com.ibm.portal.model cannot be resolved
The import com.ibm.portal.model cannot be resolved
The import com.ibm.portal.model cannot be resolved
The import com.ibm.portal.model cannot be resolved
The import com.ibm.portal.navigation cannot be resolved
The import com.ibm.portal.navigation cannot be resolved
The import com.ibm.portal.navigation cannot be resolved
NavigationNode cannot be resolved (or is
Nested Exception is org.apache.jetspeed.portlet.PortletException: Unresolved compilation problems:
The import com.ibm.portal.model cannot be resolved
The import com.ibm.portal.model cannot be resolved
The import com.ibm.portal.model cannot be resolved
The import com.ibm.portal.model cannot be resolved
The import com.ibm.portal.navigation cannot be resolved
The import com.ibm.portal.navigation cannot be resolved
The import com.ibm.portal.navigation cannot be resolved
NavigationNode canno
Nested Exception is javax.servlet.ServletException: Unresolved compilation problems:
The import com.ibm.portal.model cannot be resolved
The import com.ibm.portal.model cannot be resolved
The import com.ibm.portal.model cannot be resolved
The import com.ibm.portal.model cannot be resolved
The import com.ibm.portal.navigation cannot be resolved
The import com.ibm.portal.navigation cannot be resolved
The import com.ibm.portal.navigation cannot be resolved
NavigationNode cannot be resolved (or is not a valid type) for the parameter node of the method generateNavigationTree
NavigationModel cannot be resolved (or is not a valid type) for the parameter model1 of the method generateNavigationTree
com.ibm.portal.state cannot be resolved
com.ibm.portal.state cannot be resolved
NavigationNode cannot be resolved or is not a type
NavigationNode cannot be resolved or is not a type
NavigationNode cannot be resolved or is not a type
NavigationSelectionModelHome cannot be resolved or is not a type
NavigationSelectionModelHome cannot be resolved or is not a type
NavigationSelectionModelProvider cannot be resolved or is not a type
NavigationSelectionModel cannot be resolved or is not a type
NavigationNode cannot be resolved or is not a type
NavigationNode cannot be resolved or is not a type
NavigationModelHome cannot be resolved or is not a type
NavigationModelHome cannot be resolved or is not a type
NavigationModel cannot be resolved or is not a type

Jim Barnes

unread,
Oct 16, 2007, 7:01:59 AM10/16/07
to
are you still doing this on the same rad environment that only had 5.1.0.0? if so you need to upgrade so that it picks up the right jars to compile against.

nis...@gmail.com

unread,
Oct 16, 2007, 9:22:26 AM10/16/07
to
No I am using 5.1.0.3. But that is in Test Environment. No on my local. So I need to deploy portlet to test.

But JSP is woring, why Java file is not working with same code.

It is very strange....

Jim Barnes

unread,
Oct 16, 2007, 9:26:58 AM10/16/07
to
are you trying to pass in the portlet request to the service?

If you want you can send me your portlet and I can take a look at it real fast
Jim

nis...@gmail.com

unread,
Oct 18, 2007, 2:55:13 AM10/18/07
to
Hi Jim,

Find the code in attached java file.

And I am calling it code in jsp like

<%
dk.bankdata.kort.testdriver.commands.NavigationTreeUtil n = new dk.bankdata.kort.testdriver.commands.NavigationTreeUtil();
out.write(n.getFullNavigationTree(request, response, 2));
%>

And it give exception that i have shared in previos post.

But if i use same code full in jsp it works.


Jim Barnes

unread,
Oct 18, 2007, 6:53:26 AM10/18/07
to
I would need to see how you have packed your portlet.
everything looks like it should work

Jim Barnes

unread,
Oct 18, 2007, 7:15:07 AM10/18/07
to
I put this into a war, and called it just like you did

and it worked fine for me
I saw the following out put
+My Portal My Portal ( LABEL , 6_0_35 [CONTENT_NODE:101] ) true

+Welcome Welcome ( COMPOSITION , 6_0_4D [CONTENT_NODE:141] ) true
new test new test ( COMPOSITION , 6_0_1O9 [CONTENT_NODE:1801] )
Alex's PMRs Alex's PMRs ( COMPOSITION , 6_0_2NI [CONTENT_NODE:2802] )

+My Workplace My Workplace ( COMPOSITION , 6_0_4T [CONTENT_NODE:157] ) true

+Mail Mail ( COMPOSITION , 6_0_4U [CONTENT_NODE:158] ) true
Calendar Calendar ( COMPOSITION , 6_0_4V [CONTENT_NODE:159] )
Address Book Address Book ( COMPOSITION , 6_0_50 [CONTENT_NODE:160] )
Web Conferences Web Conferences ( COMPOSITION , 6_0_51 [CONTENT_NODE:161] )
Team Spaces Team Spaces ( COMPOSITION , 6_0_52 [CONTENT_NODE:162] )

+Domino Databases Domino Databases ( COMPOSITION , 6_0_53 [CONTENT_NODE:163] ) true
Documents Documents ( COMPOSITION , 6_0_54 [CONTENT_NODE:164] )
Administration Administration ( COMPOSITION , 6_0_55 [CONTENT_NODE:165] )

+jims pmrs jims pmrs ( LABEL , 6_0_9D [CONTENT_NODE:301] ) true

+jasper test jasper test ( COMPOSITION , 6_0_P1 [CONTENT_NODE:801] ) true
test1 test1 ( COMPOSITION , 6_0_P2 [CONTENT_NODE:802] )
test2 test2 ( COMPOSITION , 6_0_P3 [CONTENT_NODE:803] )
Rss Portlet Rss Portlet ( COMPOSITION , 6_0_1EU [CONTENT_NODE:1502] )
jsr 168 ssl jsr 168 ssl ( COMPOSITION , 6_0_1RF [CONTENT_NODE:1903] )
link link ( COMPOSITION , 6_0_1UI [CONTENT_NODE:2002] )
reminder reminder ( COMPOSITION , 6_0_2H9 [CONTENT_NODE:2601] )
bookmarks bookmarks ( COMPOSITION , 6_0_2NJ [CONTENT_NODE:2803] )
web page web page ( COMPOSITION , 6_0_2QL [CONTENT_NODE:2901] )
forum forum ( COMPOSITION , 6_0_311 [CONTENT_NODE:3105] )

please see attached war

make sure you are not including any jars from portal in the war

0 new messages