Problems with java.lang.ClassNotFoundException

47 views
Skip to first unread message

Joakim Sjöberg

unread,
Mar 20, 2009, 10:15:16 AM3/20/09
to googl...@googlegroups.com

Hi!

 

I have just started with gin in my GWT project and I have followed the tutorial. Now I have
a problem that I cannot figure out. It seems that my DivTestModule class is not found, even
though it all looks correct in the code, from what I can see. But now I am getting this error:

Found type 'DivTestInjector'

      Resolving annotation '@GinModules(DivTestModule.class)'

         [ERROR]

java.lang.ClassNotFoundException: org.gwt.client.gin.DivTestModule

        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)

        at java.security.AccessController.doPrivileged(Native Method)

        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)

        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)

        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)

        at java.lang.Class.forName0(Native Method)

        at java.lang.Class.forName(Class.java:247)

        at com.google.gwt.dev.javac.TypeOracleMediator.getClassLiteral(TypeOracleMediator.java:753)

        at com.google.gwt.dev.javac.TypeOracleMediator.getAnnotationElementValue(TypeOracleMediator.java:664)

        at com.google.gwt.dev.javac.TypeOracleMediator.createAnnotationInstance(TypeOracleMediator.java:432)

        at com.google.gwt.dev.javac.TypeOracleMediator.resolveAnnotation(TypeOracleMediator.java:826)

        at com.google.gwt.dev.javac.TypeOracleMediator.resolveAnnotations(TypeOracleMediator.java:847)

        at com.google.gwt.dev.javac.TypeOracleMediator.resolveTypeDeclaration(TypeOracleMediator.java:1374)

        at com.google.gwt.dev.javac.TypeOracleMediator.refresh(TypeOracleMediator.java:382)

        at com.google.gwt.dev.javac.CompilationState.compile(CompilationState.java:137)

        at com.google.gwt.dev.GWTCompiler.distill(GWTCompiler.java:327)

        at com.google.gwt.dev.GWTCompiler.run(GWTCompiler.java:564)

        at com.google.gwt.dev.GWTCompiler.run(GWTCompiler.java:554)

        at com.google.gwt.dev.GWTCompiler.main(GWTCompiler.java:214)

Exception in thread "main" java.lang.NullPointerException

        at com.google.gwt.dev.javac.TypeOracleMediator.getAnnotationElementValue(TypeOracleMediator.java:694)

        at com.google.gwt.dev.javac.TypeOracleMediator.createAnnotationInstance(TypeOracleMediator.java:432)

        at com.google.gwt.dev.javac.TypeOracleMediator.resolveAnnotation(TypeOracleMediator.java:826)

        at com.google.gwt.dev.javac.TypeOracleMediator.resolveAnnotations(TypeOracleMediator.java:847)

        at com.google.gwt.dev.javac.TypeOracleMediator.resolveTypeDeclaration(TypeOracleMediator.java:1374)

        at com.google.gwt.dev.javac.TypeOracleMediator.refresh(TypeOracleMediator.java:382)

        at com.google.gwt.dev.javac.CompilationState.compile(CompilationState.java:137)

        at com.google.gwt.dev.GWTCompiler.distill(GWTCompiler.java:327)

        at com.google.gwt.dev.GWTCompiler.run(GWTCompiler.java:564)

        at com.google.gwt.dev.GWTCompiler.run(GWTCompiler.java:554)

        at com.google.gwt.dev.GWTCompiler.main(GWTCompiler.java:214)

 

Is this anything you have experienced before?

 

 

Joakim Sjöberg

Technical Consultant

 

Artificial Solutions Scandinavia AB

Österlånggatan 43 4tr

111 31 Stockholm

Sweden

 

Phone: +46 8 586 120 63

Mobile: +46 765 271833

Fax: +46 8 663 67 77

 

Email: joakim....@artificial-solutions.com

Web: www.artificial-solutions.com

 

Peter Schmitt

unread,
Mar 20, 2009, 12:11:52 PM3/20/09
to googl...@googlegroups.com
I haven't seen a problem like this before, can you give us some more context (code, package structure, gwt.xml)? The error looks like it's connected to the initial GWT compilation of the code, and it looks like the GWT compiler can't find your org.gwt.client.gin.DivTestModule class.  That might be because it's not covered by your classpath or because it's not in the gwt.xml.

Peter

2009/3/20 Joakim Sjöberg <Joakim....@artificial-solutions.com>

Joakim Sjöberg

unread,
Mar 20, 2009, 12:40:23 PM3/20/09
to googl...@googlegroups.com

Hi Peter!

 

I will supply you with what I have in code. Here it comes.

 

Hope this will help you help me J

 

Thanks for the effort and have a nice day!

 

Joakim

client.zip

Joakim Sjöberg

unread,
Mar 23, 2009, 4:12:09 AM3/23/09
to googl...@googlegroups.com

Hi Peter!

 

Have you had the time to look at this? Is there something you can help me with?

 

Joakim Sjöberg

 

 

From: googl...@googlegroups.com [mailto:googl...@googlegroups.com] On Behalf Of Peter Schmitt
Sent: Friday, March 20, 2009 5:12 PM
To: googl...@googlegroups.com
Subject: [google-gin] Re: Problems with java.lang.ClassNotFoundException

 

I haven't seen a problem like this before, can you give us some more context (code, package structure, gwt.xml)? The error looks like it's connected to the initial GWT compilation of the code, and it looks like the GWT compiler can't find your org.gwt.client.gin.DivTestModule class.  That might be because it's not covered by your classpath or because it's not in the gwt.xml.

Peter

Joakim Sjöberg

unread,
Mar 23, 2009, 10:08:53 AM3/23/09
to googl...@googlegroups.com

I have realized that I need Guice also to make Gin work, I have when I get this  error below  Guice 1.0 installed. Saw now that I need a trunk build (r803 or higher), were can I get that?

 

Regards

Joakim

 

From: googl...@googlegroups.com [mailto:googl...@googlegroups.com] On Behalf Of Peter Schmitt
Sent: Friday, March 20, 2009 5:12 PM
To: googl...@googlegroups.com
Subject: [google-gin] Re: Problems with java.lang.ClassNotFoundException

 

I haven't seen a problem like this before, can you give us some more context (code, package structure, gwt.xml)? The error looks like it's connected to the initial GWT compilation of the code, and it looks like the GWT compiler can't find your org.gwt.client.gin.DivTestModule class.  That might be because it's not covered by your classpath or because it's not in the gwt.xml.

Peter

Brian Stoler

unread,
Mar 23, 2009, 10:39:25 AM3/23/09
to googl...@googlegroups.com
http://code.google.com/p/google-guice/downloads/list

See the most recent snapshot prerelease.

2009/3/23 Joakim Sjöberg <Joakim....@artificial-solutions.com>

Joakim Sjöberg

unread,
Mar 23, 2009, 10:39:43 AM3/23/09
to googl...@googlegroups.com

Ah ok so It works with the 2.0 Beta?

Brian Stoler

unread,
Mar 23, 2009, 10:46:15 AM3/23/09
to googl...@googlegroups.com
Yep.

2009/3/23 Joakim Sjöberg <Joakim....@artificial-solutions.com>

Joakim Sjöberg

unread,
Mar 23, 2009, 10:46:18 AM3/23/09
to googl...@googlegroups.com

Great, could the problems we are experience below come from that we are using version 1.0?

 

// Joakim

Brian Stoler

unread,
Mar 23, 2009, 10:53:41 AM3/23/09
to googl...@googlegroups.com
Certainly -- nothing will work with Guice 1.0

2009/3/23 Joakim Sjöberg <Joakim....@artificial-solutions.com>

Joakim Sjöberg

unread,
Mar 23, 2009, 12:11:11 PM3/23/09
to googl...@googlegroups.com

Hi I have now tried with 2.0 version and I am still getting the same error:

 

Found type 'DivTestInjector'

      Resolving annotation '@GinModules(DivTestModule.class)'

         [ERROR]

java.lang.ClassNotFoundException: org.gwt.client.gin.DivTestModule

        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)

        at java.security.AccessController.doPrivileged(Native Method)

        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)

 

Can anyone help me with this?

 

I have added the few java files I am using for my test, maybe I am doing something wrong?

gwt.zip

Joakim Sjöberg

unread,
Mar 24, 2009, 12:12:46 PM3/24/09
to googl...@googlegroups.com

Was there anyone who could help me with this issue? Since I’m totally stuck I really need some help J

 

// Joakim

Peter Schmitt

unread,
Mar 24, 2009, 6:14:12 PM3/24/09
to googl...@googlegroups.com
Hi Joakim,

I'm currently a bit short on time but I'll take a look.  A first glance didn't reveal any obvious problems.

Peter

2009/3/24 Joakim Sjöberg <Joakim....@artificial-solutions.com>

Peter Schmitt

unread,
Mar 24, 2009, 6:38:17 PM3/24/09
to googl...@googlegroups.com
Ok, I ran some more tests and it seems that you ran into a most weird bug (that I hadn't heard about before):  When I renamed your package from org.gwt to anything else (such as org.fooo or org.blaa) it compiles correctly.

Please try if that works for you and if this is the bug you're running into, please file it with the GWT issue tracker.

Hope this helps!

Peter

Joakim Sjöberg

unread,
Mar 25, 2009, 5:21:43 AM3/25/09
to googl...@googlegroups.com

Hi Peter!

 

I changed the name of my package to org.source, org.source.client and org.soruce.gin but I still get the same problem. Is there anything else I have to think of?

 

Thank you for all the help so far.

Peter Schmitt

unread,
Mar 25, 2009, 1:30:40 PM3/25/09
to googl...@googlegroups.com
Hi Joakim,

I'd say in that case your problem lies in the dependencies you use.  Take a look at rftgstats.googlecode.com for the jar files I used and the ant file I use for compilation (you can copy it and should only have to change the gwt.module property inside the file, provided your java lies in the folder src).

I'll probably prepare a tutorial and example for properly setting up a project with Gin in the future, but it might take a while.

Peter

2009/3/25 Joakim Sjöberg <Joakim....@artificial-solutions.com>

Joakim Sjöberg

unread,
Mar 26, 2009, 6:12:54 AM3/26/09
to googl...@googlegroups.com

´Hi Peter!

 

I took a look at this code but since I’m quite new to this I really don´t understand what to check for J
is there some way I can upload my whole project to you? Will that help? I use the same libraries now

as you do at least but no changes, still the same error.

 

Hope you can forgive me for all the questions, it just seems that I am so close to get this working, and

I really want it to work J

Joakim Sjöberg

unread,
Mar 26, 2009, 6:21:27 AM3/26/09
to googl...@googlegroups.com

Oh and I am using Netbeans and GWT 1.5.3 if that makes any difference.

Peter Schmitt

unread,
Mar 26, 2009, 1:12:29 PM3/26/09
to googl...@googlegroups.com
Hi Joakim,

I don't know how you compile your project and I think it shouldn't cause this error, but you might want to check whether you compile your client classes and provide the resulting files to the GWT compiler. I.e. for Gin to work, you need to do the following:

1. Compile your client package using javac (not GWTCompiler!), classpath must contain client source, gin, gwt-user.jar and guice.jar
2. Compile your client package using GWTCompiler, classpath must contain gwt-dev-*.jar, gwt-user.jar, gin, guice.jar, client source AND compiled classes from step 1.

Peter

2009/3/26 Joakim Sjöberg <Joakim....@artificial-solutions.com>
Reply all
Reply to author
Forward
0 new messages