Mail Archive Home | exoplatform List | April 2008 Index
| <-- Date Index --> | <-- Thread Index --> |
I have a test case for the filter problem. Simply use maven and
create a new webapp using the webapp archetype. Then modify the
web.xml file to include the filters you suggested:
<!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>Sample Exo Webapp</display-name>
<filter>
<filter-name>ThreadLocalSessionProviderInitializedFilter</filter-name>
<filter-class>org.exoplatform.frameworks.jcr.web.ThreadLocalSessionProviderInitializedFilter</filter-class>
</filter>
<filter>
<filter-name>PortalContainerInitializedFilter</filter-name>
<filter-class>org.exoplatform.frameworks.jcr.web.PortalContainerInitializedFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ThreadLocalSessionProviderInitializedFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>PortalContainerInitializedFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.exoplatform.portal.application.PortalSessionListener</listener-class>
</listener>
</web-app>
Deploy the webapp in tomcat, launch tomcat, try to bring up the app
home page in your browser. I get the same error as we are
experiencing in our more complicated setup:
Apr 9, 2008 7:40:31 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at
org.exoplatform.frameworks.jcr.web.ThreadLocalSessionProviderInitializedFilter.doFilter(ThreadLocalSessionProviderInitializedFilter.java:104)
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:228)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
at java.lang.Thread.run(Thread.java:619)
Apr 9, 2008 7:42:26 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
javax.servlet.ServletException: Could not initialize
PortalContainer.Current ExoContainer is:
org.exoplatform.container.RootContainer@889c4e
at
org.exoplatform.frameworks.jcr.web.PortalContainerInitializedFilter.doFilter(PortalContainerInitializedFilter.java:80)
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:228)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
at java.lang.Thread.run(Thread.java:619)
This happens even after having run the portal in webos and classic
mode. Does this work in your installation ?
Luis
On Tue, Apr 8, 2008 at 7:26 PM, Benjamin Mestrallet
<benjamin.mestrallet@xxxxxxxxxxxxxxx> wrote:
> Could you describe with more details what your applications does exactly and
> in which context that filter code is called?
>
> Cheers
>
>
>
> On Tue, Apr 8, 2008 at 5:46 PM, Luis Arias <kaaloo@xxxxxxxxx> wrote:
>
> > Benjamin,
> >
> > The webapp web.xml was modified to use the filters you pointed out
> > below, using /* as the filter mapping.
> >
> > We are getting the following stacktrace in the filter:
> >
> >
> > org.apache.catalina.core.StandardWrapperValve invoke
> > GRAVE: "Servlet.service()" pour la servlet jsp a généré une exception
> > javax.servlet.ServletException: Could not initialize
> > PortalContainer.Current ExoContainer is:
> > org.exoplatform.container.RootContainer@1862525
> > at
> org.exoplatform.frameworks.jcr.web.PortalContainerInitializedFilter.doFilter(PortalContainerInitializedFilter.java:80)
> > 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:228)
> > at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
> > at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
> > at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
> > at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> > at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
> > at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
> > at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
> > at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
> > at java.lang.Thread.run(Thread.java:619)
> >
> > Are there any other configuration items that need to be addressed in
> > the web.xml or is there some java code that needs to be written to
> > correctly initialize the webapp in the exo environment ?
> >
> > Please let us know if any other code or configuration items are useful
> > to you so Michael can send them to you.
> >
> > Thanks again,
> >
> > Luis
> > On Tue, Apr 8, 2008 at 3:42 PM, Benjamin Mestrallet
> > <benjamin.mestrallet@xxxxxxxxxxxxxxx> wrote:
> >
> >
> >
> > > How does the webapp is called, I mean that code?
> > >
> > > as a portlet (aka groing through the portal URL) or independently (for
> > > example in an IFrame)
> > >
> > > If it is an IFrame then you surely need to have a filer in your webapp
> that
> > > will setup the PortalContainer current instance in the threadlocal of
> your
> > > request (from the iframe to your webapp)
> > >
> > > The filter that may be needed in your web.xml are:
> > >
> > > <filter>
> > > <filter-name>PortalContainerInitializedFilter</filter-name>
> > >
> > >
> <filter-class>org.exoplatform.frameworks.jcr.web.PortalContainerInitializedFilter</filter-class>
> > > </filter>
> > >
> > > <filter>
> > >
> <filter-name>ThreadLocalSessionProviderInitializedFilter</filter-name>
> > >
> > >
> <filter-class>org.exoplatform.frameworks.jcr.web.ThreadLocalSessionProviderInitializedFilter</filter-class>
> > > </filter>
> > >
> > > and then need to correctly set up the filter mapping like for instance:
> > >
> > > <filter-mapping>
> > > <filter-name>PortalContainerInitializedFilter</filter-name>
> > > <url-pattern>/rest/*</url-pattern>
> > > </filter-mapping>
> > >
> > >
> > >
> > >
> > > On Tue, Apr 8, 2008 at 12:38 PM, Luis Arias <kaaloo@xxxxxxxxx> wrote:
> > > >
> > > >
> > > >
> > > > Hi,
> > > >
> > > > I'm reporting this problem for a friend Michael who has been having
> > > > some problems recently instanciating a component from a webapp running
> > > > on an exo-tomcat installation (latest community build).
> > > >
> > > > The component passes unit tests run against the StandaloneContainer,
> > > > but fails when instanciated from the webapp.
> > > >
> > > > [07 avr. 17:24:12] DEBUG (class Archiver in thread
> > > > graphane.diffusion.listener#0) - calling
> > > > Archiver.diffuse(Hashtable<String, String> argsHashTable, java.io.File
> > > > file)
> > > > java.lang.Exception: PortalContainer.getInstance() returns null
> > > > at com.docxa.corus.jcr.Archiver.getSession(Archiver.java:59)
> > > > at com.docxa.corus.jcr.Archiver.diffuse(Archiver.java:77)
> > > > at
> > >
> com.graphane.core.diffusion.listener.ListenerDiffusionComponent.dispatchDocuments(ListenerDiffusionComponent.java:85)
> > > > at
> > >
> com.graphane.satellites.diffusion.threadstools.ThreadProcessor.callDispatchDocuments(ThreadProcessor.java:63)
> > > > at
> > >
> com.graphane.satellites.diffusion.threadstools.ThreadProcessor.processDiffusion(ThreadProcessor.java:99)
> > > > at
> > >
> com.graphane.satellites.diffusion.threadstools.ThreadProcessor.run(ThreadProcessor.java:222)
> > > > [07 avr. 17:24:12] ERROR (class Archiver in thread
> > > > graphane.diffusion.listener#0) - Unable to diffuse to JCR
> > > > java.lang.Exception: PortalContainer.getInstance() returns null
> > > > at com.docxa.corus.jcr.Archiver.getSession(Archiver.java:59)
> > > > at com.docxa.corus.jcr.Archiver.diffuse(Archiver.java:77)
> > > > at
> > >
> com.graphane.core.diffusion.listener.ListenerDiffusionComponent.dispatchDocuments(ListenerDiffusionComponent.java:85)
> > > > at
> > >
> com.graphane.satellites.diffusion.threadstools.ThreadProcessor.callDispatchDocuments(ThreadProcessor.java:63)
> > > > at
> > >
> com.graphane.satellites.diffusion.threadstools.ThreadProcessor.processDiffusion(ThreadProcessor.java:99)
> > > > at
> > >
> com.graphane.satellites.diffusion.threadstools.ThreadProcessor.run(ThreadProcessor.java:222)
> > > >
> > > >
> > > > The code that instanciates the component in the webapp is the
> following:
> > > >
> > > > Class < DiffusionListenerInterface > classToLoad =
> > > > (Class < DiffusionListenerInterface > )
> > > > Class.forName(classNameToRegister);
> > > > Constructor < DiffusionListenerInterface > constructor =
> > > > classToLoad.getConstructor();
> > > > DiffusionListenerInterface diffusionListenerToRegister =
> > > > constructor.newInstance();
> > > >
> > > >
> > > > The call to PortalContainer.getInstance() that fails in the component
> > > > is the following:
> > > >
> > > > private Session getSession() throws RepositoryException
> > > > {
> > > > RepositoryService repoService =
> > > >
> > >
> (RepositoryService)PortalContainer.getInstance().getComponentInstanceOfType(RepositoryService.class);
> > > > repository = repoService.getCurrentRepository();
> > > > String wsName =
> > > repository.getConfiguration().getDefaultWorkspaceName();
> > > > return
> > > repository.getSystemSession(wsName).getRootNode().getSession();
> > > > }
> > > >
> > > > We are stumped as to why this is happening, maybe some configuration
> > > > files missing in the webapp ? Is there a better way to obtain a JCR
> > > > Session for the component ? Is there a better way to instanciate the
> > > > component from the webapp ?
> > > >
> > > > Thanks,
> > > >
> > > > --
> > > > Luis Arias
> > > > +33 6 14 20 87 93
> > > > skype : kaaloo
> > > >
> > > >
> > > > --
> > > > You receive this message as a subscriber of the exoplatform@xxxxxxx
> > > mailing list.
> > > > To unsubscribe: mailto:exoplatform-unsubscribe@xxxxxxx
> > > > For general help: mailto:sympa@xxxxxxx?subject=help
> > > > OW2 mailing lists service home page: http://www.ow2.org/wws
> > > >
> > > >
> > >
> > >
> >
> >
> >
> > --
> >
> >
> >
> > Luis Arias
> > +33 6 14 20 87 93
> > skype : kaaloo
> >
> >
> > --
> > You receive this message as a subscriber of the exoplatform@xxxxxxx
> mailing list.
> > To unsubscribe: mailto:exoplatform-unsubscribe@xxxxxxx
> > For general help: mailto:sympa@xxxxxxx?subject=help
> > OW2 mailing lists service home page: http://www.ow2.org/wws
> >
> >
>
>
--
Luis Arias
+33 6 14 20 87 93
skype : kaaloo
| <-- Date Index --> | <-- Thread Index --> |
Powered by MHonArc.
Copyright © 2006-2007, OW2 Consortium | contact | webmaster.