You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Baldur Norddahl <bb...@clansoft.dk> on 2004/11/12 20:36:57 UTC

classloader issue

I have a number of Tapestry web applications that I want to deploy with 
the Orion application server. The first web application works fine, but 
the next always gives me this error:

java.lang.ClassCastException: org.apache.tapestry.engine.BaseEngine
at 
org.apache.tapestry.ApplicationServlet.createEngine(ApplicationServlet.java:666) 


So I checked the Tapestry source code, and here is what goes around line 
666:

Class engineClass = getResourceResolver().findClass(className);
IEngine result = (IEngine) engineClass.newInstance();

The cast to IEngine is what fails. Since BaseEngine does implement 
IEngine, I am guessing it somehow ends up with a BaseEngine from the 
wrong application or classloader.

How can I get around this?

Thanks,

Baldur

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: is there a TD component ?

Posted by Luc Peerdeman <lj...@xs4all.nl>.
Hi Sarah,

sarah.simbad@women-at-work.org wrote:
> How can I set the background colour of a TD element 
> with tapestry ?

I would recommend against using bgcolor, instead use a CSS class so you 
can have all style related things for a type of td (or all td's within a 
certain type of table) specified in one place (this could include 
images). At work I have an example of how to do this, I will try to post 
the example in a followup.

Cheers, Luc.


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: is there a TD component ?

Posted by Jonathan Millett <jo...@millett.net>.
Try the Any component:

<td jwcid="@Any" bgcolor="ognl:bgCol">


>How can I set the background colour of a TD element 
>with tapestry ?
>
>The following is NOT working:
>
>    <td bgcolor="<jwcid="@Insert" value="ognl:bgCol">">
>
>Is there a TD component ?`
>
>Thanks!
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


is there a TD component ?

Posted by sa...@women-at-work.org.
How can I set the background colour of a TD element 
with tapestry ?

The following is NOT working:

    <td bgcolor="<jwcid="@Insert" value="ognl:bgCol">">

Is there a TD component ?`

Thanks!

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: classloader issue

Posted by "David H. DeWolf" <dd...@apache.org>.
> Can someone explain what the difference is between what I am doing, and 
> the default Thread.currentThread().getContextClassLoader() instead of 
> getClass().getClassLoader() ?
> 

Thread.currentThread().getContextClassLoader() uses the class loader 
currently associated with the executing thread (set through 
Thread.setContextClassLoader(ClassLoader) - typically by the application 
server).

getClass().getClassLoader() uses the ClassLoader that was used to load 
the specified class.


> Thanks,
> 
> Baldur
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: classloader issue

Posted by Baldur Norddahl <bb...@clansoft.dk>.
Baldur Norddahl wrote:

> I have a number of Tapestry web applications that I want to deploy 
> with the Orion application server. The first web application works 
> fine, but the next always gives me this error:
>
> java.lang.ClassCastException: org.apache.tapestry.engine.BaseEngine
> at 
> org.apache.tapestry.ApplicationServlet.createEngine(ApplicationServlet.java:666) 
>
>
> So I checked the Tapestry source code, and here is what goes around 
> line 666:
>
> Class engineClass = getResourceResolver().findClass(className);
> IEngine result = (IEngine) engineClass.newInstance();
>
> The cast to IEngine is what fails. Since BaseEngine does implement 
> IEngine, I am guessing it somehow ends up with a BaseEngine from the 
> wrong application or classloader.
>

I managed to find a fix for this by overriding the 
ApplicationServlet.createResourceResolver:

public class Servlet extends org.apache.tapestry.ApplicationServlet
{
  protected org.apache.tapestry.IResourceResolver 
createResourceResolver() throws javax.servlet.ServletException
  {
    return new 
org.apache.tapestry.util.DefaultResourceResolver(getClass().getClassLoader());
  }
}

With this simple class used as application servlet, everything works.

Can someone explain what the difference is between what I am doing, and 
the default Thread.currentThread().getContextClassLoader() instead of 
getClass().getClassLoader() ?

Thanks,

Baldur



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org