portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ate Douma (JIRA)" <jetspeed-...@portals.apache.org>
Subject [jira] Updated: (JS2-240) Cannot use Jetspeed-provieded services
Date Tue, 26 Apr 2005 08:33:25 GMT
     [ http://issues.apache.org/jira/browse/JS2-240?page=all ]

Ate Douma updated JS2-240:
--------------------------

    Attachment: jetspeed-portlet.xml

I had a quick look and found your problem(s)...

In the jetspeed-portlet.xml you didn't specify the schema definitions, resulting in it being
ignored...
This problem *is* notified in the Tomcat console though. You should check that and if you
run Tomcat as a service make sure to redirect the console output to a file.

Another warning:
The short-title of your portlet exceeds 50 characters. If you test/develop on hsqldb this
isn't a problem
because that storeds anything you throw at it, but on Oracle (and most other db's) this leads
to an exception at deployment (LANGUAGE.SHORT_TITLE max length = 50).
This can be considered a Jetspeed bug (feel free to create a new Issue for that) as we currently
don't
do sanity checks nor truncations on string value lengths loaded from xml.

After solving above problems I could deploy and access your portlet without any problem.
Note: I'm running lastest cvs-head (M3-dev) on XP with Oracle9i, but it will run on M2 as
well.

> Cannot use Jetspeed-provieded services
> --------------------------------------
>
>          Key: JS2-240
>          URL: http://issues.apache.org/jira/browse/JS2-240
>      Project: Jetspeed 2
>         Type: Bug
>   Components: Components Core, Assembly/Configuration
>     Versions: 2.0-M2
>  Environment: Windows XP SP2, Jetspeed2-M2
>     Reporter: Sebastian Komander
>  Attachments: PortalAdministration.zip, jetspeed-portlet.xml
>
> Hi all,
> I tried to use the Jetspeed2-provided service in my JSF Portlet.
> Directory-structure:
> - JSFProjekt
> |-src/de/sebastian/TestPortlet
> |-WEB-INF
>  |-lib
>  |-portlet.xml
>  |-jetspeed-portlet.xml
>  |-faces-config.xml
>  |-classes
>   |- de/sebastian/pai/java/portlets/TestPortlet.class
>  |-pai
>   |-page-browser
>    |- view.jsp, edit.jsp, help.jsp
> Here is the code of the files.
> portlet.xml:
> <portlet-app id="pai">
>         <portlet id="PageListPortlet">
>                 <init-param>
>                         <name>ViewPage</name>
>                         <value>/pai/page-browser/view.jsp</value>
>                 </init-param>
>                 <init-param>
>                         <name>EditPage</name>
>                         <value>/pai/page-browser/edit.jsp</value>
>                 </init-param>
>                 <init-param>
>                         <name>HelpPage</name>
>                         <value>/pai/page-browser/help.jsp</value>
>                 </init-param>
>                 <portlet-name>PageListPortlet</portlet-name>
>                 <display-name>Pages</display-name>
>                 <description>
>                         Shows all psml-pages, links and folders
>                 </description>
>                 <portlet-class>de.sebastian.pai.java.portlets.PageListPortlet</portlet-class>
>                 <expiration-cache>-1</expiration-cache>
>                 <supports>
>                         <mime-type>text/html</mime-type>
>                         <portlet-mode>VIEW</portlet-mode>
>                         <portlet-mode>EDIT</portlet-mode>
>                         <portlet-mode>HELP</portlet-mode>
>                 </supports>
>                 <supported-locale>en</supported-locale>
>                 <resource-bundle>de.sebastian.pai.ressources.PAIRessources</resource-bundle>
>                 <portlet-info>
>                         <title>Page Browser</title>
>                         <short-title>
>                                 This is a portlet which display all pages, folders an
links.
>                         </short-title>
>                         <keywords>Page, Administration</keywords>
>                 </portlet-info>
>         </portlet>
> </portlet-app>
> web.xml
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
> 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
>   <display-name>Portal Administration</display-name>
>   <description>Portlet Applications to administrate the portal</description>
>   <context-param>
>     <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
>     <param-value>server</param-value>
>   </context-param>
>   <context-param>
>     <param-name>javax.faces.application.CONFIG_FILES</param-name>
>     <param-value>/WEB-INF/faces-config.xml</param-value>
>   </context-param>
>   <context-param>
>     <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
>     <param-value>true</param-value>
>     <description>This parameter tells MyFaces if javascript code should be
> allowed in the
>             rendered HTML output.
>             If javascript is allowed, command_link anchors will have
> javascript code
>             that submits the corresponding form.
>             If javascript is not allowed, the state saving info and nested
> parameters
>             will be added as url parameters.
>             Default: "true"</description>
>   </context-param>
>   <context-param>
>     <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
>     <param-value>false</param-value>
>     <description>This parameter tells MyFaces if javascript code should be
> allowed in the
>             rendered HTML output.
>             If javascript is allowed, command_link anchors will have
> javascript code
>             that submits the corresponding form.
>             If javascript is not allowed, the state saving info and nested
> parameters
>             will be added as url parameters.
>             Default: "false"
>             Setting this param to true should be combined with
> STATE_SAVING_METHOD "server" for
>             best results.
>             This is an EXPERIMENTAL feature. You also have to enable the
> detector filter/filter mapping below to get
>             JavaScript detection working.</description>
>   </context-param>
>   <context-param>
>     <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
>     <param-value>true</param-value>
>     <description>If true, rendered HTML code will be formatted, so that it
> is "human readable".
>             i.e. additional line separators and whitespace will be
> written, that do not
>             influence the HTML code.
>             Default: "true"</description>
>   </context-param>
>   <context-param>
>     <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
>     <param-value>true</param-value>
>     <description>If true, a javascript function will be rendered that is
> able to restore the
>             former vertical scroll on every request. Convenient feature if
> you have pages
>             with long lists and you do not want the browser page to always
> jump to the top
>             if you trigger a link or button action that stays on the same
> page.
>             Default: "false"</description>
>   </context-param>
>   <!-- Extensions Filter -->
>     <filter>
>     <filter-name>extensionsFilter</filter-name>
>     <filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class>
>     <init-param>
>       <param-name>uploadMaxFileSize</param-name>
>       <param-value>100m</param-value>
>       <description>Set the size limit for uploaded files.
>                 Format: 10 - 10 bytes
>                         10k - 10 KB
>                         10m - 10 MB
>                         1g - 1 GB</description>
>     </init-param>
>     <init-param>
>       <param-name>uploadThresholdSize</param-name>
>       <param-value>100k</param-value>
>       <description>Set the threshold size - files
>                     below this limit are stored in memory, files above
>                     this limit are stored on disk.
>                 Format: 10 - 10 bytes
>                         10k - 10 KB
>                         10m - 10 MB
>                         1g - 1 GB</description>
>     </init-param>
>   </filter>
>   <!-- Filter Mappings -->
>   <filter-mapping>
>     <filter-name>extensionsFilter</filter-name>
>     <url-pattern>*.jsf</url-pattern>
>   </filter-mapping>
>   <filter-mapping>
>     <filter-name>extensionsFilter</filter-name>
>     <url-pattern>/faces/*</url-pattern>
>   </filter-mapping>
>   <!-- Listener, that does all the startup work (configuration, init). -->
>   <listener>
>     <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
>   </listener>
>   <!-- Faces Servlet -->
>   <servlet>
>     <servlet-name>Faces Servlet</servlet-name>
>     <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
>     <load-on-startup>1</load-on-startup>
>   </servlet>
>   <servlet>
>     <servlet-name>JetspeedContainer</servlet-name>
>     <display-name>Jetspeed Container</display-name>
>     <description>MVC Servlet for Jetspeed Portlet Applications</description>
>     <servlet-class>org.apache.jetspeed.container.JetspeedContainerServlet</servlet-class>
>     <init-param>
>       <param-name>contextName</param-name>
>       <param-value>pai</param-value>
>     </init-param>
>     <load-on-startup>0</load-on-startup>
>   </servlet>
>   <!-- extension mapping -->
>   <servlet-mapping>
>     <servlet-name>Faces Servlet</servlet-name>
>     <url-pattern>*.jsf</url-pattern>
>   </servlet-mapping>
>   <servlet-mapping>
>     <servlet-name>JetspeedContainer</servlet-name>
>     <url-pattern>/container/*</url-pattern>
>   </servlet-mapping>
>   <taglib>
>     <taglib-uri>http://java.sun.com/portlet</taglib-uri>
>     <taglib-location>/WEB-INF/tld/portlet.tld</taglib-location>
>   </taglib>
> </web-app>
> jetspeed-portlet.xml
> <?xml version="1.0" encoding="UTF-8"?>
> <portlet-app id="pai" version="1.0">
>     <dc:title>Portal Administration Interface</dc:title>
>     <dc:title xml:lang="en">Portal Administration Interface</dc:title>
>     <dc:creator>Sebastian Komander</dc:creator>
>         <portlet>
>         <portlet-name>PageListPortlet</portlet-name>
>         <dc:title>Page-Browser</dc:title>
>         <dc:creator>J2 Team</dc:creator>
>     </portlet>
>         <js:services>
>             <js:service name='SearchComponent'/>
>                 <js:service name='PortletRegistryComponent'/>
>                 <js:service name='UserManager'/>
>                 <js:service name='PageManager'/>
>                 <js:service name='RoleManager'/>
>                 <js:service name='GroupManager'/>
>                 <js:service name='Profiler'/>
>         </js:services>
> </portlet-app>
> faces-config.xml
> <?xml version='1.0' encoding='UTF-8'?>
> <!DOCTYPE faces-config PUBLIC
>   "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
>   "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
> <faces-config>
>   <application>
>     <locale-config>
>       <default-locale>en</default-locale>
>       <supported-locale>de</supported-locale>
>     </locale-config>
>   </application>
> </faces-config>
> PageListPortlet.java
> /*
>  * Created on 25.04.2005
>  *
>  * TODO To change the template for this generated file go to
>  * Window - Preferences - Java - Code Style - Code Templates
>  */
> package de.sebastian.pai.java.portlets;
> import java.io.IOException;
> import java.util.Enumeration;
> import javax.portlet.PortletConfig;
> import javax.portlet.PortletContext;
> import javax.portlet.PortletException;
> import org.apache.jetspeed.components.portletregistry.PortletRegistry;
> import org.apache.jetspeed.search.SearchEngine;
> import org.apache.jetspeed.security.UserManager;
> import org.apache.portals.bridges.jsf.FacesPortlet;
> import de.sebastian.pai.constants.Ressources;
> /**
>  * @author Sebastian
>  *
>  * TODO To change the template for this generated type comment go to Window -
>  * Preferences - Java - Code Style - Code Templates
>  */
> public class PageListPortlet extends FacesPortlet {
>         private PortletContext context;
>         private PortletRegistry registry;
>         private SearchEngine searchEngine;
>         public void init(PortletConfig config) throws PortletException {
>                 super.init(config);
>                 context = getPortletContext();
>                 registry = (PortletRegistry) context
>                                 .getAttribute("cps:PortletRegistryComponent");
>                 searchEngine = (SearchEngine) context
>                                 .getAttribute("cps:SearchComponent");
>                 if (null == searchEngine) {
>                         throw new PortletException(
>                                         "Failed to find the Search Engine on portlet
initialization");
>                 }
>                 if (null == registry) {
>                         throw new PortletException(
>                                         "Failed to find the Portlet Registry on portlet
initialization");
>                 }
>         }
> }
> The deployment works well. Then i place the portlet on a page and i open
> it in IE or Firefox and a PortletException is thrown:
> "Failed to find the Search Engine on portlet initialization"
> I've included this librarys:
> commons-beanutils-1.6.1.jar
> commons-codec-1.2.jar
> commons-collections-2.1.jar
> commons-collections-3.0.jar
> commons-digester-1.5.jar
> commons-el-1.0.jar
> commons-logging-1.0.3.jar
> commons-validator-1.1.3.jar
> jstl-1.0.6.jar
> log4j-1.2.8.jar
> myfaces-1.0.9.jar
> myfaces-jsf-api-1.0.9.jar
> portals-bridges-jsf-0.2.jar
> portals-gems-2.0-M2.jar
> standard-1.0.6.jar
> libs.txt
> Can anybody tell me why ?
> If someone want's the WAR file or the whole project, you can mail me: seb@gehacked.org
> Much thx
> Sebastian

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message