[
https://issues.jboss.org/browse/GTNPORTAL-2423?page=com.atlassian.jira.pl...
]
Marek Posolda commented on GTNPORTAL-2423:
------------------------------------------
Hi Luca, I've tried your portlet and it works for me on Tomcat6 even with JCR API
classes (Repository, Node, Session). It clearly looks like classloader issue.
Some points:
- When redeploying portlet on Tomcat, you need to delete WAR file
TOMCAT_HOME/webapps/yourportlet.war but also directory TOMCAT_HOME/webapps/yourportlet .
Make sure to delete both. Then you can place your portlet WAR to TOMCAT_HOME/webapps/
- When I tried dependencies from your attached pom.xml, it still builds WAR file with few
JAR libraries under WEB-INF/lib (including jcr-1.0.jar). I need to manually delete all
these JARS from WEB-INF/lib . So seems that you will need to declare more provided
dependencies in your pom.xml
IncompatibleClassChangeError using JCR in a GenericPortlet
----------------------------------------------------------
Key: GTNPORTAL-2423
URL:
https://issues.jboss.org/browse/GTNPORTAL-2423
Project: GateIn Portal
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: JCR integration
Affects Versions: 3.2.0-GA
Environment: tomcat 6 + java 6
Reporter: Luca Stancapiano
I'm trying to do a JCR call in a simple portlet. It is the portlet:
{code}
package org.jboss.portal.portlet.samples;
import java.io.IOException;
import java.io.PrintWriter;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.GenericPortlet;
import javax.portlet.PortletException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.services.jcr.RepositoryService;
import org.exoplatform.services.jcr.impl.core.NodeImpl;
import org.exoplatform.services.jcr.impl.core.RepositoryImpl;
import org.exoplatform.services.jcr.impl.core.SessionImpl;
import org.exoplatform.webui.application.WebuiRequestContext;
public class MyPortlet2 extends GenericPortlet {
@Override
protected void doView(RenderRequest request, RenderResponse response)
throws PortletException, IOException {
response.setContentType("text/html");
PrintWriter writer = response.getWriter();
writer.print("<p><a href='" + response.createActionURL() +
"'>"
+ "Language controller</a></p>");
writer.close();
}
@Override
public void processAction(ActionRequest request, ActionResponse response)
throws PortletException, IOException {
// TODO Auto-generated method stub
PortalRequestContext context = (PortalRequestContext) WebuiRequestContext
.getCurrentInstance();
ExoContainer pcontainer = context.getApplication()
.getApplicationServiceContainer();
RepositoryService repositoryService = (RepositoryService)
pcontainer.getComponentInstanceOfType(RepositoryService.class);
try {
RepositoryImpl repository =
(RepositoryImpl)repositoryService.getRepository("repository");
SessionImpl session = (SessionImpl)repository.login();
NodeImpl root = (NodeImpl)session.getRootNode();
System.out.println(root.getName());
session.logout();
} catch (Exception e) {
e.printStackTrace();
}
}
}
{code}
and the pom.xml with the dependencies:
{code}
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- the parent isn't required, you can drop it if you add a groupId and
version -->
<parent>
<groupId>org.gatein.portal.examples.portlets</groupId>
<artifactId>parent</artifactId>
<version>3.2.0-GA</version>
</parent>
<artifactId>gatein-jsp-hellouser</artifactId>
<packaging>war</packaging>
<name>GateIn Portal Examples - JSP Hello User Portlet</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.webui.portal</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.webui.eXo</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
{code}
If I use the JCR implementations in the actionProcess method of the portlet:
{code}
RepositoryImpl repository =
(RepositoryImpl)repositoryService.getRepository("repository");
SessionImpl session = (SessionImpl)repository.login();
NodeImpl root = (NodeImpl)session.getRootNode();
System.out.println(root.getName());
session.logout();
{code}
That's ok.. it returns the node root name.
If I use the JCR standard interfaces instead of the implementations:
{code}
import javax.jcr.Node;
import javax.jcr.Repository;
import javax.jcr.Session;
...
Repository repository = repositoryService.getRepository("repository");
Session session = repository.login();
Node root = session.getRootNode();
System.out.println(root.getName());
session.logout();
{code}
I have this Exception:
{code}
Apr 25, 2012 5:20:40 PM org.exoplatform.portal.webui.application.UIPortletLifecycle
processAction
SEVERE: Error processing the action: javax.servlet.ServletException
org.gatein.pc.api.PortletInvokerException: javax.servlet.ServletException
at
org.gatein.pc.portlet.aspects.ContextDispatcherInterceptor.invoke(ContextDispatcherInterceptor.java:101)
at
org.gatein.pc.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:93)
at
org.gatein.pc.portlet.aspects.SecureTransportInterceptor.invoke(SecureTransportInterceptor.java:69)
at
org.gatein.pc.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:93)
at org.gatein.pc.portlet.aspects.ValveInterceptor.invoke(ValveInterceptor.java:75)
at
org.gatein.pc.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:93)
at
org.gatein.pc.portlet.container.ContainerPortletInvoker.invoke(ContainerPortletInvoker.java:131)
at
org.gatein.pc.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:93)
at
org.gatein.pc.portlet.state.producer.ProducerPortletInvoker.invoke(ProducerPortletInvoker.java:249)
at
org.gatein.pc.federation.impl.FederatedPortletInvokerService.invoke(FederatedPortletInvokerService.java:163)
at
org.gatein.pc.federation.impl.FederatingPortletInvokerService.invoke(FederatingPortletInvokerService.java:244)
at
org.gatein.pc.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:93)
at
org.gatein.pc.portlet.aspects.PortletCustomizationInterceptor.invoke(PortletCustomizationInterceptor.java:76)
at
org.gatein.pc.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:93)
at
org.gatein.pc.portlet.aspects.ConsumerCacheInterceptor.invoke(ConsumerCacheInterceptor.java:247)
at
org.gatein.pc.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:93)
at org.exoplatform.portal.webui.application.UIPortlet.invoke(UIPortlet.java:1045)
at
org.exoplatform.portal.webui.application.UIPortletActionListener$ProcessActionActionListener.execute(UIPortletActionListener.java:123)
at org.exoplatform.webui.event.Event.broadcast(Event.java:89)
at
org.exoplatform.portal.webui.application.UIPortletLifecycle.processAction(UIPortletLifecycle.java:133)
at
org.exoplatform.portal.webui.application.UIPortletLifecycle.processAction(UIPortletLifecycle.java:62)
at org.exoplatform.webui.core.UIComponent.processAction(UIComponent.java:133)
at
org.exoplatform.portal.webui.workspace.UIPortalApplicationLifecycle.processAction(UIPortalApplicationLifecycle.java:83)
at
org.exoplatform.portal.webui.workspace.UIPortalApplicationLifecycle.processAction(UIPortalApplicationLifecycle.java:37)
at org.exoplatform.webui.core.UIComponent.processAction(UIComponent.java:133)
at org.exoplatform.webui.core.UIApplication.processAction(UIApplication.java:132)
at
org.exoplatform.portal.webui.workspace.UIPortalApplication.processAction(UIPortalApplication.java:596)
at
org.exoplatform.portal.application.PortalRequestHandler.processRequest(PortalRequestHandler.java:177)
at
org.exoplatform.portal.application.PortalRequestHandler.execute(PortalRequestHandler.java:150)
at org.exoplatform.web.WebAppController.service(WebAppController.java:366)
at
org.exoplatform.portal.application.PortalController.onService(PortalController.java:127)
at
org.exoplatform.container.web.AbstractHttpServlet.service(AbstractHttpServlet.java:132)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.exoplatform.web.login.RememberMeFilter.doFilter(RememberMeFilter.java:89)
at org.exoplatform.web.login.RememberMeFilter.doFilter(RememberMeFilter.java:55)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.exoplatform.web.filter.ExtensibleFilter$ExtensibleFilterChain.doFilter(ExtensibleFilter.java:110)
at org.exoplatform.web.filter.ExtensibleFilter.doFilter(ExtensibleFilter.java:80)
at org.exoplatform.web.filter.GenericFilter.doFilter(GenericFilter.java:79)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.exoplatform.web.CacheUserProfileFilter.doFilter(CacheUserProfileFilter.java:73)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.exoplatform.frameworks.jcr.web.ThreadLocalSessionProviderInitializedFilter.doFilter(ThreadLocalSessionProviderInitializedFilter.java:116)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.exoplatform.services.security.web.SetCurrentIdentityFilter.doFilter(SetCurrentIdentityFilter.java:88)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.exoplatform.web.login.ClusteredSSOFilter.doFilter(ClusteredSSOFilter.java:73)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.exoplatform.container.web.PortalContainerFilter.doFilter(PortalContainerFilter.java:69)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:680)
Caused by: javax.servlet.ServletException
at org.gatein.wci.command.CommandServlet.include(CommandServlet.java:102)
at org.gatein.wci.command.CommandDispatcher.include(CommandDispatcher.java:58)
at
org.gatein.wci.tomcat.TC6ServletContainerContext.include(TC6ServletContainerContext.java:114)
at
org.gatein.wci.impl.DefaultServletContainer.include(DefaultServletContainer.java:271)
at
org.gatein.pc.portlet.impl.spi.AbstractServerContext.dispatch(AbstractServerContext.java:69)
at
org.gatein.pc.portlet.aspects.ContextDispatcherInterceptor.invoke(ContextDispatcherInterceptor.java:77)
... 69 more
Caused by: java.lang.IncompatibleClassChangeError: Class
org.exoplatform.services.jcr.impl.core.RepositoryImpl does not implement the requested
interface javax.jcr.Repository
at org.jboss.portal.portlet.samples.MyPortlet2.processAction(MyPortlet2.java:45)
at
org.gatein.pc.portlet.impl.jsr168.PortletContainerImpl$Invoker.doFilter(PortletContainerImpl.java:558)
at
org.gatein.pc.portlet.impl.jsr168.api.FilterChainImpl.doFilter(FilterChainImpl.java:109)
at
org.exoplatform.portal.application.ApplicationMonitoringFilter.doFilter(ApplicationMonitoringFilter.java:45)
at
org.gatein.pc.portlet.impl.jsr168.api.FilterChainImpl.doFilter(FilterChainImpl.java:109)
at
org.gatein.pc.portlet.impl.jsr168.api.FilterChainImpl.doFilter(FilterChainImpl.java:72)
at
org.gatein.pc.portlet.impl.jsr168.PortletContainerImpl.dispatch(PortletContainerImpl.java:506)
at
org.gatein.pc.portlet.container.ContainerPortletDispatcher.invoke(ContainerPortletDispatcher.java:42)
at
org.gatein.pc.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:93)
at
org.gatein.pc.portlet.aspects.EventPayloadInterceptor.invoke(EventPayloadInterceptor.java:197)
at
org.gatein.pc.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:93)
at
org.gatein.pc.portlet.aspects.RequestAttributeConversationInterceptor.invoke(RequestAttributeConversationInterceptor.java:119)
at
org.gatein.pc.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:93)
at org.gatein.pc.portlet.aspects.CCPPInterceptor.invoke(CCPPInterceptor.java:65)
at
org.gatein.pc.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:93)
at org.gatein.pc.bridge.BridgeInterceptor.invoke(BridgeInterceptor.java:49)
at
org.gatein.pc.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:93)
at
org.gatein.pc.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:93)
at
org.gatein.pc.portlet.aspects.SessionInvalidatorInterceptor.invoke(SessionInvalidatorInterceptor.java:55)
at
org.gatein.pc.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:93)
at
org.gatein.pc.portlet.aspects.ContextDispatcherInterceptor.access$001(ContextDispatcherInterceptor.java:49)
at
org.gatein.pc.portlet.aspects.ContextDispatcherInterceptor$1.doCallback(ContextDispatcherInterceptor.java:123)
at
org.gatein.wci.command.CommandDispatcher$CallbackCommand.execute(CommandDispatcher.java:82)
at sun.reflect.GeneratedMethodAccessor158.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.gatein.wci.command.CommandServlet.doGet(CommandServlet.java:135)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
at
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:551)
at
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:488)
at org.gatein.wci.command.CommandServlet.include(CommandServlet.java:84)
... 74 more
Apr 25, 2012 5:20:40 PM org.exoplatform.web.application.AbstractApplicationMessage
resolveMessage
WARNING: Can not find resource bundle for key : javax.servlet.ServletException
{code}
I suppose there is some duplicated dependency in the tomcat bundle package
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira