You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Alexander Saar <al...@googlemail.com> on 2008/01/02 12:59:01 UTC

Problems with sample app

Hello Sling team,
last days I started playing around with the latest Sling trunk. I
noticed that after the big changes that happened in the last weeks, the
sample application does not work anymore.

After some debugging I noticed, that the script resolving looks under
different paths than the current sample app stores its scripts. So I
corrected the paths according to the locations the script resolver is
using. In my instance the scripts are now available at
/apps/sling/SampleContent, /apps/sling/SamplePage and
/apps/org/apache/sling/sample.

Now the script resolver is able to find the right script, but there is
still no output returned for my request. The problem is probably that
during installation of the sample app the OCM mapping is not able to
find the SamplePage and SampleContent classes in the bundle, as
indicated by the exceptions I found in the error log (see stack trace
below).


02.01.2008 12:44:54 *WARN * System Bundle:
org/apache/sling/sample/SamplePage.class
(org.apache.felix.moduleloader.ResourceNotFoundException:
org/apache/sling/sample/SamplePage.class)
org.apache.felix.moduleloader.ResourceNotFoundException:
org/apache/sling/sample/SamplePage.class
    at
org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findClassOrResource(R4SearchPolicyCore.java:426)
    at
org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findResource(R4SearchPolicyCore.java:206)
    at
org.apache.felix.framework.searchpolicy.R4SearchPolicy.findResource(R4SearchPolicy.java:51)
    at
org.apache.felix.moduleloader.ModuleImpl.getResource(ModuleImpl.java:168)
    at org.apache.felix.framework.Felix.getBundleResource(Felix.java:1334)
    at
org.apache.felix.framework.BundleImpl.getResource(BundleImpl.java:170)
    at
org.apache.sling.jcr.resource.internal.mapping.classloader.BundleLoader.loadClass(BundleLoader.java:43)
    at
org.apache.sling.jcr.resource.internal.mapping.classloader.MapperClassLoader.loadClass(MapperClassLoader.java:121)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at
org.apache.jackrabbit.ocm.reflection.ReflectionUtils.forName(ReflectionUtils.java:162)
    at
org.apache.jackrabbit.ocm.mapper.model.ClassDescriptor.validateClassName(ClassDescriptor.java:395)
    at
org.apache.jackrabbit.ocm.mapper.model.ClassDescriptor.afterPropertiesSet(ClassDescriptor.java:387)
    at
org.apache.sling.jcr.resource.internal.mapping.ClassDescriptorReader.validateDescriptors(ClassDescriptorReader.java:515)
    at
org.apache.sling.jcr.resource.internal.mapping.ClassDescriptorReader.validateDescriptors(ClassDescriptorReader.java:517)
    at
org.apache.sling.jcr.resource.internal.mapping.ClassDescriptorReader.verify(ClassDescriptorReader.java:430)
    at
org.apache.sling.jcr.resource.internal.mapping.ClassDescriptorReader.getMappingDescriptor(ClassDescriptorReader.java:87)
    at
org.apache.sling.jcr.resource.internal.mapping.ObjectContentManagerFactory.loadMappings(ObjectContentManagerFactory.java:230)
    at
org.apache.sling.jcr.resource.internal.mapping.ObjectContentManagerFactory.addBundle(ObjectContentManagerFactory.java:171)
    at
org.apache.sling.jcr.resource.internal.mapping.ObjectContentManagerFactory.registerMapperClient(ObjectContentManagerFactory.java:147)
    at
org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl.activate(JcrResourceResolverFactoryImpl.java:396)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
org.apache.felix.scr.impl.ImmediateComponentManager.createImplementationObject(ImmediateComponentManager.java:228)
    at
org.apache.felix.scr.impl.ImmediateComponentManager.createComponent(ImmediateComponentManager.java:134)
    at
org.apache.felix.scr.impl.AbstractComponentManager.activateInternal(AbstractComponentManager.java:412)
    at
org.apache.felix.scr.impl.AbstractComponentManager.access$100(AbstractComponentManager.java:45)
    at
org.apache.felix.scr.impl.AbstractComponentManager$2.run(AbstractComponentManager.java:121)
    at
org.apache.felix.scr.impl.ComponentActorThread.run(ComponentActorThread.java:85)
02.01.2008 12:44:54 *WARN * System Bundle:
org/apache/sling/sample/SamplePage.class
(org.apache.felix.moduleloader.ResourceNotFoundException:
org/apache/sling/sample/SamplePage.class)
org.apache.felix.moduleloader.ResourceNotFoundException:
org/apache/sling/sample/SamplePage.class
    at
org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findClassOrResource(R4SearchPolicyCore.java:426)
    at
org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findResource(R4SearchPolicyCore.java:206)
    at
org.apache.felix.framework.searchpolicy.R4SearchPolicy.findResource(R4SearchPolicy.java:51)
    at
org.apache.felix.moduleloader.ModuleImpl.getResource(ModuleImpl.java:168)
    at org.apache.felix.framework.Felix.getBundleResource(Felix.java:1334)
    at
org.apache.felix.framework.BundleImpl.getResource(BundleImpl.java:170)
    at
org.apache.sling.jcr.resource.internal.mapping.classloader.BundleLoader.loadClass(BundleLoader.java:43)
    at
org.apache.sling.jcr.resource.internal.mapping.classloader.MapperClassLoader.loadClass(MapperClassLoader.java:121)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at
org.apache.jackrabbit.ocm.reflection.ReflectionUtils.forName(ReflectionUtils.java:162)
    at
org.apache.jackrabbit.ocm.mapper.model.ClassDescriptor.validateClassName(ClassDescriptor.java:395)
    at
org.apache.jackrabbit.ocm.mapper.model.ClassDescriptor.afterPropertiesSet(ClassDescriptor.java:387)
    at
org.apache.sling.jcr.resource.internal.mapping.ClassDescriptorReader.validateDescriptors(ClassDescriptorReader.java:515)
    at
org.apache.sling.jcr.resource.internal.mapping.ClassDescriptorReader.validateDescriptors(ClassDescriptorReader.java:517)
    at
org.apache.sling.jcr.resource.internal.mapping.ClassDescriptorReader.verify(ClassDescriptorReader.java:430)
    at
org.apache.sling.jcr.resource.internal.mapping.ClassDescriptorReader.getMappingDescriptor(ClassDescriptorReader.java:87)
    at
org.apache.sling.jcr.resource.internal.mapping.ObjectContentManagerFactory.loadMappings(ObjectContentManagerFactory.java:230)
    at
org.apache.sling.jcr.resource.internal.mapping.ObjectContentManagerFactory.addBundle(ObjectContentManagerFactory.java:171)
    at
org.apache.sling.jcr.resource.internal.mapping.ObjectContentManagerFactory.registerMapperClient(ObjectContentManagerFactory.java:147)
    at
org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl.activate(JcrResourceResolverFactoryImpl.java:396)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
org.apache.felix.scr.impl.ImmediateComponentManager.createImplementationObject(ImmediateComponentManager.java:228)
    at
org.apache.felix.scr.impl.ImmediateComponentManager.createComponent(ImmediateComponentManager.java:134)
    at
org.apache.felix.scr.impl.AbstractComponentManager.activateInternal(AbstractComponentManager.java:412)
    at
org.apache.felix.scr.impl.AbstractComponentManager.access$100(AbstractComponentManager.java:45)
    at
org.apache.felix.scr.impl.AbstractComponentManager$2.run(AbstractComponentManager.java:121)
    at
org.apache.felix.scr.impl.ComponentActorThread.run(ComponentActorThread.java:85)


This exception probably leads to the problem that the script can not be
compiled as indicated by the next exception that occured when I try to
access the page at
http://localhost:8080/sample/home/moreinfojsp/content.html:


02.01.2008 12:41:16 *WARN * System Bundle: *** Class
'org.apache.jsp.apps.org.apache.sling.sample.html_jsp' was not found.
Bundle 28 does not import package
'org.apache.jsp.apps.org.apache.sling.sample', nor is the package
exported by any other bundle or available from the system class loader.
*** (java.lang.ClassNotFoundException: *** Class
'org.apache.jsp.apps.org.apache.sling.sample.html_jsp' was not found.
Bundle 28 does not import package
'org.apache.jsp.apps.org.apache.sling.sample', nor is the package
exported by any other bundle or available from the system class loader. ***)
java.lang.ClassNotFoundException: *** Class
'org.apache.jsp.apps.org.apache.sling.sample.html_jsp' was not found.
Bundle 28 does not import package
'org.apache.jsp.apps.org.apache.sling.sample', nor is the package
exported by any other bundle or available from the system class loader. ***
    at
org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findClass(R4SearchPolicyCore.java:194)
    at
org.apache.felix.framework.searchpolicy.R4SearchPolicy.findClass(R4SearchPolicy.java:45)
    at
org.apache.felix.moduleloader.ModuleImpl.getClass(ModuleImpl.java:152)
    at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1454)
    at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:341)
    at
org.apache.sling.jcr.classloader.internal.BundleProxyClassLoader.findClass(BundleProxyClassLoader.java:61)
    at
org.apache.sling.jcr.classloader.internal.BundleProxyClassLoader.loadClass(BundleProxyClassLoader.java:69)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at
org.apache.sling.jcr.classloader.internal.RepositoryClassLoaderFacade.loadClass(RepositoryClassLoaderFacade.java:105)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at
org.apache.sling.scripting.jsp.jasper.JspCompilationContext.load(JspCompilationContext.java:644)
    at
org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:144)
    at
org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.getDependants(JspServletWrapper.java:263)
    at
org.apache.sling.scripting.jsp.jasper.compiler.Compiler.isOutDated(Compiler.java:417)
    at
org.apache.sling.scripting.jsp.jasper.compiler.Compiler.isOutDated(Compiler.java:343)
    at
org.apache.sling.scripting.jsp.jasper.JspCompilationContext.compile(JspCompilationContext.java:608)
    at
org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
    at
org.apache.sling.scripting.jsp.JspServletWrapperAdapter.service(JspServletWrapperAdapter.java:49)
    at
org.apache.sling.scripting.jsp.JspScriptEngineFactory.callJsp(JspScriptEngineFactory.java:126)
    at
org.apache.sling.scripting.jsp.JspScriptEngineFactory.access$000(JspScriptEngineFactory.java:71)
    at
org.apache.sling.scripting.jsp.JspScriptEngineFactory$JspScriptEngine.eval(JspScriptEngineFactory.java:268)
    at
org.apache.sling.scripting.resolver.impl.DefaultSlingScript.eval(DefaultSlingScript.java:85)
    at
org.apache.sling.servlet.resolver.helper.SlingScriptServlet.service(SlingScriptServlet.java:72)
    at
org.apache.sling.core.impl.request.RequestData.service(RequestData.java:417)
    at
org.apache.sling.core.impl.SlingMainServlet.processRequest(SlingMainServlet.java:286)
    at
org.apache.sling.core.impl.filter.RequestSlingFilterChain.render(RequestSlingFilterChain.java:48)
    at
org.apache.sling.core.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:54)
    at
org.apache.sling.core.impl.filter.ThemeResolverFilter.doFilter(ThemeResolverFilter.java:76)
    at
org.apache.sling.core.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:52)
    at
org.apache.sling.core.impl.filter.LocaleResolverFilter.doFilter(LocaleResolverFilter.java:85)
    at
org.apache.sling.core.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:52)
    at
org.apache.sling.core.impl.log.RequestLoggerFilter.doFilter(RequestLoggerFilter.java:206)
    at
org.apache.sling.core.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:52)
    at
org.apache.sling.core.impl.SlingMainServlet.service(SlingMainServlet.java:186)
    at
org.apache.sling.core.impl.SlingMainServlet.service(SlingMainServlet.java:158)
    at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:358)
    at
org.mortbay.jetty.servlet.OsgiServletHolder.handle(OsgiServletHolder.java:93)
    at
org.mortbay.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:657)
    at
org.mortbay.jetty.servlet.OsgiServletHandler.dispatch(OsgiServletHandler.java:69)
    at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567)
    at org.mortbay.http.HttpContext.handle(HttpContext.java:1807)
    at org.mortbay.http.HttpContext.handle(HttpContext.java:1757)
    at org.mortbay.http.HttpServer.service(HttpServer.java:879)
    at org.mortbay.http.HttpConnection.service(HttpConnection.java:789)
    at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:960)
    at org.mortbay.http.HttpConnection.handle(HttpConnection.java:806)
    at
org.mortbay.http.SocketListener.handleConnection(SocketListener.java:218)
    at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:331)
    at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:520)
Caused by: java.lang.ClassNotFoundException:
org.apache.jsp.apps.org.apache.sling.sample.html_jsp
    at
org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findClassOrResource(R4SearchPolicyCore.java:422)
    at
org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findClass(R4SearchPolicyCore.java:185)
    ... 49 common frames omitted

Regards,
Alex


Re: Problems with sample app

Posted by Carsten Ziegeler <cz...@apache.org>.
Felix Meschberger wrote:
> Am Mittwoch, den 09.01.2008, 07:35 +0100 schrieb Carsten Ziegeler:
>> Felix Meschberger wrote:
>>> Hi Carsten,
>>>
>>> Am Dienstag, den 08.01.2008, 07:55 +0100 schrieb Carsten Ziegeler:
>>>> It's difficult to tell what is going wrong from here, but one possible 
>>>> problem could be the startup order of the bundles. I've put most of the 
>>>> "org.apache.felix.*" bundles into the WEB-INF/resources/corebundles 
>>>> directory which ensures that these bundles are loaded before the bundles 
>>>> of WEB-INF/resources/bundles.
>>> Except for one case (see below), startup order of bundles MUST not make
>>> a difference. Otherwise there is an issue with the bundles having
>>> problems.
>>>
>>> One example might be a registry class (like the now fixed
>>> SlingServletResolver) which does not cope correctly with servlets
>>> registered before the registry class (component) is activated: Here
>>> these servlets are not handled correctly and hence not seen. This is a
>>> problem of the registry and not of the start order.
>>>
>> I think there are more potential problems - one of them being SCR. If 
>> bundles requiring SCR are started before SCR, the services are either 
>> not registerd or not satisfied. I think I had some problems here as the 
>> bundle was started but not really working. And then other bundles 
>> started to use the services which then failt.
> 
> Correct. As long as SCR is not running, components (and services
> implemented as components) are not active. BUT: Any service must be
> prepared to act upon the situation, that a service is missing. This is
> part of the OSGi service design AFAIUI.
> 
>> As soon as SCR was up and running everything was fine.
>>
>> And I think there were similar issues with the configadmin service. So I 
>> put all bundles implementing stuff from the OSGi compendium into the 
>> corebundles section which prevents potential problems.
> 
> Similar case here: A service requiring configuraiton must be prepared to
> the situation, that the ConfigurationAdmin is not active and should act
> upon it as appropriate: Either use default settings or wait for real
> configuration to arrive.
> 
Yes, that's right - so I guess we have to check our code base for these 
cases.


Carsten


-- 
Carsten Ziegeler
cziegeler@apache.org

Re: Problems with sample app

Posted by Felix Meschberger <fm...@gmail.com>.
Am Mittwoch, den 09.01.2008, 07:35 +0100 schrieb Carsten Ziegeler:
> Felix Meschberger wrote:
> > Hi Carsten,
> > 
> > Am Dienstag, den 08.01.2008, 07:55 +0100 schrieb Carsten Ziegeler:
> >> It's difficult to tell what is going wrong from here, but one possible 
> >> problem could be the startup order of the bundles. I've put most of the 
> >> "org.apache.felix.*" bundles into the WEB-INF/resources/corebundles 
> >> directory which ensures that these bundles are loaded before the bundles 
> >> of WEB-INF/resources/bundles.
> > 
> > Except for one case (see below), startup order of bundles MUST not make
> > a difference. Otherwise there is an issue with the bundles having
> > problems.
> > 
> > One example might be a registry class (like the now fixed
> > SlingServletResolver) which does not cope correctly with servlets
> > registered before the registry class (component) is activated: Here
> > these servlets are not handled correctly and hence not seen. This is a
> > problem of the registry and not of the start order.
> > 
> I think there are more potential problems - one of them being SCR. If 
> bundles requiring SCR are started before SCR, the services are either 
> not registerd or not satisfied. I think I had some problems here as the 
> bundle was started but not really working. And then other bundles 
> started to use the services which then failt.

Correct. As long as SCR is not running, components (and services
implemented as components) are not active. BUT: Any service must be
prepared to act upon the situation, that a service is missing. This is
part of the OSGi service design AFAIUI.

> As soon as SCR was up and running everything was fine.
> 
> And I think there were similar issues with the configadmin service. So I 
> put all bundles implementing stuff from the OSGi compendium into the 
> corebundles section which prevents potential problems.

Similar case here: A service requiring configuraiton must be prepared to
the situation, that the ConfigurationAdmin is not active and should act
upon it as appropriate: Either use default settings or wait for real
configuration to arrive.

Regards
Felix


Re: Problems with sample app

Posted by Carsten Ziegeler <cz...@apache.org>.
Felix Meschberger wrote:
> Hi Carsten,
> 
> Am Dienstag, den 08.01.2008, 07:55 +0100 schrieb Carsten Ziegeler:
>> It's difficult to tell what is going wrong from here, but one possible 
>> problem could be the startup order of the bundles. I've put most of the 
>> "org.apache.felix.*" bundles into the WEB-INF/resources/corebundles 
>> directory which ensures that these bundles are loaded before the bundles 
>> of WEB-INF/resources/bundles.
> 
> Except for one case (see below), startup order of bundles MUST not make
> a difference. Otherwise there is an issue with the bundles having
> problems.
> 
> One example might be a registry class (like the now fixed
> SlingServletResolver) which does not cope correctly with servlets
> registered before the registry class (component) is activated: Here
> these servlets are not handled correctly and hence not seen. This is a
> problem of the registry and not of the start order.
> 
I think there are more potential problems - one of them being SCR. If 
bundles requiring SCR are started before SCR, the services are either 
not registerd or not satisfied. I think I had some problems here as the 
bundle was started but not really working. And then other bundles 
started to use the services which then failt.
As soon as SCR was up and running everything was fine.

And I think there were similar issues with the configadmin service. So I 
put all bundles implementing stuff from the OSGi compendium into the 
corebundles section which prevents potential problems.

Carsten

-- 
Carsten Ziegeler
cziegeler@apache.org

Re: Problems with sample app

Posted by Felix Meschberger <fm...@gmail.com>.
Hi Carsten,

Am Dienstag, den 08.01.2008, 07:55 +0100 schrieb Carsten Ziegeler:
> It's difficult to tell what is going wrong from here, but one possible 
> problem could be the startup order of the bundles. I've put most of the 
> "org.apache.felix.*" bundles into the WEB-INF/resources/corebundles 
> directory which ensures that these bundles are loaded before the bundles 
> of WEB-INF/resources/bundles.

Except for one case (see below), startup order of bundles MUST not make
a difference. Otherwise there is an issue with the bundles having
problems.

One example might be a registry class (like the now fixed
SlingServletResolver) which does not cope correctly with servlets
registered before the registry class (component) is activated: Here
these servlets are not handled correctly and hence not seen. This is a
problem of the registry and not of the start order.

The one exception, I mentioned above is the LogService: Although it is
not technically required to start the log bundle before all others, it
is of course very convenient to have it loaded as early as possible to
get as much logging through the official log channel as possible.

Therefore the log bundle is the only one in the corebundles folder,
which is accessed first. This is the hardcore way of ensuring this.

Regards
Felix

> 
> HTH
> Carsten


Re: Problems with sample app

Posted by Carsten Ziegeler <cz...@apache.org>.
Carsten Ziegeler wrote:
> Felix Meschberger wrote:
>>
>> Maybe the case of inability loading the content due to missing node
>> types. This is fortunately an exception (NoSuchNodeTypeException) we can
>> handle appropriately. Then we may postpone loading the content until the
>> node types exist. Maybe we might add an eventing for this ?
>>
> Hmm, yes, this might solve the issue, but I'm not sure if this is 100% 
> safe. Both, node types and content must be registered/added before the 
> bundle is started.
> If we use synchronous events it should work; the question is if we want 
> to add a dependency to the event package or if there is a simpler 
> solution? (Although the eventing solution might have some advantages as 
> other bundles/services could act on the events as well - not sure if we 
> need this though).
> 
I moved the content adding from the install phase to the starting phase.
This creates a clear order as node types are registered directly after 
the bundle is installed and then the content is added before the bundle 
is started.

Carsten


-- 
Carsten Ziegeler
cziegeler@apache.org

Re: Problems with sample app

Posted by Carsten Ziegeler <cz...@apache.org>.
Felix Meschberger wrote:
> 
> Maybe the case of inability loading the content due to missing node
> types. This is fortunately an exception (NoSuchNodeTypeException) we can
> handle appropriately. Then we may postpone loading the content until the
> node types exist. Maybe we might add an eventing for this ?
> 
Hmm, yes, this might solve the issue, but I'm not sure if this is 100% 
safe. Both, node types and content must be registered/added before the 
bundle is started.
If we use synchronous events it should work; the question is if we want 
to add a dependency to the event package or if there is a simpler 
solution? (Although the eventing solution might have some advantages as 
other bundles/services could act on the events as well - not sure if we 
need this though).

Carsten

-- 
Carsten Ziegeler
cziegeler@apache.org

Re: Problems with sample app

Posted by Felix Meschberger <fm...@gmail.com>.
Hi,

Am Mittwoch, den 09.01.2008, 07:41 +0100 schrieb Carsten Ziegeler:
> Felix Meschberger wrote:
> > Hi Alexander,
> > 
> > Am Dienstag, den 08.01.2008, 17:26 +0100 schrieb Alexander Klimetschek:
> >> One problem is the HTTP Service bundle that is used which did include  
> >> a Servlet API 1.3 implementation (Jetty) although Sling expects a 2.4  
> >> API. That caused runtime errors of the JSPs in the sample app. It can  
> >> be solved when using the patched HTTP Service bundle from the felix  
> >> project [1] written by Felix (thanks to Carsten's help).
> > 
> > I am currently working of getting the http.jetty bundle to using the
> > latest jetty 6.1 from the maven repository. This means Servlet API
> > 2.5 ;-). In addition, I will probably include the Servlet API classes
> > with the http.jetty bundle such that a separate Servlet API bundle is
> > not required any more.
> > 
> > And I also saw these content loading and node type registration issues.
> > As Carsten has been working on these things lately, I assume, he may be
> > more up to date in this respect.
> :)
> 
> Node type registration and content loading is done by two different 
> bundles. Both register a SynchronousBundleListener which is loading 
> content/registering node types on startup of the bundle containing the 
> listener and whenever a bundle is installed/uninstalled.
> 
> Now it seems that in some cases, the bundle loading the content is 
> notified before the bundle that should register the node types.
> I'm not sure but afaik there is no way to force an order of the 
> listeners. Adding the content when the bundle is already started is 
> obviously too late.

Maybe the case of inability loading the content due to missing node
types. This is fortunately an exception (NoSuchNodeTypeException) we can
handle appropriately. Then we may postpone loading the content until the
node types exist. Maybe we might add an eventing for this ?

Regards
Felix


Re: Problems with sample app

Posted by Carsten Ziegeler <cz...@apache.org>.
Felix Meschberger wrote:
> Hi Alexander,
> 
> Am Dienstag, den 08.01.2008, 17:26 +0100 schrieb Alexander Klimetschek:
>> One problem is the HTTP Service bundle that is used which did include  
>> a Servlet API 1.3 implementation (Jetty) although Sling expects a 2.4  
>> API. That caused runtime errors of the JSPs in the sample app. It can  
>> be solved when using the patched HTTP Service bundle from the felix  
>> project [1] written by Felix (thanks to Carsten's help).
> 
> I am currently working of getting the http.jetty bundle to using the
> latest jetty 6.1 from the maven repository. This means Servlet API
> 2.5 ;-). In addition, I will probably include the Servlet API classes
> with the http.jetty bundle such that a separate Servlet API bundle is
> not required any more.
> 
> And I also saw these content loading and node type registration issues.
> As Carsten has been working on these things lately, I assume, he may be
> more up to date in this respect.
:)

Node type registration and content loading is done by two different 
bundles. Both register a SynchronousBundleListener which is loading 
content/registering node types on startup of the bundle containing the 
listener and whenever a bundle is installed/uninstalled.

Now it seems that in some cases, the bundle loading the content is 
notified before the bundle that should register the node types.
I'm not sure but afaik there is no way to force an order of the 
listeners. Adding the content when the bundle is already started is 
obviously too late.

Carsten
-- 
Carsten Ziegeler
cziegeler@apache.org

Re: Problems with sample app

Posted by Felix Meschberger <fm...@gmail.com>.
Hi Alexander,

Am Dienstag, den 08.01.2008, 17:26 +0100 schrieb Alexander Klimetschek:
> One problem is the HTTP Service bundle that is used which did include  
> a Servlet API 1.3 implementation (Jetty) although Sling expects a 2.4  
> API. That caused runtime errors of the JSPs in the sample app. It can  
> be solved when using the patched HTTP Service bundle from the felix  
> project [1] written by Felix (thanks to Carsten's help).

I am currently working of getting the http.jetty bundle to using the
latest jetty 6.1 from the maven repository. This means Servlet API
2.5 ;-). In addition, I will probably include the Servlet API classes
with the http.jetty bundle such that a separate Servlet API bundle is
not required any more.

And I also saw these content loading and node type registration issues.
As Carsten has been working on these things lately, I assume, he may be
more up to date in this respect.

> 10. But during the compilation of the JSPs there are also lots of  
> exceptions in the log like:
> 
> org.apache.felix.moduleloader.ResourceNotFoundException: org/apache/ 
> sling/scripting.class
> org.apache.felix.moduleloader.ResourceNotFoundException: org/apache/ 
> sling/scripting/jsp.class
> org.apache.felix.moduleloader.ResourceNotFoundException: org/apache/ 
> sling/scripting/jsp/jasper.class
> org.apache.felix.moduleloader.ResourceNotFoundException: org/apache/ 
> sling/scripting/jsp/jasper/runtime.class
> and so on...
> 
> and this one:
> java.lang.ClassNotFoundException: *** Class  
> 'org.apache.jsp.apps.sling.SampleContent.html_jsp' was not found.  
> Bundle 28 does not import package  
> 'org.apache.jsp.apps.sling.SampleContent', nor is the package exported  
> by any other bundle or available from the system class loader.
> 
> All of these are WARN level, so maybe they are "normal" !?

These are messages from the Felix framework. While I think, that is ok,
that they are logged, they are not actually WARNINGS as in this context
this is quite expected. So I hacked up the Sling class (not in trunk
yet, but will do soon) to have the Felix framework only log at ERROR
level...

Regards
Felix


Re: Problems with sample app

Posted by Alexander Klimetschek <ak...@day.com>.
Hi,

I experienced the same problem. That's probably Alex and I use the  
same environment: MacOSX and starting sling with the launcher/app/ 
target/....-full.jar

One problem is the HTTP Service bundle that is used which did include  
a Servlet API 1.3 implementation (Jetty) although Sling expects a 2.4  
API. That caused runtime errors of the JSPs in the sample app. It can  
be solved when using the patched HTTP Service bundle from the felix  
project [1] written by Felix (thanks to Carsten's help).

But before getting so far that the sample app can run (ie. it's  
content are in the JCR), there are other problems. Here are my steps:

---------

1. Start with a clean sling, ie. run launcher/app with an empty sling  
home dir (aka empty JCR as well)
2. Deploy the sample app via mvn sling-install
3. There are three errors:
     1) cannot register node types
     2) resource not found: org/apache/sling/sample/SampleContent
     3) resource not found: org/apache/sling/sample/SamplePage
4. The sample app bundle is started anyway
5. But there is no content in the JCR yet (no /apps/sling/...)
6. Now I restart sling (keeping sling home dir and JCR)
7. Upon start of the sample app bundle, the errors 2) and 3) from  
above repeat
8. But now suddenly the content is in JCR
9. I go to http://localhost:8080/sample/content/home/moreinfojsp.html  
and the pages are displayed (Note that this required the patched HTTP  
service mentioned above)
10. But during the compilation of the JSPs there are also lots of  
exceptions in the log like:

org.apache.felix.moduleloader.ResourceNotFoundException: org/apache/ 
sling/scripting.class
org.apache.felix.moduleloader.ResourceNotFoundException: org/apache/ 
sling/scripting/jsp.class
org.apache.felix.moduleloader.ResourceNotFoundException: org/apache/ 
sling/scripting/jsp/jasper.class
org.apache.felix.moduleloader.ResourceNotFoundException: org/apache/ 
sling/scripting/jsp/jasper/runtime.class
and so on...

and this one:
java.lang.ClassNotFoundException: *** Class  
'org.apache.jsp.apps.sling.SampleContent.html_jsp' was not found.  
Bundle 28 does not import package  
'org.apache.jsp.apps.sling.SampleContent', nor is the package exported  
by any other bundle or available from the system class loader.

All of these are WARN level, so maybe they are "normal" !?
---------

Any ideas? I talked with Carsten about it and he also was wondering if  
the order of nodetype and content loading was mixed up...

Alex

[1] https://issues.apache.org/jira/browse/FELIX-55

--
Alexander Klimetschek
alexander.klimetschek@day.com





Re: Problems with sample app

Posted by Carsten Ziegeler <cz...@apache.org>.
Alexander Saar wrote:
> Hi Carsten,
> I still have problems with the sample app. I started with a clean
> checkout of the trunk, build the standalone Sling with the full profile
> and started sling standalone without problems.
> 
> Next I tried to deploy the sample app using the sling maven plugin. This
> failed with the ResourceNotFoundException I mentioned previously. After
> checking the repository I noticed that no content was loaded, but the
> bundle was loaded as it was listed in the Sling console. I uninstalled
> the bundle and tried installation again using the sling console. After
> that initial content was available.
> 
> sling/SamplePage and sling/SampleContent scripts can be resolved now,
> but if I access a page that uses these scripts I still get an empty
> response (an no exception in the log). If I look into the repository the
> JSPs are compiled. So I think the problem has nothing to do with the
> ResourceNotFoundExceptions for SamplePage.class/SampleContent.class as
> they are used in the scripts and without them compiling would probably fail.
> 
> The /org/apache/sling/sample/html.jsp script can not be found in the
> repository after deployment of the bundle. This if I access a page that
> uses this script, the DefaultServlet is resolved.
> 
> I tried to check this behaviour with the webapp distribution. But when I
> deploy it I get exceptions that Felix framework classes can not be
> found. Is it necessary to add Felix core JARs to the servlets container
> classpath?
> 
Hi Alex,

no, there is no need to add the felix classes to the engine's classpath. 
All framework related classes should be in WEB-INF/classes and 
everything else are bundles.
It's difficult to tell what is going wrong from here, but one possible 
problem could be the startup order of the bundles. I've put most of the 
"org.apache.felix.*" bundles into the WEB-INF/resources/corebundles 
directory which ensures that these bundles are loaded before the bundles 
of WEB-INF/resources/bundles.

HTH
Carsten
-- 
Carsten Ziegeler
cziegeler@apache.org

Re: Problems with sample app

Posted by Alexander Saar <al...@googlemail.com>.
Hi Carsten,
I still have problems with the sample app. I started with a clean
checkout of the trunk, build the standalone Sling with the full profile
and started sling standalone without problems.

Next I tried to deploy the sample app using the sling maven plugin. This
failed with the ResourceNotFoundException I mentioned previously. After
checking the repository I noticed that no content was loaded, but the
bundle was loaded as it was listed in the Sling console. I uninstalled
the bundle and tried installation again using the sling console. After
that initial content was available.

sling/SamplePage and sling/SampleContent scripts can be resolved now,
but if I access a page that uses these scripts I still get an empty
response (an no exception in the log). If I look into the repository the
JSPs are compiled. So I think the problem has nothing to do with the
ResourceNotFoundExceptions for SamplePage.class/SampleContent.class as
they are used in the scripts and without them compiling would probably fail.

The /org/apache/sling/sample/html.jsp script can not be found in the
repository after deployment of the bundle. This if I access a page that
uses this script, the DefaultServlet is resolved.

I tried to check this behaviour with the webapp distribution. But when I
deploy it I get exceptions that Felix framework classes can not be
found. Is it necessary to add Felix core JARs to the servlets container
classpath?

Regards,
Alex


Carsten Ziegeler schrieb:
> Hi,
>
> I fixed some problems with the location of the scripts and a bug in the
> servlet resolver. Some of the samples are now working for me.
>
> Can you please recheck and report what is not working for you (if any)?
>
> Thanks
> Carsten
>
> Alexander Saar wrote:
>   
>> Hello Sling team,
>> last days I started playing around with the latest Sling trunk. I
>> noticed that after the big changes that happened in the last weeks, the
>> sample application does not work anymore.
>>
>> After some debugging I noticed, that the script resolving looks under
>> different paths than the current sample app stores its scripts. So I
>> corrected the paths according to the locations the script resolver is
>> using. In my instance the scripts are now available at
>> /apps/sling/SampleContent, /apps/sling/SamplePage and
>> /apps/org/apache/sling/sample.
>>
>> Now the script resolver is able to find the right script, but there is
>> still no output returned for my request. The problem is probably that
>> during installation of the sample app the OCM mapping is not able to
>> find the SamplePage and SampleContent classes in the bundle, as
>> indicated by the exceptions I found in the error log (see stack trace
>> below).
>>
>>
>> 02.01.2008 12:44:54 *WARN * System Bundle:
>> org/apache/sling/sample/SamplePage.class
>> (org.apache.felix.moduleloader.ResourceNotFoundException:
>> org/apache/sling/sample/SamplePage.class)
>> org.apache.felix.moduleloader.ResourceNotFoundException:
>> org/apache/sling/sample/SamplePage.class
>>     at
>> org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findClassOrResource(R4SearchPolicyCore.java:426)
>>     at
>> org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findResource(R4SearchPolicyCore.java:206)
>>     at
>> org.apache.felix.framework.searchpolicy.R4SearchPolicy.findResource(R4SearchPolicy.java:51)
>>     at
>> org.apache.felix.moduleloader.ModuleImpl.getResource(ModuleImpl.java:168)
>>     at org.apache.felix.framework.Felix.getBundleResource(Felix.java:1334)
>>     at
>> org.apache.felix.framework.BundleImpl.getResource(BundleImpl.java:170)
>>     at
>> org.apache.sling.jcr.resource.internal.mapping.classloader.BundleLoader.loadClass(BundleLoader.java:43)
>>     at
>> org.apache.sling.jcr.resource.internal.mapping.classloader.MapperClassLoader.loadClass(MapperClassLoader.java:121)
>>     at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>>     at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
>>     at java.lang.Class.forName0(Native Method)
>>     at java.lang.Class.forName(Class.java:247)
>>     at
>> org.apache.jackrabbit.ocm.reflection.ReflectionUtils.forName(ReflectionUtils.java:162)
>>     at
>> org.apache.jackrabbit.ocm.mapper.model.ClassDescriptor.validateClassName(ClassDescriptor.java:395)
>>     at
>> org.apache.jackrabbit.ocm.mapper.model.ClassDescriptor.afterPropertiesSet(ClassDescriptor.java:387)
>>     at
>> org.apache.sling.jcr.resource.internal.mapping.ClassDescriptorReader.validateDescriptors(ClassDescriptorReader.java:515)
>>     at
>> org.apache.sling.jcr.resource.internal.mapping.ClassDescriptorReader.validateDescriptors(ClassDescriptorReader.java:517)
>>     at
>> org.apache.sling.jcr.resource.internal.mapping.ClassDescriptorReader.verify(ClassDescriptorReader.java:430)
>>     at
>> org.apache.sling.jcr.resource.internal.mapping.ClassDescriptorReader.getMappingDescriptor(ClassDescriptorReader.java:87)
>>     at
>> org.apache.sling.jcr.resource.internal.mapping.ObjectContentManagerFactory.loadMappings(ObjectContentManagerFactory.java:230)
>>     at
>> org.apache.sling.jcr.resource.internal.mapping.ObjectContentManagerFactory.addBundle(ObjectContentManagerFactory.java:171)
>>     at
>> org.apache.sling.jcr.resource.internal.mapping.ObjectContentManagerFactory.registerMapperClient(ObjectContentManagerFactory.java:147)
>>     at
>> org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl.activate(JcrResourceResolverFactoryImpl.java:396)
>>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>     at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>     at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>     at java.lang.reflect.Method.invoke(Method.java:597)
>>     at
>> org.apache.felix.scr.impl.ImmediateComponentManager.createImplementationObject(ImmediateComponentManager.java:228)
>>     at
>> org.apache.felix.scr.impl.ImmediateComponentManager.createComponent(ImmediateComponentManager.java:134)
>>     at
>> org.apache.felix.scr.impl.AbstractComponentManager.activateInternal(AbstractComponentManager.java:412)
>>     at
>> org.apache.felix.scr.impl.AbstractComponentManager.access$100(AbstractComponentManager.java:45)
>>     at
>> org.apache.felix.scr.impl.AbstractComponentManager$2.run(AbstractComponentManager.java:121)
>>     at
>> org.apache.felix.scr.impl.ComponentActorThread.run(ComponentActorThread.java:85)
>> 02.01.2008 12:44:54 *WARN * System Bundle:
>> org/apache/sling/sample/SamplePage.class
>> (org.apache.felix.moduleloader.ResourceNotFoundException:
>> org/apache/sling/sample/SamplePage.class)
>> org.apache.felix.moduleloader.ResourceNotFoundException:
>> org/apache/sling/sample/SamplePage.class
>>     at
>> org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findClassOrResource(R4SearchPolicyCore.java:426)
>>     at
>> org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findResource(R4SearchPolicyCore.java:206)
>>     at
>> org.apache.felix.framework.searchpolicy.R4SearchPolicy.findResource(R4SearchPolicy.java:51)
>>     at
>> org.apache.felix.moduleloader.ModuleImpl.getResource(ModuleImpl.java:168)
>>     at org.apache.felix.framework.Felix.getBundleResource(Felix.java:1334)
>>     at
>> org.apache.felix.framework.BundleImpl.getResource(BundleImpl.java:170)
>>     at
>> org.apache.sling.jcr.resource.internal.mapping.classloader.BundleLoader.loadClass(BundleLoader.java:43)
>>     at
>> org.apache.sling.jcr.resource.internal.mapping.classloader.MapperClassLoader.loadClass(MapperClassLoader.java:121)
>>     at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>>     at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
>>     at java.lang.Class.forName0(Native Method)
>>     at java.lang.Class.forName(Class.java:247)
>>     at
>> org.apache.jackrabbit.ocm.reflection.ReflectionUtils.forName(ReflectionUtils.java:162)
>>     at
>> org.apache.jackrabbit.ocm.mapper.model.ClassDescriptor.validateClassName(ClassDescriptor.java:395)
>>     at
>> org.apache.jackrabbit.ocm.mapper.model.ClassDescriptor.afterPropertiesSet(ClassDescriptor.java:387)
>>     at
>> org.apache.sling.jcr.resource.internal.mapping.ClassDescriptorReader.validateDescriptors(ClassDescriptorReader.java:515)
>>     at
>> org.apache.sling.jcr.resource.internal.mapping.ClassDescriptorReader.validateDescriptors(ClassDescriptorReader.java:517)
>>     at
>> org.apache.sling.jcr.resource.internal.mapping.ClassDescriptorReader.verify(ClassDescriptorReader.java:430)
>>     at
>> org.apache.sling.jcr.resource.internal.mapping.ClassDescriptorReader.getMappingDescriptor(ClassDescriptorReader.java:87)
>>     at
>> org.apache.sling.jcr.resource.internal.mapping.ObjectContentManagerFactory.loadMappings(ObjectContentManagerFactory.java:230)
>>     at
>> org.apache.sling.jcr.resource.internal.mapping.ObjectContentManagerFactory.addBundle(ObjectContentManagerFactory.java:171)
>>     at
>> org.apache.sling.jcr.resource.internal.mapping.ObjectContentManagerFactory.registerMapperClient(ObjectContentManagerFactory.java:147)
>>     at
>> org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl.activate(JcrResourceResolverFactoryImpl.java:396)
>>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>     at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>     at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>     at java.lang.reflect.Method.invoke(Method.java:597)
>>     at
>> org.apache.felix.scr.impl.ImmediateComponentManager.createImplementationObject(ImmediateComponentManager.java:228)
>>     at
>> org.apache.felix.scr.impl.ImmediateComponentManager.createComponent(ImmediateComponentManager.java:134)
>>     at
>> org.apache.felix.scr.impl.AbstractComponentManager.activateInternal(AbstractComponentManager.java:412)
>>     at
>> org.apache.felix.scr.impl.AbstractComponentManager.access$100(AbstractComponentManager.java:45)
>>     at
>> org.apache.felix.scr.impl.AbstractComponentManager$2.run(AbstractComponentManager.java:121)
>>     at
>> org.apache.felix.scr.impl.ComponentActorThread.run(ComponentActorThread.java:85)
>>
>>
>> This exception probably leads to the problem that the script can not be
>> compiled as indicated by the next exception that occured when I try to
>> access the page at
>> http://localhost:8080/sample/home/moreinfojsp/content.html:
>>
>>
>> 02.01.2008 12:41:16 *WARN * System Bundle: *** Class
>> 'org.apache.jsp.apps.org.apache.sling.sample.html_jsp' was not found.
>> Bundle 28 does not import package
>> 'org.apache.jsp.apps.org.apache.sling.sample', nor is the package
>> exported by any other bundle or available from the system class loader.
>> *** (java.lang.ClassNotFoundException: *** Class
>> 'org.apache.jsp.apps.org.apache.sling.sample.html_jsp' was not found.
>> Bundle 28 does not import package
>> 'org.apache.jsp.apps.org.apache.sling.sample', nor is the package
>> exported by any other bundle or available from the system class loader. ***)
>> java.lang.ClassNotFoundException: *** Class
>> 'org.apache.jsp.apps.org.apache.sling.sample.html_jsp' was not found.
>> Bundle 28 does not import package
>> 'org.apache.jsp.apps.org.apache.sling.sample', nor is the package
>> exported by any other bundle or available from the system class loader. ***
>>     at
>> org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findClass(R4SearchPolicyCore.java:194)
>>     at
>> org.apache.felix.framework.searchpolicy.R4SearchPolicy.findClass(R4SearchPolicy.java:45)
>>     at
>> org.apache.felix.moduleloader.ModuleImpl.getClass(ModuleImpl.java:152)
>>     at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1454)
>>     at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:341)
>>     at
>> org.apache.sling.jcr.classloader.internal.BundleProxyClassLoader.findClass(BundleProxyClassLoader.java:61)
>>     at
>> org.apache.sling.jcr.classloader.internal.BundleProxyClassLoader.loadClass(BundleProxyClassLoader.java:69)
>>     at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
>>     at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>>     at
>> org.apache.sling.jcr.classloader.internal.RepositoryClassLoaderFacade.loadClass(RepositoryClassLoaderFacade.java:105)
>>     at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>>     at
>> org.apache.sling.scripting.jsp.jasper.JspCompilationContext.load(JspCompilationContext.java:644)
>>     at
>> org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:144)
>>     at
>> org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.getDependants(JspServletWrapper.java:263)
>>     at
>> org.apache.sling.scripting.jsp.jasper.compiler.Compiler.isOutDated(Compiler.java:417)
>>     at
>> org.apache.sling.scripting.jsp.jasper.compiler.Compiler.isOutDated(Compiler.java:343)
>>     at
>> org.apache.sling.scripting.jsp.jasper.JspCompilationContext.compile(JspCompilationContext.java:608)
>>     at
>> org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
>>     at
>> org.apache.sling.scripting.jsp.JspServletWrapperAdapter.service(JspServletWrapperAdapter.java:49)
>>     at
>> org.apache.sling.scripting.jsp.JspScriptEngineFactory.callJsp(JspScriptEngineFactory.java:126)
>>     at
>> org.apache.sling.scripting.jsp.JspScriptEngineFactory.access$000(JspScriptEngineFactory.java:71)
>>     at
>> org.apache.sling.scripting.jsp.JspScriptEngineFactory$JspScriptEngine.eval(JspScriptEngineFactory.java:268)
>>     at
>> org.apache.sling.scripting.resolver.impl.DefaultSlingScript.eval(DefaultSlingScript.java:85)
>>     at
>> org.apache.sling.servlet.resolver.helper.SlingScriptServlet.service(SlingScriptServlet.java:72)
>>     at
>> org.apache.sling.core.impl.request.RequestData.service(RequestData.java:417)
>>     at
>> org.apache.sling.core.impl.SlingMainServlet.processRequest(SlingMainServlet.java:286)
>>     at
>> org.apache.sling.core.impl.filter.RequestSlingFilterChain.render(RequestSlingFilterChain.java:48)
>>     at
>> org.apache.sling.core.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:54)
>>     at
>> org.apache.sling.core.impl.filter.ThemeResolverFilter.doFilter(ThemeResolverFilter.java:76)
>>     at
>> org.apache.sling.core.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:52)
>>     at
>> org.apache.sling.core.impl.filter.LocaleResolverFilter.doFilter(LocaleResolverFilter.java:85)
>>     at
>> org.apache.sling.core.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:52)
>>     at
>> org.apache.sling.core.impl.log.RequestLoggerFilter.doFilter(RequestLoggerFilter.java:206)
>>     at
>> org.apache.sling.core.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:52)
>>     at
>> org.apache.sling.core.impl.SlingMainServlet.service(SlingMainServlet.java:186)
>>     at
>> org.apache.sling.core.impl.SlingMainServlet.service(SlingMainServlet.java:158)
>>     at
>> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:358)
>>     at
>> org.mortbay.jetty.servlet.OsgiServletHolder.handle(OsgiServletHolder.java:93)
>>     at
>> org.mortbay.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:657)
>>     at
>> org.mortbay.jetty.servlet.OsgiServletHandler.dispatch(OsgiServletHandler.java:69)
>>     at
>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567)
>>     at org.mortbay.http.HttpContext.handle(HttpContext.java:1807)
>>     at org.mortbay.http.HttpContext.handle(HttpContext.java:1757)
>>     at org.mortbay.http.HttpServer.service(HttpServer.java:879)
>>     at org.mortbay.http.HttpConnection.service(HttpConnection.java:789)
>>     at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:960)
>>     at org.mortbay.http.HttpConnection.handle(HttpConnection.java:806)
>>     at
>> org.mortbay.http.SocketListener.handleConnection(SocketListener.java:218)
>>     at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:331)
>>     at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:520)
>> Caused by: java.lang.ClassNotFoundException:
>> org.apache.jsp.apps.org.apache.sling.sample.html_jsp
>>     at
>> org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findClassOrResource(R4SearchPolicyCore.java:422)
>>     at
>> org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findClass(R4SearchPolicyCore.java:185)
>>     ... 49 common frames omitted
>>
>> Regards,
>> Alex
>>
>>
>>     
>
>
>   


Re: Problems with sample app

Posted by Carsten Ziegeler <cz...@apache.org>.
Hi,

I fixed some problems with the location of the scripts and a bug in the
servlet resolver. Some of the samples are now working for me.

Can you please recheck and report what is not working for you (if any)?

Thanks
Carsten

Alexander Saar wrote:
> Hello Sling team,
> last days I started playing around with the latest Sling trunk. I
> noticed that after the big changes that happened in the last weeks, the
> sample application does not work anymore.
> 
> After some debugging I noticed, that the script resolving looks under
> different paths than the current sample app stores its scripts. So I
> corrected the paths according to the locations the script resolver is
> using. In my instance the scripts are now available at
> /apps/sling/SampleContent, /apps/sling/SamplePage and
> /apps/org/apache/sling/sample.
> 
> Now the script resolver is able to find the right script, but there is
> still no output returned for my request. The problem is probably that
> during installation of the sample app the OCM mapping is not able to
> find the SamplePage and SampleContent classes in the bundle, as
> indicated by the exceptions I found in the error log (see stack trace
> below).
> 
> 
> 02.01.2008 12:44:54 *WARN * System Bundle:
> org/apache/sling/sample/SamplePage.class
> (org.apache.felix.moduleloader.ResourceNotFoundException:
> org/apache/sling/sample/SamplePage.class)
> org.apache.felix.moduleloader.ResourceNotFoundException:
> org/apache/sling/sample/SamplePage.class
>     at
> org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findClassOrResource(R4SearchPolicyCore.java:426)
>     at
> org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findResource(R4SearchPolicyCore.java:206)
>     at
> org.apache.felix.framework.searchpolicy.R4SearchPolicy.findResource(R4SearchPolicy.java:51)
>     at
> org.apache.felix.moduleloader.ModuleImpl.getResource(ModuleImpl.java:168)
>     at org.apache.felix.framework.Felix.getBundleResource(Felix.java:1334)
>     at
> org.apache.felix.framework.BundleImpl.getResource(BundleImpl.java:170)
>     at
> org.apache.sling.jcr.resource.internal.mapping.classloader.BundleLoader.loadClass(BundleLoader.java:43)
>     at
> org.apache.sling.jcr.resource.internal.mapping.classloader.MapperClassLoader.loadClass(MapperClassLoader.java:121)
>     at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>     at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
>     at java.lang.Class.forName0(Native Method)
>     at java.lang.Class.forName(Class.java:247)
>     at
> org.apache.jackrabbit.ocm.reflection.ReflectionUtils.forName(ReflectionUtils.java:162)
>     at
> org.apache.jackrabbit.ocm.mapper.model.ClassDescriptor.validateClassName(ClassDescriptor.java:395)
>     at
> org.apache.jackrabbit.ocm.mapper.model.ClassDescriptor.afterPropertiesSet(ClassDescriptor.java:387)
>     at
> org.apache.sling.jcr.resource.internal.mapping.ClassDescriptorReader.validateDescriptors(ClassDescriptorReader.java:515)
>     at
> org.apache.sling.jcr.resource.internal.mapping.ClassDescriptorReader.validateDescriptors(ClassDescriptorReader.java:517)
>     at
> org.apache.sling.jcr.resource.internal.mapping.ClassDescriptorReader.verify(ClassDescriptorReader.java:430)
>     at
> org.apache.sling.jcr.resource.internal.mapping.ClassDescriptorReader.getMappingDescriptor(ClassDescriptorReader.java:87)
>     at
> org.apache.sling.jcr.resource.internal.mapping.ObjectContentManagerFactory.loadMappings(ObjectContentManagerFactory.java:230)
>     at
> org.apache.sling.jcr.resource.internal.mapping.ObjectContentManagerFactory.addBundle(ObjectContentManagerFactory.java:171)
>     at
> org.apache.sling.jcr.resource.internal.mapping.ObjectContentManagerFactory.registerMapperClient(ObjectContentManagerFactory.java:147)
>     at
> org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl.activate(JcrResourceResolverFactoryImpl.java:396)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:597)
>     at
> org.apache.felix.scr.impl.ImmediateComponentManager.createImplementationObject(ImmediateComponentManager.java:228)
>     at
> org.apache.felix.scr.impl.ImmediateComponentManager.createComponent(ImmediateComponentManager.java:134)
>     at
> org.apache.felix.scr.impl.AbstractComponentManager.activateInternal(AbstractComponentManager.java:412)
>     at
> org.apache.felix.scr.impl.AbstractComponentManager.access$100(AbstractComponentManager.java:45)
>     at
> org.apache.felix.scr.impl.AbstractComponentManager$2.run(AbstractComponentManager.java:121)
>     at
> org.apache.felix.scr.impl.ComponentActorThread.run(ComponentActorThread.java:85)
> 02.01.2008 12:44:54 *WARN * System Bundle:
> org/apache/sling/sample/SamplePage.class
> (org.apache.felix.moduleloader.ResourceNotFoundException:
> org/apache/sling/sample/SamplePage.class)
> org.apache.felix.moduleloader.ResourceNotFoundException:
> org/apache/sling/sample/SamplePage.class
>     at
> org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findClassOrResource(R4SearchPolicyCore.java:426)
>     at
> org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findResource(R4SearchPolicyCore.java:206)
>     at
> org.apache.felix.framework.searchpolicy.R4SearchPolicy.findResource(R4SearchPolicy.java:51)
>     at
> org.apache.felix.moduleloader.ModuleImpl.getResource(ModuleImpl.java:168)
>     at org.apache.felix.framework.Felix.getBundleResource(Felix.java:1334)
>     at
> org.apache.felix.framework.BundleImpl.getResource(BundleImpl.java:170)
>     at
> org.apache.sling.jcr.resource.internal.mapping.classloader.BundleLoader.loadClass(BundleLoader.java:43)
>     at
> org.apache.sling.jcr.resource.internal.mapping.classloader.MapperClassLoader.loadClass(MapperClassLoader.java:121)
>     at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>     at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
>     at java.lang.Class.forName0(Native Method)
>     at java.lang.Class.forName(Class.java:247)
>     at
> org.apache.jackrabbit.ocm.reflection.ReflectionUtils.forName(ReflectionUtils.java:162)
>     at
> org.apache.jackrabbit.ocm.mapper.model.ClassDescriptor.validateClassName(ClassDescriptor.java:395)
>     at
> org.apache.jackrabbit.ocm.mapper.model.ClassDescriptor.afterPropertiesSet(ClassDescriptor.java:387)
>     at
> org.apache.sling.jcr.resource.internal.mapping.ClassDescriptorReader.validateDescriptors(ClassDescriptorReader.java:515)
>     at
> org.apache.sling.jcr.resource.internal.mapping.ClassDescriptorReader.validateDescriptors(ClassDescriptorReader.java:517)
>     at
> org.apache.sling.jcr.resource.internal.mapping.ClassDescriptorReader.verify(ClassDescriptorReader.java:430)
>     at
> org.apache.sling.jcr.resource.internal.mapping.ClassDescriptorReader.getMappingDescriptor(ClassDescriptorReader.java:87)
>     at
> org.apache.sling.jcr.resource.internal.mapping.ObjectContentManagerFactory.loadMappings(ObjectContentManagerFactory.java:230)
>     at
> org.apache.sling.jcr.resource.internal.mapping.ObjectContentManagerFactory.addBundle(ObjectContentManagerFactory.java:171)
>     at
> org.apache.sling.jcr.resource.internal.mapping.ObjectContentManagerFactory.registerMapperClient(ObjectContentManagerFactory.java:147)
>     at
> org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl.activate(JcrResourceResolverFactoryImpl.java:396)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:597)
>     at
> org.apache.felix.scr.impl.ImmediateComponentManager.createImplementationObject(ImmediateComponentManager.java:228)
>     at
> org.apache.felix.scr.impl.ImmediateComponentManager.createComponent(ImmediateComponentManager.java:134)
>     at
> org.apache.felix.scr.impl.AbstractComponentManager.activateInternal(AbstractComponentManager.java:412)
>     at
> org.apache.felix.scr.impl.AbstractComponentManager.access$100(AbstractComponentManager.java:45)
>     at
> org.apache.felix.scr.impl.AbstractComponentManager$2.run(AbstractComponentManager.java:121)
>     at
> org.apache.felix.scr.impl.ComponentActorThread.run(ComponentActorThread.java:85)
> 
> 
> This exception probably leads to the problem that the script can not be
> compiled as indicated by the next exception that occured when I try to
> access the page at
> http://localhost:8080/sample/home/moreinfojsp/content.html:
> 
> 
> 02.01.2008 12:41:16 *WARN * System Bundle: *** Class
> 'org.apache.jsp.apps.org.apache.sling.sample.html_jsp' was not found.
> Bundle 28 does not import package
> 'org.apache.jsp.apps.org.apache.sling.sample', nor is the package
> exported by any other bundle or available from the system class loader.
> *** (java.lang.ClassNotFoundException: *** Class
> 'org.apache.jsp.apps.org.apache.sling.sample.html_jsp' was not found.
> Bundle 28 does not import package
> 'org.apache.jsp.apps.org.apache.sling.sample', nor is the package
> exported by any other bundle or available from the system class loader. ***)
> java.lang.ClassNotFoundException: *** Class
> 'org.apache.jsp.apps.org.apache.sling.sample.html_jsp' was not found.
> Bundle 28 does not import package
> 'org.apache.jsp.apps.org.apache.sling.sample', nor is the package
> exported by any other bundle or available from the system class loader. ***
>     at
> org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findClass(R4SearchPolicyCore.java:194)
>     at
> org.apache.felix.framework.searchpolicy.R4SearchPolicy.findClass(R4SearchPolicy.java:45)
>     at
> org.apache.felix.moduleloader.ModuleImpl.getClass(ModuleImpl.java:152)
>     at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1454)
>     at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:341)
>     at
> org.apache.sling.jcr.classloader.internal.BundleProxyClassLoader.findClass(BundleProxyClassLoader.java:61)
>     at
> org.apache.sling.jcr.classloader.internal.BundleProxyClassLoader.loadClass(BundleProxyClassLoader.java:69)
>     at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
>     at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>     at
> org.apache.sling.jcr.classloader.internal.RepositoryClassLoaderFacade.loadClass(RepositoryClassLoaderFacade.java:105)
>     at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>     at
> org.apache.sling.scripting.jsp.jasper.JspCompilationContext.load(JspCompilationContext.java:644)
>     at
> org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:144)
>     at
> org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.getDependants(JspServletWrapper.java:263)
>     at
> org.apache.sling.scripting.jsp.jasper.compiler.Compiler.isOutDated(Compiler.java:417)
>     at
> org.apache.sling.scripting.jsp.jasper.compiler.Compiler.isOutDated(Compiler.java:343)
>     at
> org.apache.sling.scripting.jsp.jasper.JspCompilationContext.compile(JspCompilationContext.java:608)
>     at
> org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
>     at
> org.apache.sling.scripting.jsp.JspServletWrapperAdapter.service(JspServletWrapperAdapter.java:49)
>     at
> org.apache.sling.scripting.jsp.JspScriptEngineFactory.callJsp(JspScriptEngineFactory.java:126)
>     at
> org.apache.sling.scripting.jsp.JspScriptEngineFactory.access$000(JspScriptEngineFactory.java:71)
>     at
> org.apache.sling.scripting.jsp.JspScriptEngineFactory$JspScriptEngine.eval(JspScriptEngineFactory.java:268)
>     at
> org.apache.sling.scripting.resolver.impl.DefaultSlingScript.eval(DefaultSlingScript.java:85)
>     at
> org.apache.sling.servlet.resolver.helper.SlingScriptServlet.service(SlingScriptServlet.java:72)
>     at
> org.apache.sling.core.impl.request.RequestData.service(RequestData.java:417)
>     at
> org.apache.sling.core.impl.SlingMainServlet.processRequest(SlingMainServlet.java:286)
>     at
> org.apache.sling.core.impl.filter.RequestSlingFilterChain.render(RequestSlingFilterChain.java:48)
>     at
> org.apache.sling.core.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:54)
>     at
> org.apache.sling.core.impl.filter.ThemeResolverFilter.doFilter(ThemeResolverFilter.java:76)
>     at
> org.apache.sling.core.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:52)
>     at
> org.apache.sling.core.impl.filter.LocaleResolverFilter.doFilter(LocaleResolverFilter.java:85)
>     at
> org.apache.sling.core.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:52)
>     at
> org.apache.sling.core.impl.log.RequestLoggerFilter.doFilter(RequestLoggerFilter.java:206)
>     at
> org.apache.sling.core.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:52)
>     at
> org.apache.sling.core.impl.SlingMainServlet.service(SlingMainServlet.java:186)
>     at
> org.apache.sling.core.impl.SlingMainServlet.service(SlingMainServlet.java:158)
>     at
> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:358)
>     at
> org.mortbay.jetty.servlet.OsgiServletHolder.handle(OsgiServletHolder.java:93)
>     at
> org.mortbay.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:657)
>     at
> org.mortbay.jetty.servlet.OsgiServletHandler.dispatch(OsgiServletHandler.java:69)
>     at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567)
>     at org.mortbay.http.HttpContext.handle(HttpContext.java:1807)
>     at org.mortbay.http.HttpContext.handle(HttpContext.java:1757)
>     at org.mortbay.http.HttpServer.service(HttpServer.java:879)
>     at org.mortbay.http.HttpConnection.service(HttpConnection.java:789)
>     at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:960)
>     at org.mortbay.http.HttpConnection.handle(HttpConnection.java:806)
>     at
> org.mortbay.http.SocketListener.handleConnection(SocketListener.java:218)
>     at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:331)
>     at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:520)
> Caused by: java.lang.ClassNotFoundException:
> org.apache.jsp.apps.org.apache.sling.sample.html_jsp
>     at
> org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findClassOrResource(R4SearchPolicyCore.java:422)
>     at
> org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findClass(R4SearchPolicyCore.java:185)
>     ... 49 common frames omitted
> 
> Regards,
> Alex
> 
> 


-- 
Carsten Ziegeler
cziegeler@apache.org