Class loading problem when embering DWR

View: New views
3 Messages — Rating Filter:   Alert me  

Class loading problem when embering DWR

by Han Liu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi all,

I create a module to add DWR to my framework Yilan

(yilan.googlecode.com )

Yilan is something like this

Yilan Kernel classLoader

   --- > Module DWR
   --- > Module XFire
   --- > Module Jetty
   --- > Module Tomcat

So DWR must have a dependecy on Jetty
Each module has it's  local ClassLoader and is dynamically loaded during runtime

When add DwrServlet to the mapping of Jetty and jetty call
DwrServlet.initialize(),

error accurs when finding the system classes in

 Class impl = LocalUtil.classForName((String) value);

The thread context classloader is not equal to Dwr lib's classloader

So I change  the following  in LocalUtil

public static Class classForName(String className) throws ClassNotFoundException
{
  return Thread.currentThread().getContextClassLoader().loadClass(className);
}

to

public static Class classForName(String className) throws ClassNotFoundException
{
  try {
  return Thread.currentThread().getContextClassLoader().loadClass(className);
  } catch (ClassNotFoundException e) {
        return LocalUtil.class.getClassLoader().loadClass(className);
  }
}

and it works fine.   But is it enough?


Thanks for your help

Best Regards

Han Liu

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: Class loading problem when embering DWR

by ddelrivero :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi there,

I need to use DWR to marshall/demarshall complex data objects sent from
javascript, in order to pass them as parameters to a servlet that outputs a
rendered image generated upon those parameters. I know you can't modify the
response headers, so, can you come up with an idea to acomplish this?

I have setup a pojo to get those parameters and call the RequestDispatcher
in order to call the servlet I want, but this servlet writes on the response
and modifies the header response type.

I think I have to write an extension for DWR to handle this.. any idea?

Thank you.
Damian del Rivero

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


DWR-Servlets integration

by ddelrivero :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi there,

I need to use DWR to marshall/demarshall complex data objects sent from
javascript, in order to pass them as parameters to a servlet that outputs a
rendered image generated upon those parameters. I know you can't modify the
response headers, so, can you come up with an idea to acomplish this?

I have setup a pojo to get those parameters and call the RequestDispatcher
in order to call the servlet I want, but this servlet writes on the response
and modifies the header response type.

I think I have to write an extension for DWR to handle this.. any idea?

Thank you.
Damian del Rivero

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...