Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » [Solved] Problem Integrating RAP/Spring DM(ClassLoader issues)
[Solved] Problem Integrating RAP/Spring DM [message #835663] Tue, 03 April 2012 14:15 Go to next message
Thorsten Schlathölter is currently offline Thorsten SchlathölterFriend
Messages: 312
Registered: February 2012
Location: Düsseldorf
Senior Member
Hi everybody,
I have a Client-Server Application that uses RCP as client technology and a servlet based server which is connected using web services. I am currently trying to port the client to RAP. In that course I would also like to move the server to an OSGI environment. Since I am using Spring on the server side I have downloaded Spring DM.

I am using Eclipse 3.7 and Spring OSGI 1.2.1.

Now I have a classloading problem and I wonder if somebody has a solution for this:

In order to export a service I have registered the DispatcherServlet

  <extension
         point="org.eclipse.equinox.http.registry.servlets">
      <servlet
            alias="/dispatcher"
            class="org.springframework.web.servlet.DispatcherServlet"
            load-on-startup="true">
         <init-param
               name="contextConfigLocation"
               value="/WEB-INF/springapp-servlet.xml">
         </init-param>
      </servlet>
   </extension>


The Spring OSGI manual tells me to use the following contextClass:

<init-param
name="contextClass"
               value="org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext">
         </init-param>



If I add this parameter to the servlet configuration I get the following error, indicating that I am having a classloader problem:

2012-04-03 16:17:03,764 ERROR org.springframework.web.servlet.DispatcherServlet ()- Failed to set bean properties on servlet 'org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper'
org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessException details (1) are:
PropertyAccessException 1:
org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [java.lang.Class] for property 'contextClass'; nested exception is java.lang.IllegalArgumentException: Cannot find class [org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext]


The OsgiBundleXmlWebApplicationContext is definetely in the bundle classpath. I worked around this problem by specifying MyOwnDispatcherServlet that inherits from DispatcherServlet and sets MyOsgiBundleXmlWebApplicationContext which inherits from OsgiBundleXmlWebApplicationContext. Doing this I am able to get things running. Without using my sublcasses I end up with a class not found exception.
Unfortunately the classloading problem persists when I go ahead. For example I have another CommonPlugin that defines the service interface. This plugin is references from my ClientPlugin and also from my ServerPlugin. But the following bean spec in the ServerPlugin again gives an error because it cannot resolve the class ICsarServerService comming from the CommonPlugin

     <bean id="csarServerServiceExporter" class=
		"org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter"
		p:service-ref="csarServerService"
		p:serviceInterface="testrap3.service.ICsarServerService" />


This is the exception I get:

2012-04-03 16:26:55,971 DEBUG testrap3.context.MyOsgiBundleContext ()- Refresh error
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'csarServerServiceExporter' defined in URL [bundleentry://113.fwk31556811/WEB-INF/springapp-servlet.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [java.lang.Class] for property 'serviceInterface'; nested exception is java.lang.IllegalArgumentException: Cannot find class [testrap3.service.ICsarServerService]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)


So it seems to me that the spring context is read with a different classloader.
Am I doing something wrong?

Any help would be appreciated
Regards
Thorsten

[Updated on: Wed, 04 April 2012 09:55]

Report message to a moderator

Re: Problem Integrating RAP/Spring DM [message #836273 is a reply to message #835663] Wed, 04 April 2012 09:54 Go to previous message
Thorsten Schlathölter is currently offline Thorsten SchlathölterFriend
Messages: 312
Registered: February 2012
Location: Düsseldorf
Senior Member
Digging through BundleLoaders and all other kind of classes I found out that I simply had an error in the classpath of the interface.
Previous Topic:Session timeout using setMaxInactiveInterval
Next Topic:RAP and CSS resource
Goto Forum:
  


Current Time: Fri Apr 26 11:03:58 GMT 2024

Powered by FUDForum. Page generated in 0.03254 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top