Announcement Announcement Module
Collapse
No announcement yet.
Issue trying to use booking-portlet-mvc sample portlet in SWF2.0.5 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Issue trying to use booking-portlet-mvc sample portlet in SWF2.0.5

    Hey,

    I'm having some trouble getting the sample Spring Web Flow 2 "booking-portlet-mvc" portlet working in the portal environment we use (uPortal 2.5.3 GA, which uses Pluto 1.0).

    I had to alter web.xml of the portlet to remove the pluto added section so that uPortal could readd it (just in case what pluto needed in the config was different), and changed logging config to log into its own file.

    I built the portlet with maven2, deployed with uPortal, and published.

    First it complained that there was no jstl or ognl so I added those jars to the portlets WEB-INF/lib and restarted tomcat. But it appeared that JSTL was not working (actionURL was rendering from intro.jsp as ${actionURL} (literally) in the URL on the first page of the portlet.

    So I changed the pom.xml to remove all <scope>provided</scope> thinking that for sure all dependencies would be included then (so didn't add jstl or ognl that time) and rebuilt, redeployed, restarted tomcat (just in case).

    But then the portlet does not render and the logs now indicate the following errors.

    Does anyone know what I might have done wrong or might need to check?

    2008-12-16 10:27:54,877 ERROR [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/booking-portlet-mvc]] - <StandardWrapper.Throwable>
    java.lang.ClassCastException: org.springframework.web.portlet.DispatcherPortlet
    at org.apache.pluto.core.PortletServlet.init(PortletS ervlet.java:66)
    at org.apache.catalina.core.StandardWrapper.loadServl et(StandardWrapper.java:1105)
    at org.apache.catalina.core.StandardWrapper.allocate( StandardWrapper.java:757)
    at org.apache.catalina.core.ApplicationDispatcher.inv oke(ApplicationDispatcher.java:641)
    at org.apache.catalina.core.ApplicationDispatcher.doI nclude(ApplicationDispatcher.java:574)
    at org.apache.catalina.core.ApplicationDispatcher.inc lude(ApplicationDispatcher.java:499)
    at org.apache.pluto.invoker.impl.PortletInvokerImpl.i nvoke(PortletInvokerImpl.java:120)
    at org.apache.pluto.invoker.impl.PortletInvokerImpl.l oad(PortletInvokerImpl.java:80)
    at org.apache.pluto.PortletContainerImpl.portletLoad( PortletContainerImpl.java:218)
    at org.jasig.portal.channels.portlet.CPortletAdapter. initPortletWindow(CPortletAdapter.java:262)
    at org.jasig.portal.channels.portlet.CPortletAdapter. setRuntimeData(CPortletAdapter.java:414)
    at org.jasig.portal.MultithreadedCharacterChannelAdap ter.setRuntimeData(MultithreadedCharacterChannelAd apter.java:29)
    at org.jasig.portal.ChannelRenderer$Worker.execute(Ch annelRenderer.java:460)
    at org.jasig.portal.utils.threading.BaseTask.run(Base Task.java:27)
    at edu.emory.mathcs.backport.java.util.concurrent.Exe cutors$RunnableAdapter.call(Executors.java:431)
    at edu.emory.mathcs.backport.java.util.concurrent.Fut ureTask.run(FutureTask.java:166)
    at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.runTask(ThreadPoolExecutor. java:643)
    at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.run(ThreadPoolExecutor.java :668)
    at java.lang.Thread.run(Thread.java:595)
    2008-12-16 10:27:54,879 ERROR [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/booking-portlet-mvc].[swf-booking-mvc]] - <Allocate exception for servlet swf-booking-mvc>
    java.lang.ClassCastException: org.springframework.web.portlet.DispatcherPortlet
    at org.apache.pluto.core.PortletServlet.init(PortletS ervlet.java:66)
    at org.apache.catalina.core.StandardWrapper.loadServl et(StandardWrapper.java:1105)
    at org.apache.catalina.core.StandardWrapper.allocate( StandardWrapper.java:757)
    at org.apache.catalina.core.ApplicationDispatcher.inv oke(ApplicationDispatcher.java:641)
    at org.apache.catalina.core.ApplicationDispatcher.doI nclude(ApplicationDispatcher.java:574)
    at org.apache.catalina.core.ApplicationDispatcher.inc lude(ApplicationDispatcher.java:499)
    at org.apache.pluto.invoker.impl.PortletInvokerImpl.i nvoke(PortletInvokerImpl.java:120)
    at org.apache.pluto.invoker.impl.PortletInvokerImpl.l oad(PortletInvokerImpl.java:80)
    at org.apache.pluto.PortletContainerImpl.portletLoad( PortletContainerImpl.java:218)
    at org.jasig.portal.channels.portlet.CPortletAdapter. initPortletWindow(CPortletAdapter.java:262)
    at org.jasig.portal.channels.portlet.CPortletAdapter. setRuntimeData(CPortletAdapter.java:414)
    at org.jasig.portal.MultithreadedCharacterChannelAdap ter.setRuntimeData(MultithreadedCharacterChannelAd apter.java:29)
    at org.jasig.portal.ChannelRenderer$Worker.execute(Ch annelRenderer.java:460)
    at org.jasig.portal.utils.threading.BaseTask.run(Base Task.java:27)
    at edu.emory.mathcs.backport.java.util.concurrent.Exe cutors$RunnableAdapter.call(Executors.java:431)
    at edu.emory.mathcs.backport.java.util.concurrent.Fut ureTask.run(FutureTask.java:166)
    at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.runTask(ThreadPoolExecutor. java:643)
    at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.run(ThreadPoolExecutor.java :668)
    at java.lang.Thread.run(Thread.java:595)

    Thanks!

    Gary

  • #2
    More info

    Dustin S. on the ja-sig portlet-dev list recommended that I do a mvn dependency:analyze which resulted in:

    Code:
    [WARNING] Used undeclared dependencies found:
    [WARNING]    org.springframework:spring-context:jar:2.5.6:compile
    [WARNING] Unused declared dependencies found:
    [WARNING]    org.junit:com.springsource.junit:jar:3.8.2:test
    [WARNING]    javax.portlet:com.springsource.javax.portlet:jar:1.0.0:compile
    [WARNING]    javax.servlet:com.springsource.javax.servlet:jar:2.4.0:compile
    [WARNING]    org.hibernate:com.springsource.org.hibernate.annotations:jar:3.3.0.ga:compile
    [WARNING]    org.hibernate:com.springsource.org.hibernate.ejb:jar:3.3.1.ga:compile
    [WARNING]    org.springframework:org.springframework.web.portlet:jar:2.5.6.A:compile
    [WARNING]    javax.el:com.springsource.javax.el:jar:1.0.0:compile
    [WARNING]    org.springframework:org.springframework.orm:jar:2.5.6.A:compile
    [WARNING]    org.springframework:org.springframework.test:jar:2.5.6.A:test
    [WARNING]    org.springframework:org.springframework.jdbc:jar:2.5.6.A:compile
    [WARNING]    org.springframework:org.springframework.aop:jar:2.5.6.A:compile
    [WARNING]    org.springframework:org.springframework.web.servlet:jar:2.5.6.A:compile
    [WARNING]    org.springframework:org.springframework.web:jar:2.5.6.A:compile
    [WARNING]    org.springframework.webflow:org.springframework.js:jar:2.0.5.RELEASE:compile
    [WARNING]    javax.transaction:com.springsource.javax.transaction:jar:1.1.0:compile
    [WARNING]    org.springframework:org.springframework.context:jar:2.5.6.A:compile
    [WARNING]    org.hibernate:com.springsource.org.hibernate:jar:3.2.6.ga:compile
    [WARNING]    org.hsqldb:com.springsource.org.hsqldb:jar:1.8.0.9:compile
    [WARNING]    org.springframework:org.springframework.beans:jar:2.5.6.A:compile
    [WARNING]    org.jboss.el:com.springsource.org.jboss.el:jar:2.0.0.GA:compile
    [WARNING]    org.apache.log4j:com.springsource.org.apache.log4j:jar:1.2.15:compile
    [WARNING]    org.aopalliance:com.springsource.org.aopalliance:jar:1.0.0:compile
    So I added the following to the pom.xml:
    Code:
                   <dependency>
                           <groupId>org.springframework</groupId>
                           <artifactId>spring-context</artifactId>
                           <version>2.5.6</version>
                           <scope>compile</scope>
                   </dependency>
    Built, deployed via uPortal, watched war expand, restarted tomcat, and still getting same exception.

    I also made sure that the portlet's WEB-INF/lib/ contained spring-context-2.5.6.jar.

    I'm guessing I shouldn't have to remove all of the dependencies it thinks are unused, since that is likely not the issue.

    The sample portlet's WEB-INF/lib now contains:
    aopalliance-1.0.jar
    commons-logging-1.1.1.jar
    com.springsource.antlr-2.7.6.jar
    com.springsource.edu.oswego.cs.dl.util.concurrent-1.3.4.jar
    com.springsource.javassist-3.3.0.ga.jar
    com.springsource.javax.el-1.0.0.jar
    com.springsource.javax.persistence-1.0.0.jar
    com.springsource.javax.portlet-1.0.0.jar
    com.springsource.javax.servlet-2.4.0.jar
    com.springsource.javax.transaction-1.1.0.jar
    com.springsource.net.sf.cglib-2.1.3.jar
    com.springsource.org.aopalliance-1.0.0.jar
    com.springsource.org.apache.commons.collections-3.2.0.jar
    com.springsource.org.apache.commons.logging-1.1.1.jar
    com.springsource.org.apache.log4j-1.2.15.jar
    com.springsource.org.dom4j-1.6.1.jar
    com.springsource.org.hibernate-3.2.6.ga.jar
    com.springsource.org.hibernate.annotations-3.3.0.ga.jar
    com.springsource.org.hibernate.annotations.common-3.3.0.ga.jar
    com.springsource.org.hibernate.ejb-3.3.1.ga.jar
    com.springsource.org.hsqldb-1.8.0.9.jar
    com.springsource.org.jboss.el-2.0.0.GA.jar
    com.springsource.org.jboss.util-2.0.4.GA.jar
    com.springsource.org.objectweb.asm-1.5.3.jar
    com.springsource.org.objectweb.asm.attrs-1.5.3.jar
    org.springframework.aop-2.5.6.A.jar
    org.springframework.beans-2.5.6.A.jar
    org.springframework.binding-2.0.5.RELEASE.jar
    org.springframework.context-2.5.6.A.jar
    org.springframework.core-2.5.6.A.jar
    org.springframework.jdbc-2.5.6.A.jar
    org.springframework.js-2.0.5.RELEASE.jar
    org.springframework.orm-2.5.6.A.jar
    org.springframework.transaction-2.5.6.A.jar
    org.springframework.web-2.5.6.A.jar
    org.springframework.webflow-2.0.5.RELEASE.jar
    org.springframework.web.portlet-2.5.6.A.jar
    org.springframework.web.servlet-2.5.6.A.jar
    spring-beans-2.5.6.jar
    spring-context-2.5.6.jar
    spring-context-support-2.5.6.jar
    spring-core-2.5.6.jar
    spring-web-2.5.6.jar
    spring-webmvc-2.5.6.jar

    My (apache-tomcat-5.5.20)/common/lib contains:
    commons-el.jar
    jasper-compiler.jar
    jasper-compiler-jdt.jar
    jasper-runtime.jar
    jsp-api.jar
    naming-factory-dbcp.jar
    naming-factory.jar
    naming-resources.jar
    ojdbc14.jar
    servlet-api.jar

    My (apache-tomcat-5.5.20)/shared/lib contains:
    JSPPortlet.jar
    pluto-1.0.1.jar
    portlet-api-1.0.jar

    (note- that isn't the version of pluto that comes with uPortal 2.5.3 GA. I replaced it with a newer compatible version (at least I assume it is compatible) on my dev instance. I don't think that is the issue though.)

    In the pluto 1.0.1 source, the code throwing the exception is:
    Code:
    String classString = config.getInitParameter("portlet-class");
    ...
    portletClass = (Portlet)Thread.currentThread().getContextClassLoader().loadClass(classString).newInstance(); // this is the line throwing the exception
    It is complaining that it can't cast org.springframework.web.portlet.DispatcherPortlet to javax.portlet.Portlet, but DispatcherPortlet implements (inherited) the javax.portlet.Portlet interface:
    http://static.springframework.org/sp...erPortlet.html

    I noticed the portlet-api-1.0.jar I was using in tomcat was different than the one Spring 2.5.6 was built against (mine was larger), so I swapped that out and restarted, but as you would think, that did no good, and I am still getting:
    Code:
    2008-12-16 14:53:20,759 ERROR [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/booking-portlet-mvc].[swf-booking-mvc]] - <Allocate exception for servlet swf-booking-mvc>
    java.lang.ClassCastException: org.springframework.web.portlet.DispatcherPortlet
       at org.apache.pluto.core.PortletServlet.init(PortletServlet.java:66)
    I totally agree with Dustin that it must be a dependency issue (on my side), but I am having trouble figuring out what it is.

    Thanks in advance for any help,

    Gary

    Comment

    Working...
    X