Ah, you're using OSGi. I've had a few difficult to track down problems
too. I use something like the following:

A class which adapts RemoteLoggerServiceImpl:

public class OsgiGwtRemoteLoggerServiceImpl extends RemoteLoggerServiceImpl {

        private static final long serialVersionUID = 1564407422308394496L;

        /**
         * @see 
com.google.gwt.user.server.rpc.RemoteServiceServlet#RemoteServiceServlet()
         */
        public OsgiGwtRemoteLoggerServiceImpl() {
                Thread.currentThread().setContextClassLoader(
                                SomeMainClass.class.getClassLoader());
        }
}

and a class which adapts RemoteServiceServlet:

/**
 * Adapts RemoteServerServlet to the OSGi runtime environment.
 * @see com.google.gwt.user.server.rpc.RemoteServiceServlet
 */
public class OsgiGwtRemoteServiceServlet extends RemoteServiceServlet {

        private static final long serialVersionUID = -3633146059793473086L;

        private ClassLoader classloader;

        public OsgiGwtRemoteServiceServlet() {
        }

        /**
         * @param classloader
         *            of implementing module. CAVE: Implementing module has to
         *            import 
com.google.gwt.user.client.rpc.core.java.lang/sql/util
         *            for correct deserialization.
         */
        public OsgiGwtRemoteServiceServlet(ClassLoader classloader) {
                this.classloader = classloader;
        }

        @Override
        public void service(ServletRequest req, ServletResponse res)
                        throws ServletException, java.io.IOException {
                if (null != classloader) {
                        
Thread.currentThread().setContextClassLoader(classloader);
                } else {

                        Thread.currentThread().setContextClassLoader(
                                        SomeMainClass.class.getClassLoader());
                }
                super.service(req, res);
        }
}

That works well for me. I use the
OsgiGwtRemoteServiceServlet(ClassLoader classloader) constructor only
when not being in the bundle with the class I've called SomeMainClass.
Hope this helps.

Arthur

On Mon, Mar 16, 2009 at 4:13 PM, RobW <[email protected]> wrote:
>
> And finally - here may be the solution:
>
> http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/3185cecb772f0f61/8be4bf5333017f3f?lnk=gst&q=gwt+osgi+List#8be4bf5333017f3f
>
> Crossing fingers!
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to