Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
5.0
-
None
-
None
Description
Currently Tapestry throws confusing error message (stacktrace with java.lang.NoClassDefFoundError) when putting non component classes to the Tapestry components/pages package and these classes do not follow the same restrictions as component classes.
For example if there is a value holder class defined within page package or a sub package inside page package with protected/public variables then NoClassDefFoundError is thrown. If they are changed to private (like component classes should) then the error goes away and class is again found
Tapestry application path is org.example.myapp and there is a simple value object class Test defined (and used inside page Start).
------------------->>-------------------<code>
package org.example.myapp.pages.test;
public class Test {
protected String test = "blaah";
public String getTest()
{ return test; }}
-----
package org.example.myapp.pages;
import org.example.myapp.pages.test.Test;
/**
* Start page of application myapp.
*/
public class Start
{
private Test test = new Test();
public Test getTest() { return test; }
}
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<head>
<title>myapp Start Page</title>
</head>
<body>
<h1>myapp Start Page</h1>
<p> ${test.test}. </p>
</body>
</html>
</code>------------------->>-------------------
Then the following stacktrace is generated:
- java.lang.NoClassDefFoundError
org/example/myapp/pages/test/Test
Stack trace
- org.example.myapp.pages.Start.initializer(Start.java:27)
- org.example.myapp.pages.Start.<init>(Start.java)
- sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
- sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
- sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
- java.lang.reflect.Constructor.newInstance(Unknown Source)
- org.apache.tapestry.internal.services.ReflectiveInstantiator.newInstance(ReflectiveInstantiator.java:79)
- org.apache.tapestry.internal.structure.InternalComponentResourcesImpl.<init>(InternalComponentResourcesImpl.java:70)
- org.apache.tapestry.internal.structure.ComponentPageElementImpl.<init>(ComponentPageElementImpl.java:528)
- org.apache.tapestry.internal.structure.ComponentPageElementImpl.<init>(ComponentPageElementImpl.java:572)
- org.apache.tapestry.internal.services.PageElementFactoryImpl.newRootComponentElement(PageElementFactoryImpl.java:311)
- org.apache.tapestry.internal.services.PageLoaderProcessor.loadRootComponent(PageLoaderProcessor.java:354)
- org.apache.tapestry.internal.services.PageLoaderProcessor.loadPage(PageLoaderProcessor.java:339)
- org.apache.tapestry.internal.services.PageLoaderImpl.loadPage(PageLoaderImpl.java:60)
- org.apache.tapestry.internal.services.PagePoolImpl.checkout(PagePoolImpl.java:69)
- org.apache.tapestry.internal.services.RequestPageCacheImpl.get(RequestPageCacheImpl.java:43)
- org.apache.tapestry.internal.services.PageRenderRequestHandlerImpl.handle(PageRenderRequestHandlerImpl.java:55)
- org.apache.tapestry.internal.services.RootPathDispatcher.dispatch(RootPathDispatcher.java:52)
- org.apache.tapestry.services.TapestryModule$12.service(TapestryModule.java:905)
- org.example.myapp.services.AppModule$1.service(AppModule.java:92)
- org.apache.tapestry.internal.services.LocalizationFilter.service(LocalizationFilter.java:43)
- org.apache.tapestry.services.TapestryModule$2.service(TapestryModule.java:487)
- org.apache.tapestry.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:79)
- org.apache.tapestry.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:94)
- org.apache.tapestry.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:85)
- org.apache.tapestry.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:77)
- org.apache.tapestry.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:107)
- org.apache.tapestry.services.TapestryModule$11.service(TapestryModule.java:888)
- org.apache.tapestry.TapestryFilter.doFilter(TapestryFilter.java:164)
- org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:821)
- org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:471)
- org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
- org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
- org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:633)
- org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
- org.mortbay.http.HttpServer.service(HttpServer.java:909)
- org.mortbay.http.HttpConnection.service(HttpConnection.java:820)
- org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:986)
- org.mortbay.http.HttpConnection.handle(HttpConnection.java:837)
- org.mortbay.http.SocketListener.handleConnection(SocketListener.java:245)
- org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
- org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)