Tapestry and Resin 3 on Windows (and a tentative patch)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Tapestry and Resin 3 on Windows (and a tentative patch)

Pete Bevin
Hi,

I have been trying to get the hangman1 example from Tapestry In Action
to run under Resin 3.0.13.  It works fine on Linux, but on Windows I
get the following exception:

---------------------------------------------
500 Servlet Exception
javassist.NotFoundException: java.lang.Object
        at javassist.ClassPoolTail.openClassfile(ClassPoolTail.java:294)
        at javassist.ClassPoolTail.checkClassName(ClassPoolTail.java:177)
        at javassist.ClassPool.checkClassName(ClassPool.java:679)
        at javassist.ClassPool.get0(ClassPool.java:542)
        at javassist.ClassPool.get(ClassPool.java:531)
        at org.apache.tapestry.enhance.javassist.ClassMapping.loadType(ClassMapping.java:89)
        at org.apache.tapestry.enhance.javassist.ClassMapping.initialize(ClassMapping.java:73)
        at org.apache.tapestry.enhance.javassist.ClassMapping.<init>(ClassMapping.java:48)
        at org.apache.tapestry.enhance.javassist.EnhancedClassFactory.reset(EnhancedClassFactory.java:70)
        at org.apache.tapestry.enhance.javassist.EnhancedClassFactory.<init>(EnhancedClassFactory.java:49)
        at org.apache.tapestry.enhance.DefaultComponentClassEnhancer.createEnhancedClassFactory(DefaultComponentClassEnhancer.java:72)
        at org.apache.tapestry.enhance.DefaultComponentClassEnhancer.<init>(DefaultComponentClassEnhancer.java:66)
        at org.apache.tapestry.engine.AbstractEngine.createComponentClassEnhancer(AbstractEngine.java:2207)
        at org.apache.tapestry.engine.AbstractEngine.setupForRequest(AbstractEngine.java:1262)
        at org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:824)
        at org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:197)
        at org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:158)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:113)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:90)
        at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:99)
        at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:163)
        at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:208)
        at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:259)
        at com.caucho.server.port.TcpConnection.run(TcpConnection.java:341)
        at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:490)
        at com.caucho.util.ThreadPool.run(ThreadPool.java:423)
        at java.lang.Thread.run(Thread.java:595)

Resin-3.0.13 (built Fri, 06 May 2005 10:06:25 PDT)
---------------------------------------------

I'd like to blame Resin, but after a bit of digging, I found a
strangeness in the way Tapestry sets up the class pool for Javassist,
which led to the attached patch.  I don't know whether this is the
Right Thing, but it fixes the problem on Resin/Windows and still works
on Resin/Linux.

Is there a reason why Tapestry doesn't use the default class pool?

Pete.



--- Tapestry-3.0.3/framework/src/org/apache/tapestry/enhance/javassist/EnhancedClassFactory.java
       2005-03-28 21:28:27.000000000 -0500
+++ Tapestry-3.0.3-resin/framework/src/org/apache/tapestry/enhance/javassist/EnhancedClassFactory.java
 2005-05-08 13:30:19.000000000 -0400
@@ -54,7 +54,7 @@
         ClassLoader loader = _resourceResolver.getClassLoader();
         
         // create a new ClassPool and make sure it uses the
application resource resolver
-        ClassPool classPool = new ClassPool(null);
+        ClassPool classPool = ClassPool.getDefault();
         classPool.insertClassPath(new LoaderClassPath(loader));
         
         return classPool;

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Tapestry and Resin 3 on Windows (and a tentative patch)

Howard Lewis Ship
This is a bug in Resin.  Tapestry uses the thread context class
loader, which should be a descendent of the default class loader.
Whenever someone gets really wierd behavior with Tapestry, my first
question is: "Are you using Resin?".

On 5/8/05, Pete Bevin <[hidden email]> wrote:

> Hi,
>
> I have been trying to get the hangman1 example from Tapestry In Action
> to run under Resin 3.0.13.  It works fine on Linux, but on Windows I
> get the following exception:
>
> ---------------------------------------------
> 500 Servlet Exception
> javassist.NotFoundException: java.lang.Object
>         at javassist.ClassPoolTail.openClassfile(ClassPoolTail.java:294)
>         at javassist.ClassPoolTail.checkClassName(ClassPoolTail.java:177)
>         at javassist.ClassPool.checkClassName(ClassPool.java:679)
>         at javassist.ClassPool.get0(ClassPool.java:542)
>         at javassist.ClassPool.get(ClassPool.java:531)
>         at org.apache.tapestry.enhance.javassist.ClassMapping.loadType(ClassMapping.java:89)
>         at org.apache.tapestry.enhance.javassist.ClassMapping.initialize(ClassMapping.java:73)
>         at org.apache.tapestry.enhance.javassist.ClassMapping.<init>(ClassMapping.java:48)
>         at org.apache.tapestry.enhance.javassist.EnhancedClassFactory.reset(EnhancedClassFactory.java:70)
>         at org.apache.tapestry.enhance.javassist.EnhancedClassFactory.<init>(EnhancedClassFactory.java:49)
>         at org.apache.tapestry.enhance.DefaultComponentClassEnhancer.createEnhancedClassFactory(DefaultComponentClassEnhancer.java:72)
>         at org.apache.tapestry.enhance.DefaultComponentClassEnhancer.<init>(DefaultComponentClassEnhancer.java:66)
>         at org.apache.tapestry.engine.AbstractEngine.createComponentClassEnhancer(AbstractEngine.java:2207)
>         at org.apache.tapestry.engine.AbstractEngine.setupForRequest(AbstractEngine.java:1262)
>         at org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:824)
>         at org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:197)
>         at org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:158)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:113)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:90)
>         at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:99)
>         at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:163)
>         at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:208)
>         at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:259)
>         at com.caucho.server.port.TcpConnection.run(TcpConnection.java:341)
>         at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:490)
>         at com.caucho.util.ThreadPool.run(ThreadPool.java:423)
>         at java.lang.Thread.run(Thread.java:595)
>
> Resin-3.0.13 (built Fri, 06 May 2005 10:06:25 PDT)
> ---------------------------------------------
>
> I'd like to blame Resin, but after a bit of digging, I found a
> strangeness in the way Tapestry sets up the class pool for Javassist,
> which led to the attached patch.  I don't know whether this is the
> Right Thing, but it fixes the problem on Resin/Windows and still works
> on Resin/Linux.
>
> Is there a reason why Tapestry doesn't use the default class pool?
>
> Pete.
>
> --- Tapestry-3.0.3/framework/src/org/apache/tapestry/enhance/javassist/EnhancedClassFactory.java
>        2005-03-28 21:28:27.000000000 -0500
> +++ Tapestry-3.0.3-resin/framework/src/org/apache/tapestry/enhance/javassist/EnhancedClassFactory.java
>  2005-05-08 13:30:19.000000000 -0400
> @@ -54,7 +54,7 @@
>          ClassLoader loader = _resourceResolver.getClassLoader();
>
>          // create a new ClassPool and make sure it uses the
> application resource resolver
> -        ClassPool classPool = new ClassPool(null);
> +        ClassPool classPool = ClassPool.getDefault();
>          classPool.insertClassPath(new LoaderClassPath(loader));
>
>          return classPool;
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [SPAM] Re: Tapestry and Resin 3 on Windows (and a tentative patch)

Demboos
Howard Lewis Ship wrote:
> This is a bug in Resin.  Tapestry uses the thread context class
> loader, which should be a descendent of the default class loader.
> Whenever someone gets really wierd behavior with Tapestry, my first
> question is: "Are you using Resin?".
>

Any idea if this bug exists in Sun App Server?

I constantly fail to deploy any tapestry app in SJAS 8, getting the
following message:

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented
it from fulfilling this request.

exception

javax.servlet.ServletException
        org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:300)
        org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)

root cause

java.lang.ExceptionInInitializerError
        org.apache.tapestry.enhance.javassist.EnhancedClassFactory.createClassPool(EnhancedClassFactory.java:57)
        org.apache.tapestry.enhance.javassist.EnhancedClassFactory.reset(EnhancedClassFactory.java:69)
        org.apache.tapestry.enhance.javassist.EnhancedClassFactory.(EnhancedClassFactory.java:49)
        org.apache.tapestry.enhance.DefaultComponentClassEnhancer.createEnhancedClassFactory(DefaultComponentClassEnhancer.java:72)
        org.apache.tapestry.enhance.DefaultComponentClassEnhancer.(DefaultComponentClassEnhancer.java:66)
        org.apache.tapestry.engine.AbstractEngine.createComponentClassEnhancer(AbstractEngine.java:2261)
        org.apache.tapestry.engine.AbstractEngine.setupForRequest(AbstractEngine.java:1282)
        org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:841)
        org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:198)
        org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:159)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:747)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
        sun.reflect.GeneratedMethodAccessor63.invoke(Unknown Source)
        sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        java.lang.reflect.Method.invoke(Method.java:324)
        org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
        java.security.AccessController.doPrivileged(Native Method)
        javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
        org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
        org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)

--
Szymon


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]