Hi Frank, I guess you have another jetspeed-api-x.x.x.jar in /WEB-INF/lib/ of your portlet application. If so, you should remove the jar file because it is already provided in the shared library directory (e.g. /shared/lib/ in Tomcat) and PortalStatistics interface can be referred by default in your portlet.
Regards, Woonsan --- On Fri, 11/14/08, Otto, Frank <[EMAIL PROTECTED]> wrote: > From: Otto, Frank <[EMAIL PROTECTED]> > Subject: AW: get jetspeed database connection > To: "'Jetspeed Users List'" <[email protected]> > Date: Friday, November 14, 2008, 2:55 PM > I get following exception with your code now: > > Failed to load portlet com.test.HelloWorld: > java.lang.ClassCastException: > org.apache.jetspeed.statistics.impl.PortalStatisticsImpl > > Any idea? > > > Frank > > > > -----Ursprüngliche Nachricht----- > > Von: Michael Binette [mailto:[EMAIL PROTECTED] > > Gesendet: Freitag, 14. November 2008 14:11 > > An: Jetspeed Users List > > Betreff: Re: get jetspeed database connection > > > > > > Frank, > > > > You can get a connection through the PortalStatistics > object. > > > > PortletContext context = getPortletContext(); > > PortalStatistics statistics = > > > (PortalStatistics)context.getAttribute(CommonPortletServices.C > > PS_PORTAL_STATISTICS); > > > > statistics.getDataSource(); > > > > Before you can reference CPS_PORTAL_STATISTICS you > have to edit the > > WEB-INF/jetspeed-portlet.xml file. If it doesn't > exist in > > your project then > > you need to create it. Mine is listed below with a > bunch of Jetspeed > > services I use. > > > > <?xml version="1.0" > encoding="UTF-8"?> > > <!-- > > Copyright 2004 The Apache Software Foundation > > > > Licensed under the Apache License, Version 2.0 (the > "License"); > > you may not use this file except in compliance with > the License. > > You may obtain a copy of the License at > > > > http://www.apache.org/licenses/LICENSE-2.0 > > > > Unless required by applicable law or agreed to in > writing, software > > distributed under the License is distributed on an > "AS IS" BASIS, > > WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either > express > > or implied. > > See the License for the specific language governing > permissions and > > limitations under the License. > > --> > > <portlet-app id="your-app-id" > version="1.0" > > > xmlns="http://portals.apache.org/jetspeed" > > > xmlns:js="http://portals.apache.org/jetspeed" > > xmlns:dc="http://www.purl.org/dc" > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > > > xsi:schemaLocation="http://portals.apache.org/jetspeed > > > http://portals.apache.org/jetspeed-2/2.1/schemas/jetspeed-port > > let.xsd"> > > > > <js:services> > > <js:service > name='GroupManager'/> > > <js:service name='UserManager'/> > > <js:service name='RoleManager'/> > > <js:service > name='PortalStatistics'/> > > </js:services> > > > > </portlet-app> > > > > On Fri, Nov 14, 2008 at 7:27 AM, Otto, Frank > > <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > > > > how can I get the database connection from > jetspeed in my portlet? > > > > > > > > > kind regards > > > > > > Frank > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
