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.
B'cos exception is comming in theme resourece.
Can u tell me which jar file contains Model API
Thanks,
Mohan
The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM
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
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
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.
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
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
Scroll down for the spi docs at the bottom it includes the javadoc for that
http://www.ibm.com/developerworks/websphere/zones/portal/proddoc_v51x.html?S_TACT=105AGX10&S_CMP=LP
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
But JSP is woring, why Java file is not working with same code.
It is very strange....
If you want you can send me your portlet and I can take a look at it real fast
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.
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