Hi Thomas & All, On Fri, Jun 20, 2008 at 2:15 PM, Thomas Mortagne <[email protected]> wrote:
On Thu, Jun 19, 2008 at 6:48 PM, Asiri Rathnayake <[email protected]> wrote:
On Thu, Jun 19, 2008 at 5:59 PM, Thomas Mortagne < [email protected]> wrote:
On Thu, Jun 19, 2008 at 12:56 PM, Asiri Rathnayake <[email protected]> wrote:
Hi Thomas and All,
On Thu, Jun 19, 2008 at 2:16 AM, Thomas Mortagne < [email protected]> wrote:
Asiri, is webdav servlet use Utils.prepareContext to create/prepare the context ? (the Utils's ComponentManager is initialized in it)
Previously we used a small workaround for a problem we encountered with component manager as follows,
In Utils.prepareContext() method we had a problem where the component manager is null ... so we did,
ComponentManager componentManager = (ComponentManager) engine_context.getAttribute(ComponentManager.class.getName());
+ if(null != componentManager) { + context.put(ComponentManager.class.getName(), componentManager); + }
You also have to call static Utils.setComponentManager(componentManager) to init Utils ComponentManager.
How can i initialize the componentManager (to pass into above method) ?
Sorry about asking too much questions, kind of away from my build environment, no way to test till tomorrow.
Thanks.
- Asiri
Utils.getComponent("component") does not use the context's ComponentManager anymore to be able to get component whithout context.
This worked fine untill recently. But I think now we have to handle
this
issue. The main problem is,
ComponentManager componentManager = (ComponentManager) engine_context.getAttribute(ComponentManager.class.getName());
Here, componentManager becomes null. What could be the reason for this ?
I look in sandbox this time and I think the problem is that ComponentManager is not created and inserted in engine_context so when prepareContext ask for it it get a null value and give it to Utils. You should look in shared-test project
(/trunks/xwiki-platform-tools/xwiki-shared-tests/src/main/java/com/xpn/xwiki/test/AbstractXWikiComponentTestCase#getComponentManager()) to see how to create one. Then insert it in the "engine" (XWikiServletContext here) argument before calling prepareContext.
I can do it directly in xwiki-webdav and commit in sandbox if you want.
I tried to follow this scheme but now I'm getting a different problem, <dump> java.lang.ClassCastException: org.apache.maven.plugin.MavenPluginDiscoverer at org.codehaus.plexus.component.discovery.DefaultComponentDiscovererManager.initialize(DefaultComponentDiscovererManager.java:94) at org.codehaus.plexus.container.initialization.InitializeComponentDiscovererManagerPhase.initializeCoreComponent(InitializeComponentDiscovererManagerPhase.java:36) at org.codehaus.plexus.container.initialization.AbstractCoreComponentInitializationPhase.execute(AbstractCoreComponentInitializationPhase.java:37) at org.codehaus.plexus.DefaultPlexusContainer.initializePhases(DefaultPlexusContainer.java:914) at org.codehaus.plexus.DefaultPlexusContainer.initialize(DefaultPlexusContainer.java:858) at org.codehaus.plexus.DefaultPlexusContainer.construct(DefaultPlexusContainer.java:834) at org.codehaus.plexus.DefaultPlexusContainer.<init>(DefaultPlexusContainer.java:204) at com.xpn.xwiki.plugin.webdav.XWikiDavResourceImpl.getComponentManager(XWikiDavResourceImpl.java:1441) at com.xpn.xwiki.plugin.webdav.XWikiDavResourceImpl.getXWikiContext(XWikiDavResourceImpl.java:348) at com.xpn.xwiki.plugin.webdav.XWikiDavResourceImpl.<init>(XWikiDavResourceImpl.java:213) at com.xpn.xwiki.plugin.webdav.XWikiResourceFactoryImpl.createResource(XWikiResourceFactoryImpl.java:105) at com.xpn.xwiki.plugin.webdav.XWikiResourceFactoryImpl.createResource(XWikiResourceFactoryImpl.java:69) at com.xpn.xwiki.plugin.webdav.XWikiDavServlet.service(XWikiDavServlet.java:351) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:219) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:738) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405) at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:113) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:325) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:535) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:873) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:391) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488) </dump> Then after little browsing i came across http://jira.codehaus.org/browse/PLX-331 and then tried, 1. Build plexus-servlet locally. 2. Build xwiki-plexus locally (with the new version of plexus-servlet) 3. Build & tried `mvn jetty:run` on xwiki-webdav But still it gives the same error. I am so stuck here and need your help to fix this. Simply, i need to know how to properly initialize the componentManager. The procedure used in (/trunks/xwiki-platform-tools/xwiki-shared-tests/src/main/java/com/xpn/xwiki/test/AbstractXWikiComponentTestCase#getComponentManager()) doesn't seem to work for me. Please help. - Asiri
Thanks a lot.
- Asiri
PS : Previously vincent said not to use this workaround but we used it
since
it worked.
On Wed, Jun 18, 2008 at 10:43 PM, Thomas Mortagne <[email protected]> wrote:
ok, I think the problem is that when the first connection is webdav ComponentManager is not initialized in Utils
On Wed, Jun 18, 2008 at 10:28 PM, Thomas Mortagne <[email protected]> wrote: > Also I just fixed a build bug : cache was not built when building
from
/trunks
> > On Wed, Jun 18, 2008 at 10:25 PM, Thomas Mortagne > <[email protected]> wrote: >> Hi, >> >> This error append when you try to use cache component before >> ComponentManager initialization, it's not really related to cache >> itself. >> >> How do you reproduce this ? Is it in a unit test ? I don't have any >> problem in virtual or non virtual mode when using xwiki in standalone >> or from Eclipse.... >> >> On Wed, Jun 18, 2008 at 9:11 PM, Asiri Rathnayake >> <[email protected]> wrote: >>> Hi All, >>> >>> I cannot test xwiki-webdav anymore because XWikiCacheStore throws a null >>> pointer exception that i cannot figure out. I think this is introduced by a >>> recent commit, please help me with this. Following is the exception, >>> >>> <dump> >>> java.lang.NullPointerException >>> at >>> com.xpn.xwiki.store.XWikiCacheStore.initCache(XWikiCacheStore.java:95) >>> at >>> com.xpn.xwiki.store.XWikiCacheStore.initCache(XWikiCacheStore.java:80) >>> at >>> com.xpn.xwiki.store.XWikiCacheStore.<init>(XWikiCacheStore.java:62) >>> at com.xpn.xwiki.XWiki.initXWiki(XWiki.java:675) >>> at com.xpn.xwiki.XWiki.<init>(XWiki.java:652) >>> at com.xpn.xwiki.XWiki.getMainXWiki(XWiki.java:312) >>> at com.xpn.xwiki.XWiki.getXWiki(XWiki.java:383) >>> at >>>
com.xpn.xwiki.plugin.webdav.XWikiDavResourceImpl.getXWikiContext(XWikiDavResourceImpl.java:350)
>>> at >>>
com.xpn.xwiki.plugin.webdav.XWikiDavResourceImpl.<init>(XWikiDavResourceImpl.java:205)
>>> at >>>
com.xpn.xwiki.plugin.webdav.XWikiResourceFactoryImpl.createResource(XWikiResourceFactoryImpl.java:105)
>>> at >>>
com.xpn.xwiki.plugin.webdav.XWikiResourceFactoryImpl.createResource(XWikiResourceFactoryImpl.java:69)
>>> at >>>
com.xpn.xwiki.plugin.webdav.XWikiDavServlet.service(XWikiDavServlet.java:351)
>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) >>> at >>> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) >>> at >>>
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
>>> at >>>
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:219)
>>> at >>>
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
>>> at >>>
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:738)
>>> at >>> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405) >>> at >>>
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
>>> at >>>
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:113)
>>> at >>>
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>>> at org.mortbay.jetty.Server.handle(Server.java:325) >>> at >>>
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:535)
>>> at >>>
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:859)
>>> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514) >>> at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) >>> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:391) >>> at >>>
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
>>> at >>>
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
>>> </dump> >>> >>> In XWikiCacheStore.initCache() method, >>> >>> CacheFactory cacheFactory = context.getWiki().getCacheFactory(); >>> >>> here, cacheFactory has become null. >>> >>> I've only found this problem and currently looking into it, if anyone can >>> help me get over this quickly it would be a big help. >>> >>> Thanks. >>> >>> - Asiri >>> _______________________________________________ >>> devs mailing list >>> [email protected] >>> http://lists.xwiki.org/mailman/listinfo/devs >>> >> >> >> >> -- >> Thomas Mortagne >> > > > > -- > Thomas Mortagne >
-- Thomas Mortagne
-- Thomas Mortagne _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs