Spring and GWT 1.6RC

59 views
Skip to first unread message

magbyr

unread,
Mar 19, 2009, 10:28:46 AM3/19/09
to Google Web Toolkit
I'm having a problem with 1.6RC / Jetty and Spring 2.5. Same project
worked well on 1.5.3, but not on 1.6RC.

Fails on jsp and default servlet from Jetty:
javax.servlet.UnavailableException: Servlet class
org.apache.jasper.servlet.JspServlet is not a javax.servlet.Servlet
javax.servlet.UnavailableException: Servlet class
org.mortbay.jetty.servlet.DefaultServlet is not a
javax.servlet.Servlet

Seems like some kind of classloader issue.

Anybody running 1.6RC with Spring successfully?

Luciano

unread,
Mar 19, 2009, 12:50:48 PM3/19/09
to Google Web Toolkit
Hi,

I'm unable to use JSPs in the embedded Jetty too. A simple test: with
JAVA_HOME pointing to the latest JDK, I've created an application
named "JspTest" using webAppCreator. Then I renamed the JspTest.html
file to JspTest.jsp and modified build.xml to launch that file. With
"ant hosted" I get an error:

Unable to compile class for JSP

Generated servlet error:
GRAVE: Env: Compile: javaFileName=/C:/DOCUME~1/.../Temp/
Jetty_0_0_0_0_8888_war____masbuh/jsp//org/apache/jsp\JspTest_jsp.java
... plus many other lines.

Any idea?

On 19 Mar, 15:28, magbyr <mag...@gmail.com> wrote:
> I'm having a problem with 1.6RC / Jetty and Spring 2.5. Same project
> worked well on 1.5.3, but not on 1.6RC.
>
> Fails onjspand default servlet from Jetty:

magbyr

unread,
Mar 19, 2009, 1:56:54 PM3/19/09
to Google Web Toolkit
I tried creating a completely blank / new 1.6RC project. When I put
spring.jar and a blank applicationContext.xml the project stops
working.
Tried both with the spring context-listener and the spring servlet.

[WARN] failed springServlet
java.lang.LinkageError: loader constraint violation: loader (instance
of com/google/gwt/dev/shell/jetty/JettyLauncher$WebAppContextWithReload
$WebAppClassLoaderExtension) previously initiated loading for a
different type with name "org/apache/commons/logging/Log"
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:
124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at com.google.gwt.dev.shell.jetty.JettyLauncher
$WebAppContextWithReload$WebAppClassLoaderExtension.findClass
(JettyLauncher.java:303)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass
(WebAppClassLoader.java:366)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass
(WebAppClassLoader.java:337)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at
org.springframework.core.CollectionFactory.createConcurrentMapIfPossible
(CollectionFactory.java:195)
at org.springframework.web.context.ContextLoader.<clinit>
(ContextLoader.java:153)
at
org.springframework.web.context.ContextLoaderServlet.createContextLoader
(ContextLoaderServlet.java:89)
at org.springframework.web.context.ContextLoaderServlet.init
(ContextLoaderServlet.java:80)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.mortbay.jetty.servlet.ServletHolder.initServlet
(ServletHolder.java:433)
at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:
256)
at org.mortbay.component.AbstractLifeCycle.start
(AbstractLifeCycle.java:39)
at org.mortbay.jetty.servlet.ServletHandler.initialize
(ServletHandler.java:616)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
at org.mortbay.jetty.webapp.WebAppContext.startContext
(WebAppContext.java:1220)
at org.mortbay.jetty.handler.ContextHandler.doStart
(ContextHandler.java:513)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:
448)
at com.google.gwt.dev.shell.jetty.JettyLauncher
$WebAppContextWithReload.doStart(JettyLauncher.java:397)
at org.mortbay.component.AbstractLifeCycle.start
(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerWrapper.doStart
(HandlerWrapper.java:130)
at org.mortbay.jetty.handler.RequestLogHandler.doStart
(RequestLogHandler.java:115)
at org.mortbay.component.AbstractLifeCycle.start
(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerWrapper.doStart
(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:222)
at org.mortbay.component.AbstractLifeCycle.start
(AbstractLifeCycle.java:39)
at com.google.gwt.dev.shell.jetty.JettyLauncher.start
(JettyLauncher.java:449)
at com.google.gwt.dev.HostedMode.doStartUpServer(HostedMode.java:367)
at com.google.gwt.dev.HostedModeBase.startUp(HostedModeBase.java:590)
at com.google.gwt.dev.HostedModeBase.run(HostedModeBase.java:397)
at com.google.gwt.dev.HostedMode.main(HostedMode.java:232)



On 19 Mar, 15:28, magbyr <mag...@gmail.com> wrote:

Flemming Boller

unread,
Mar 19, 2009, 4:08:40 PM3/19/09
to Google-We...@googlegroups.com
I can also confirm the above experience. "loader constraint violation"

/Flemming

Fangzx

unread,
Mar 22, 2009, 4:30:53 AM3/22/09
to Google Web Toolkit
Anyone solved the problem?

Flemming Boller

unread,
Mar 22, 2009, 5:14:12 AM3/22/09
to Google-We...@googlegroups.com
Hi

It seems that the jarfile gwt-dev-windows.jar includes a lot of apache commons libraries.
which conflicts with jar files added in web-inf/lib that also uses the above commons libraries.


/Flemming

Flemming Boller

unread,
Mar 22, 2009, 5:23:04 AM3/22/09
to Google-We...@googlegroups.com
Hi

1) using winzip I removed the commons folder in the file gwt-dev-windows.jar file

2) Then I added the following jar files on the classpath in intellij idea.
           - commons-collections-3.1.jar
           -  commons-configuration-1.4.jar
           -  commons-logging-1.1.jar
          - gwt-servlet.jar
    and also spring 2.5.5.jar :-)

Now I can start up gwt 1.6Rc1 and it can read the application xml , and I can rpc call a spring bean.

Hope you can use this.


/Flemming

Flemming Boller

unread,
Mar 22, 2009, 5:43:18 AM3/22/09
to Google-We...@googlegroups.com
oh, I forgot to write, that in metainf folder there is a index.list file.
in that file I also deleted all to apache.commons lines.


/Flemming

magbyr

unread,
Mar 22, 2009, 11:33:10 AM3/22/09
to Google Web Toolkit
Great, thanks. I'll try this out...

On 22 Mar, 10:43, Flemming Boller <flemming.bol...@gmail.com> wrote:
> oh, I forgot to write, that in metainf folder there is a index.list file.
> in that file I also deleted all to apache.commons lines.
>
> /Flemming
>
> On Sun, Mar 22, 2009 at 10:23 AM, Flemming Boller <flemming.bol...@gmail.com

Fangzx

unread,
Mar 22, 2009, 11:06:35 PM3/22/09
to Google Web Toolkit
Flemming ,thank you,the problem sovled.

Ed

unread,
Mar 23, 2009, 4:45:25 AM3/23/09
to Google Web Toolkit
Shouldn't this be reported as an "issue" ?

I thought these issues would be solved now with the usage of Jetty
instead Tomcat as mentioned here:
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/7254dfe963f479ae?hl=en#


-- Ed

Alejandro D. Garin

unread,
Mar 23, 2009, 7:37:09 AM3/23/09
to Google-We...@googlegroups.com
Hi,

anyone can use Spring context listener in web.xml ?

Example:

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/applicationContext.xml</param-value>
    </context-param> 
   
    <listener>
        <listener-class>
            org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener> 

Flemming Boller

unread,
Mar 23, 2009, 11:13:43 AM3/23/09
to Google-We...@googlegroups.com
Yes I can, that is the way I use spring and gwt.

/FLemming

Flemming Boller

unread,
Mar 23, 2009, 2:11:26 PM3/23/09
to Google-We...@googlegroups.com
Hi

I have created an issuse, number 3496.

/Flemming

Scott Blum

unread,
Mar 23, 2009, 11:47:41 PM3/23/09
to Google-We...@googlegroups.com, Luciano
Hey, can you guys do me a favor and try out a fix?

Just take the attached jar and put it on your classpath ahead of gwt-dev-<platform>.jar.  See if it fixes the "not and instance of Servlet" problem (and doesn't cause other problems).

Lemme know if that works, thanks,
Scott

PS: The Jsp compilation problem is unrelated, I think.  By default, Eclipse does NOT put Sun's tools.jar on your classpath, even if you're using a JDK.  The fix is to explicitly add the JDK's tools.jar to your classpath.
gwt-dev-patch.jar

Fangzx

unread,
Apr 8, 2009, 5:21:10 AM4/8/09
to Google Web Toolkit
This bug is fixed in lastest GWT 1.6 release!

On 3月24日, 上午11时47分, Scott Blum <sco...@google.com> wrote:
> Hey, can you guys do me a favor and try out a fix?
>
> Just take the attached jar and put it on your classpath ahead of
> gwt-dev-<platform>.jar. See if it fixes the "not and instance of Servlet"
> problem (and doesn't cause other problems).
>
> Lemme know if that works, thanks,
> Scott
>
> PS: The Jsp compilation problem is unrelated, I think. By default, Eclipse
> does NOT put Sun's tools.jar on your classpath, even if you're using a JDK.
> The fix is to explicitly add the JDK's tools.jar to your classpath.
>
> On Mon, Mar 23, 2009 at 2:11 PM, Flemming Boller
> <flemming.bol...@gmail.com>wrote:
>
> > Hi
>
> > I have created an issuse, number 3496.
>
> > /Flemming
>
> > On Mon, Mar 23, 2009 at 4:13 PM, Flemming Boller <
> > flemming.bol...@gmail.com> wrote:
>
> >> Yes I can, that is the way I use spring and gwt.
>
> >> /FLemming
>
> >> On Mon, Mar 23, 2009 at 12:37 PM, Alejandro D. Garin <aga...@gmail.com>wrote:
>
> >>> Hi,
>
> >>> anyone can use Spring context listener in web.xml ?
>
> >>> Example:
>
> >>> <context-param>
> >>> <param-name>contextConfigLocation</param-name>
> >>> <param-value>/WEB-INF/applicationContext.xml</param-value>
> >>> </context-param>
>
> >>> <listener>
> >>> <listener-class>
> >>> org.springframework.web.context.ContextLoaderListener
> >>> </listener-class>
> >>> </listener>
>
> >>> On Mon, Mar 23, 2009 at 5:45 AM, Ed <post2edb...@hotmail.com> wrote:
>
> >>>> Shouldn't this be reported as an "issue" ?
>
> >>>> I thought these issues would be solved now with the usage of Jetty
> >>>> instead Tomcat as mentioned here:
>
> >>>>http://groups.google.com/group/Google-Web-Toolkit/browse_thread/threa...
>
> >>>> -- Ed
>
>
>
> gwt-dev-patch.jar
> 25K查看下载
Reply all
Reply to author
Forward
0 new messages