Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » java.lang.LinkageError when using servletbridge
java.lang.LinkageError when using servletbridge [message #113138] Thu, 03 July 2008 06:55 Go to next message
Carsten Spieker is currently offline Carsten SpiekerFriend
Messages: 197
Registered: July 2009
Senior Member
Hi,

I have a problem when running my server side eclipse framework in a Tomcat
server using the servletbridge.

I have built the WAR-file and deployed it to the Tomcat server. When trying
to acces my servlet, I get the following error:

java.lang.LinkageError: loader constraint violation: loader (instance of
org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) previously
initiated loading for a different type with name
"javax/servlet/ServletRequest"

If I running as equniox server in the eclipse IDE everything works fine.


I cannot help myself solving this problem after spending two days with
searching for any solution.

Can anyone give any help to me?

Thanks a lot!

Greetz,
Carsten
Re: java.lang.LinkageError when using servletbridge [message #113153 is a reply to message #113138] Thu, 03 July 2008 08:26 Go to previous messageGo to next message
Markus Barchfeld is currently offline Markus BarchfeldFriend
Messages: 27
Registered: July 2009
Junior Member
Hi!

I got the same exception and it was due to javax.servlet being installed
in $webapp/WEB-INF/eclipse/plugins. AFAIU the servlet-api should be
provided from the hosting servlet container. Therefore there should be no
javax.servlet bundle installed. In our web app we also had a dependency to
javax.servlet which we had to remove and use "imported packages" instead.

Currently we are still struggling with installing a web application with
jsp pages using the servlet bridge. Which jsp related bundles must be
present in $webapp/WEB-INf/eclipse/plugins (e.g o.e.e.jsp.jstl,
o.apache.jasper, javax.servlet.jsp)? Is there a jsp/jstl example somewhere
which is running via servlet bridge?

Thanks
Markus
Re: java.lang.LinkageError when using servletbridge [message #113166 is a reply to message #113153] Thu, 03 July 2008 09:28 Go to previous messageGo to next message
Carsten Spieker is currently offline Carsten SpiekerFriend
Messages: 197
Registered: July 2009
Senior Member
Hi Markus,

thank you very much. That was exactly what I had to do.

Unfortunatley I have no experiences with JSP related bundles to
give you a help with your problem/question. Sorry.

Greetz,
Carsten



"Markus Barchfeld" <Markus.Barchfeld@gmx.de> schrieb im Newsbeitrag
news:aae93a3ab709496ab12e6021487431fc$1@www.eclipse.org...
> Hi!
>
> I got the same exception and it was due to javax.servlet being installed
> in $webapp/WEB-INF/eclipse/plugins. AFAIU the servlet-api should be
> provided from the hosting servlet container. Therefore there should be no
> javax.servlet bundle installed. In our web app we also had a dependency to
> javax.servlet which we had to remove and use "imported packages" instead.
>
> Currently we are still struggling with installing a web application with
> jsp pages using the servlet bridge. Which jsp related bundles must be
> present in $webapp/WEB-INf/eclipse/plugins (e.g o.e.e.jsp.jstl,
> o.apache.jasper, javax.servlet.jsp)? Is there a jsp/jstl example somewhere
> which is running via servlet bridge?
>
> Thanks
> Markus
>
>
Re: java.lang.LinkageError when using servletbridge [message #113268 is a reply to message #113153] Thu, 03 July 2008 17:38 Go to previous messageGo to next message
Simon Kaegi is currently offline Simon KaegiFriend
Messages: 381
Registered: July 2009
Senior Member
Hi Markus,

When running JSPs under the servletbridge we "always" use our own private
copies of both jasper and javax.servlet.jsp. To the servletbridge JSPs are
just another servlet-based templating framework like velocity or cocoon or
.... With that said JSP is well supported and tested with equinox server-side
as it's used in the Help components of the Eclipse platform.

So... in addition to the regular servletbridge bundles (or Jetty Http
Service bundles) you'll need the following:
javax.servlet.jsp
org.apache.jasper
org.apache.commons.el
org.apache.commons.logging
org.eclipse.equinox.jasper

If you want to use jsps with the http.registry extensions you also need:
org.eclipse.equinox.jsp.jasper.registry

If you haven't already I'd recommend getting this up and running with the
Jetty Http Service as a first step. The bundles required should be identical
after swapping out Jetty (and as you've pointed out the javax.servlet
bundle) for the servletbridge.

HTH
-Simon


"Markus Barchfeld" <Markus.Barchfeld@gmx.de> wrote in message
news:aae93a3ab709496ab12e6021487431fc$1@www.eclipse.org...
> Hi!
>
> I got the same exception and it was due to javax.servlet being installed
> in $webapp/WEB-INF/eclipse/plugins. AFAIU the servlet-api should be
> provided from the hosting servlet container. Therefore there should be no
> javax.servlet bundle installed. In our web app we also had a dependency to
> javax.servlet which we had to remove and use "imported packages" instead.
>
> Currently we are still struggling with installing a web application with
> jsp pages using the servlet bridge. Which jsp related bundles must be
> present in $webapp/WEB-INf/eclipse/plugins (e.g o.e.e.jsp.jstl,
> o.apache.jasper, javax.servlet.jsp)? Is there a jsp/jstl example somewhere
> which is running via servlet bridge?
>
> Thanks
> Markus
>
>
Re: java.lang.LinkageError when using servletbridge [message #1015688 is a reply to message #113268] Fri, 01 March 2013 17:38 Go to previous messageGo to next message
Thorsten Schlathölter is currently offline Thorsten SchlathölterFriend
Messages: 211
Registered: February 2012
Location: Düsseldorf
Senior Member
I just stumbled into the same problem. Trying to run a jsp from within OSGI.
I have installed (as provided with equinox 3.8.1 SDK):

org.eclipse.equinox.http.registry
org.eclipse.equinox.http.servlet
org.eclipse.equinox.http.servletbridge
org.eclipse.equinox.jsp.jasper
org.eclipse.equinox.jsp.jasper.registry
javax.servlet
javax.servlet.jsp
org.apache.jasper.glassfish

(and all dependencies to resolve the above)


I have configured the following extensions:

   
<extension
         point="org.eclipse.equinox.http.registry.resources">
      <resource
            alias="/resource"
            base-name="/web-content">
      </resource>
      <resource
            alias="/web-content/repository/plugins"
            base-name="/web-content/repository/plugins">
      </resource>
   </extension>
   <extension
         point="org.eclipse.equinox.http.registry.servlets">
      <servlet
            alias="/web-content"
            class="org.eclipse.equinox.jsp.jasper.registry.JSPFactory:/web-content"
            load-on-startup="true">
      </servlet>
   </extension>


Running as OSGI (RAP App) from within Eclipse everyting is fine. After installing to Tomcat 7.0.21 I get:

java.lang.LinkageError: loader constraint violation: loader (instance of org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) previously initiated loading for a different type with name "javax/servlet/descriptor/JspConfigDescriptor"
	$Proxy0.getJspConfigDescriptor(Unknown Source)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	java.lang.reflect.Method.invoke(Method.java:597)
	org.eclipse.equinox.jsp.jasper.JspServlet$ServletContextAdaptor.invoke(JspServlet.java:251)
	org.eclipse.equinox.jsp.jasper.JspServlet$1.invoke(JspServlet.java:241)



I tried to just remove javax.servlet from my configuration hoping that the required bundles could be resolved by the container (as suggested above) but as expected this results in not resolving the above bundles.

Can somebody help me out with this?
Re: java.lang.LinkageError when using servletbridge [message #1015736 is a reply to message #1015688] Sat, 02 March 2013 00:22 Go to previous message
Thorsten Schlathölter is currently offline Thorsten SchlathölterFriend
Messages: 211
Registered: February 2012
Location: Düsseldorf
Senior Member
Ok. Here is what needs to be done:
I figured out what the servletbridge.extensionbundle is really good for. Namely exposing the servlet api to the osgi. So I simply added the following init-params to the servletbridge servlet to further extend the extensionbundle:


<init-param>
   <param-name>overrideAndReplaceExtensionBundle</param-name>
   <param-value>true</param-value>
</init-param>	

<init-param>
   <param-name>extendedFrameworkExports</param-name>
   <param-value>javax.servlet;version="3.0",javax.servlet.http;version="3.0",javax.servlet.descriptor;version="2.6"</param-value>			
   </init-param>




It took me hours to find out that this really works because I had the wrong version of the servletbridge in the lib of my webapp.

File closed.
Thorsten
Previous Topic:How to change bundle start level in glassfish 3.1.2 equinox?
Next Topic:Mirror updatesites leaves original updatesite urls in metadata
Goto Forum:
  


Current Time: Tue Nov 25 22:25:24 GMT 2014

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

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