Issue using Vaadin 6.3.3 with Maven, Spring 3 and Glassfish v3

Hi everyone,
thank you very much for all your posts, wiki, and documentation about glassfish + vaadin and spring + vaadin, it helped me a lot, but now i’m kind of stuck for a day or two,
I’m trying to use the second way (“simpler way”) of integrating vaadin and spring, using the @Configurable annotations and the Load-time weaver. But something’s wrong i’m getting a ClassNotFoundException for the GWT component : com.google.gwt.event.dom.client.KeyDownHandler.

I found out that it was because of the load time weaver, because when it’s de-activated the whole app is working once again. I hope you can help me, here’s my full debug stacktrace of spring initialization in glassfish : (You can see that it’s correctly “recognizing” the load-time weaver of glassfish v3) :

INFO: INFO - ContextLoader - Root WebApplicationContext: initialization started
[… XML Shema init]

INFO: DEBUG - DefaultListableBeanFactory - Creating shared instance of singleton bean ‘org.springframework.context.annotation.internalConfigurationAnnotationProcessor’
[init]

INFO: DEBUG - DefaultListableBeanFactory - Finished creating instance of bean ‘org.springframework.context.annotation.internalConfigurationAnnotationProcessor’

INFO: DEBUG - DefaultListableBeanFactory - Creating shared instance of singleton bean ‘org.springframework.context.weaving.AspectJWeavingEnabler#0’
INFO: DEBUG - DefaultListableBeanFactory - Creating instance of bean ‘org.springframework.context.weaving.AspectJWeavingEnabler#0’
INFO: DEBUG - DefaultListableBeanFactory - Eagerly caching bean ‘org.springframework.context.weaving.AspectJWeavingEnabler#0’ to allow for resolving potential circular references
INFO: DEBUG - DefaultListableBeanFactory - Creating shared instance of singleton bean ‘loadTimeWeaver’
INFO: DEBUG - DefaultListableBeanFactory - Creating instance of bean ‘loadTimeWeaver’
INFO: DEBUG - DefaultListableBeanFactory - Eagerly caching bean ‘loadTimeWeaver’ to allow for resolving potential circular references
INFO: INFO - faultContextLoadTimeWeaver -
Determined server-specific load-time weaver: org.springframework.instrument.classloading.glassfish.GlassFishLoadTimeWeaver

INFO: DEBUG - DefaultListableBeanFactory - Finished creating instance of bean ‘loadTimeWeaver’
INFO: DEBUG - DefaultListableBeanFactory - Finished creating instance of bean ‘org.springframework.context.weaving.AspectJWeavingEnabler#0’
INFO: DEBUG - DefaultListableBeanFactory - Returning cached instance of singleton bean ‘org.springframework.context.annotation.internalConfigurationAnnotationProcessor’

GRAVE: =================================================================
Vaadin is running in DEBUG MODE.
Add productionMode=true to web.xml to disable debug features.
To show debug window, add ?debug to your application URL.

GRAVE: [WebappClassLoader@72a548e4]
error can’t determine annotations of missing type com.google.gwt.user.client.ui.ComplexPanel
when processing declare parents com.vaadin.terminal.gwt.client.ui.VForm
when processing type mungers
when weaving
[Xlint:cantFindType]

GRAVE: [WebappClassLoader@72a548e4]
error can’t determine implemented interfaces of missing type com.google.gwt.event.dom.client.KeyDownHandler
when processing declare parents com.vaadin.terminal.gwt.client.ui.VForm
when processing type mungers
when weaving
[Xlint:cantFindType]

GRAVE: [WebappClassLoader@72a548e4]
warning can’t find type com.google.gwt.event.dom.client.KeyDownHandler whilst determining signatures of call or execution join point for void com.vaadin.terminal.gwt.client.ui.VForm.updateFromUIDL(com.vaadin.terminal.gwt.client.UIDL, com.vaadin.terminal.gwt.client.ApplicationConnection), this may cause a pointcut to fail to match at this join point
when weaving type com.vaadin.terminal.gwt.client.ui.VForm
when weaving classes
when weaving
[Xlint:cantFindTypeAffectingJPMatch]

GRAVE: [WebappClassLoader@72a548e4]
warning can’t find type com.google.gwt.user.client.ui.ComplexPanel whilst determining signatures of call or execution join point for void com.vaadin.terminal.gwt.client.ui.VForm.updateFromUIDL(com.vaadin.terminal.gwt.client.UIDL, com.vaadin.terminal.gwt.client.ApplicationConnection), this may cause a pointcut to fail to match at this join point
when weaving type com.vaadin.terminal.gwt.client.ui.VForm
when weaving classes
when weaving
[Xlint:cantFindTypeAffectingJPMatch]

ATTENTION: StandardWrapperValve[OpenReAct Servlet]
: PWC1406: Servlet.service() for servlet OpenReAct Servlet threw exception
java.lang.RuntimeException: WEB9033: Unable to load class with name [com.vaadin.terminal.gwt.client.ui.VForm]
, reason: java.lang.NoClassDefFoundError: com/google/gwt/event/dom/client/KeyDownHandler
at org.glassfish.web.loader.WebappClassLoader.findClass(WebappClassLoader.java:944)
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1420)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:95)
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:107)
at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:31)
at sun.reflect.annotation.AnnotationParser.parseSig(AnnotationParser.java:370)
at sun.reflect.annotation.AnnotationParser.parseClassValue(AnnotationParser.java:351)
at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:280)
at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:222)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:69)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:52)
at java.lang.Class.initAnnotationsIfNecessary(Class.java:3070)
at java.lang.Class.initAnnotationsIfNecessary(Class.java:3077)
at java.lang.Class.getAnnotation(Class.java:3029)
at java.lang.Class.isAnnotationPresent(Class.java:3042)
at org.haguro.ui.form.ContributionForm.(ContributionForm.java:38)
at org.haguro.ui.ContributionWindow.(ContributionWindow.java:12)
at org.haguro.widget.TwinCustomSelect.(TwinCustomSelect.java:30)
at org.haguro.ui.LookupPanel.(LookupPanel.java:9)
at org.haguro.ConflictproviderApplication.(ConflictproviderApplication.java:33)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at com.vaadin.terminal.gwt.server.ApplicationServlet.getNewApplication(ApplicationServlet.java:82)
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.createApplication(AbstractApplicationServlet.java:946)
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.findApplicationInstance(AbstractApplicationServlet.java:774)
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:437)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:637)
Caused by: java.lang.NoClassDefFoundError: com/google/gwt/event/dom/client/KeyDownHandler
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at org.glassfish.web.loader.WebappClassLoader.findClass(WebappClassLoader.java:914)
… 56 more
Caused by: java.lang.ClassNotFoundException: com.google.gwt.event.dom.client.KeyDownHandler
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at org.glassfish.web.loader.WebappClassLoader.findClass(WebappClassLoader.java:949)
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1420)
… 61 more

Thank you for your help, tell me if you need more information to figure it out,
because personally i can’t :frowning:

Maybe this is related to glassfish v3 class reloading problem.
The workaround is adding gwt-user.jar in your library.

See this related link:
https://vaadin.com/forum/-/message_boards/message/104606
http://dev.vaadin.com/ticket/3920

hope it helps…

Thank you for your answer,
i saw this ticket, it was fixed and i was using the correct version of Glassfish.
Finally i found out what was needed, but it seems strange to me,

Without any load-time weaving i’m not having any dependency problem, i have this vaadin dependency defined in my pom.xml :


		<dependency>
			<groupId>com.vaadin</groupId>
			<artifactId>vaadin</artifactId>
			<version>6.3.3</version>
		</dependency>

But there is a dependency problem when i’m activating the load-time weaving, and Vaadin does not define gwt-user as a direct dependency with maven.
Explicitely putting :


		<dependency>
			<groupId>com.google.gwt</groupId>
			<artifactId>gwt-user</artifactId>
			<version>${gwt-version}</version>
			<scope>compile</scope>
		</dependency>

solved my problem, and the DI is working correctly, and the EntityManager is correctly injected too.
Thank you for help, and i hope this post will help others.