Home » Eclipse Projects » Remote Application Platform (RAP) » Servlet can not be registered(Servlet can not be registered duu to java.lang.LinkageError: loader constraint violation.)
Servlet can not be registered [message #899728] |
Thu, 02 August 2012 02:46  |
Eclipse User |
|
|
|
I use a common implemetation for registering servlets, i.e.:
- Activator Class with start/ stop methods and with HttpServiceTracker
- HttpServiceTracker Class with addingService/ removedService methods
- Servlet Class
- Manifest (Import-Package: javax.servlet, javax.servlet.http)
After I have switch the Rap Target Platform from 1.5 RC1 to newer one (RC2, RC3, R) maven can not build my war product anymore, because of:
Missing Constraint: Import-Package: javax.servlet; version="0.0.0"
Missing Constraint: Import-Package: javax.servlet.http; version="0.0.0"
(1) When I update my Manifest file from "Import-Package: javax.servlet, javax.servlet.http" to "Require-Bundle: javax.servlet;bundle-version="3.0.0" maven build works but servlet can not be correctly registered in my application and following Throwable is thrown:
---
java.lang.LinkageError: loader constraint violation: when resolving interface method "org.osgi.service.http.HttpService.registerServlet(Ljava/lang/String;Ljavax/servlet/Servlet;Ljava/util/Dictionary;Lorg/osgi/service/http/HttpContext;)V"
the class loader (instance of org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) of the current class, mypackage/servlets/HttpServiceTracker, and the class loader (instance of org/eclipse/osgi/internal/baseadaptor
/DefaultClassLoader) for resolved class, org/osgi/service/http/HttpService, have different Class objects for the type javax/servlet/Servlet used in the signature
---
I am not sure what is wrong in my application or environment and why "LinkageError" is thrown. Maybe I unnecessary change my manifest (1) and I suppose to solve it in another way.
Any ideas, how could I solve this problem?!
Thanks for any hints.
Piotr
|
|
|
Re: Servlet can not be registered [message #899961 is a reply to message #899728] |
Fri, 03 August 2012 04:45   |
Eclipse User |
|
|
|
Hi Piotr,
could be that both servlet 2.5 and servlet 3.0 exists and selected in
your launch configuration?
Best,
Ivan
On 8/2/2012 9:46 AM, Piotr Slonicz wrote:
> I use a common implemetation for registering servlets, i.e.:
> - Activator Class with start/ stop methods and with HttpServiceTracker
> - HttpServiceTracker Class with addingService/ removedService methods
> - Servlet Class
> - Manifest (Import-Package: javax.servlet, javax.servlet.http)
>
> After I have switch the Rap Target Platform from 1.5 RC1 to newer one
> (RC2, RC3, R) maven can not build my war product anymore, because of:
> Missing Constraint: Import-Package: javax.servlet; version="0.0.0"
> Missing Constraint: Import-Package: javax.servlet.http; version="0.0.0"
>
> (1) When I update my Manifest file from "Import-Package:
> javax.servlet, javax.servlet.http" to "Require-Bundle:
> javax.servlet;bundle-version="3.0.0" maven build works but servlet can
> not be correctly registered in my application and following Throwable
> is thrown:
> ---
> java.lang.LinkageError: loader constraint violation: when resolving
> interface method
> "org.osgi.service.http.HttpService.registerServlet(Ljava/lang/String;Ljavax/servlet/Servlet;Ljava/util/Dictionary;Lorg/osgi/service/http/HttpContext;)V"
> the class loader (instance of
> org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) of the
> current class, mypackage/servlets/HttpServiceTracker, and the class
> loader (instance of org/eclipse/osgi/internal/baseadaptor
> /DefaultClassLoader) for resolved class,
> org/osgi/service/http/HttpService, have different Class objects for
> the type javax/servlet/Servlet used in the signature
> ---
>
> I am not sure what is wrong in my application or environment and why
> "LinkageError" is thrown. Maybe I unnecessary change my manifest (1)
> and I suppose to solve it in another way.
>
> Any ideas, how could I solve this problem?!
>
> Thanks for any hints.
> Piotr
--
Ivan Furnadjiev
Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/
Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
|
|
|
Re: Servlet can not be registered [message #900072 is a reply to message #899961] |
Fri, 03 August 2012 15:43   |
Eclipse User |
|
|
|
Hi Ivan,
I have just realized, that I haven't write, that, when I start my application locally in Eclipse environment, all works fine and servlet is correctly registered, but if I deploy my war product in Tomcat, already mentioned throwable is thrown.
In my launch configuration there is only one selected servlet jar library and it comes from RAP target platform. Servlet library is also included in my war product and it is also started (I have checked it with osgi console).
Maybe there is some conflict between servlet-api.jar which is delivered together with tomcat and servlet jar delivered with my war product?!
What I do not understand, is why after I have migrate from 1.5TP RC1 to RC2 (or newer) package imports doesn't work anymore (javax.servlet, javax.servlet.http).
Regards,
Piotr
|
|
|
Re: Servlet can not be registered [message #900112 is a reply to message #900072] |
Sat, 04 August 2012 03:05   |
Eclipse User |
|
|
|
Piotr,
servlet library will be provided by the servlet container (Tomcat) and
you must not include it in your war file.
Best,
Ivan
On 8/3/2012 10:43 PM, Piotr Slonicz wrote:
> Hi Ivan,
>
> I have just realized, that I haven't write, that, when I start my
> application locally in Eclipse environment, all works fine and servlet
> is correctly registered, but if I deploy my war product in Tomcat,
> already mentioned throwable is thrown.
>
> In my launch configuration there is only one selected servlet jar
> library and it comes from RAP target platform. Servlet library is also
> included in my war product and it is also started (I have checked it
> with osgi console).
>
> Maybe there is some conflict between servlet-api.jar which is
> delivered together with tomcat and servlet jar delivered with my war
> product?!
> What I do not understand, is why after I have migrate from 1.5TP RC1
> to RC2 (or newer) package imports doesn't work anymore (javax.servlet,
> javax.servlet.http).
>
> Regards,
> Piotr
--
Ivan Furnadjiev
Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/
Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
|
|
| | | |
Goto Forum:
Current Time: Mon Jul 07 14:30:30 EDT 2025
Powered by FUDForum. Page generated in 0.34052 seconds
|