getting "cannot be resolved to type" error

49 views
Skip to first unread message

Karan

unread,
Sep 3, 2010, 1:29:27 PM9/3/10
to play-framework
Hey guys, i'm trying to import a class from another java project, and
invoke it with a play job.

Getting the following error:
The file /app/jobs/EventsUpdateJob.java could not be compiled. Error
raised is : updaters.MYPACKAGE.CalendarUpdater cannot be resolved

CalendarUpdater is on my build path, and Eclipse is not showing any
problems with it. Any ideas? Thanks.

Karan

unread,
Sep 3, 2010, 1:40:17 PM9/3/10
to play-framework
Just some more information, here's the exception on the console:

play.exceptions.JavaCompilationException: Only a type can be imported.
updaters.MYPACKAGE.CalendarUpdater resolves to a package
at play.classloading.ApplicationCompiler$2.acceptResult(ApplicationCompiler.java:240)
at org.eclipse.jdt.internal.compiler.Compiler.handleInternalException(Compiler.java:551)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:409)
at play.classloading.ApplicationCompiler.compile(ApplicationCompiler.java:271)
at play.classloading.ApplicationClassloader.getAllClasses(ApplicationClassloader.java:373)
at play.Play.start(Play.java:374)
at play.Play.detectChanges(Play.java:492)
at play.Invoker$Invocation.init(Invoker.java:98)
at Invocation.HTTP Request(Play!)

It's not a package, it's a class...

tartur

unread,
Sep 3, 2010, 5:32:48 PM9/3/10
to play-framework
did you try to put your dependency jar into the lib directory?
I don't think Play! supports projects as dependencies, I think you
should use either jars or Play! modules.
Play! automatically detects the jars in the lib directory and add them
to the application classpath. However, this may require you to run
eclipsify again.

On Sep 3, 7:40 pm, Karan <karan.bhan...@gmail.com> wrote:
> Just some more information, here's the exception on the console:
>
> play.exceptions.JavaCompilationException: Only a type can be imported.
> updaters.MYPACKAGE.CalendarUpdater resolves to a package
>         at play.classloading.ApplicationCompiler$2.acceptResult(ApplicationCompiler.ja va:240)
>         at org.eclipse.jdt.internal.compiler.Compiler.handleInternalException(Compiler .java:551)
>         at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:409)
>         at play.classloading.ApplicationCompiler.compile(ApplicationCompiler.java:271)
>         at play.classloading.ApplicationClassloader.getAllClasses(ApplicationClassload er.java:373)

Karan

unread,
Sep 3, 2010, 7:18:58 PM9/3/10
to play-framework
I already also tried compiling my project and putting it in the lib
folder, and then running eclipsify. still no luck.

GrailsDeveloper

unread,
Sep 4, 2010, 3:48:59 AM9/4/10
to play-framework
Hi the eclipsify command is only to set the classpath correctly in
eclipse.
I would recommend the following:
1. Make sure your project doesn't referring another eclispe-project.
2. Create a jar and put it into the lib dir.
3. Add the jar to the classpath (manually or be eclipsify)
4. Rebuild the project and look if there are no compile errors in
eclipse.
5. Start play with play run and check if the error still happens.

If the error still happens, try to create an minimal example app,
which shows the error and publish it.

Niels

Karan

unread,
Sep 5, 2010, 3:18:24 AM9/5/10
to play-framework
Hey, I started from scratch and the problem seems to have been
resolved. I might have had some conflicts from when I was playing
around with stuff, trying to get it to work.

On Sep 4, 3:48 am, GrailsDeveloper <opensourc...@googlemail.com>
wrote:
Reply all
Reply to author
Forward
0 new messages