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.
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?
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
>
>
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
>
>
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.
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: