History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: GRAILS-1786
Type: Bug Bug
Status: Closed Closed
Resolution: Won't Fix
Priority: Blocker Blocker
Assignee: Graeme Rocher
Reporter: John Allison
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Grails

unable to resolve class in src/java

Created: 05/Nov/07 01:08 PM   Updated: 15/Nov/07 10:59 AM
Component/s: None
Affects Version/s: 1.0-RC2
Fix Version/s: 1.0-RC2

Time Tracking:
Not Specified

File Attachments: 1. Zip Archive jja-bug-report-13112007.zip (12 kb)
2. Text File myout.txt (6 kb)



 Description  « Hide
GRAILS-295 has returned (never went away?). 0.5.6 seems to work but 1.0 does not. Here is a contrived simple example (of course this also happens with more interesting classes).

grails create-app

cat > src/java/jja/MyStuff.java
public class Foobar {
public Foobar() {}
}

cat > grails-app/controllers/FooController.groovy
import jja.Foobar
class FooController {
def index = {
def fb = new jja.Foobar()
}
}

grails compile
Compilation error: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, /usr/local/users/jja/grails/jjj/grails-app/controllers/FooController.groovy: 1: unable to resolve class jja.Foobar
@ line 1, column 1.
import jja.Foobar
^
/usr/local/users/jja/grails/jjj/grails-app/controllers/FooController.groovy: 4: unable to resolve class jja.Foobar
@ line 4, column 10.
def fb = new jja.Foobar()
^

2 errors

rm grails-app/controllers/FooController.groovy
cat > src/groovy/Goo.groovy
import jja.Foobar
class Goo {
jja.Foobar fb
}

grails compile
Compilation error: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, /usr/local/users/jja/grails/jjj/src/groovy/Goo.groovy: 1: unable to resolve class jja.Foobar
@ line 1, column 1.
import jja.Foobar
^
/usr/local/users/jja/grails/jjj/src/groovy/Goo.groovy: 3: unable to resolve class jja.Foobar
@ line 3, column 12.
jja.Foobar fb
^
/usr/local/users/jja/grails/jjj/src/groovy/Goo.groovy: 3: unable to resolve class jja.Foobar
@ line 3, column 12.
jja.Foobar fb
^

3 errors



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
John Allison - 09/Nov/07 12:51 PM
Above, "MyStuff.java" should of course say "Foobar.java", and no that's not the problem. Also, putting a "package" spec in the .java doesn't help (my real classes have them, I was trying to follow 295 which left it out) but javac is never invoked anyways:

In 0.5.6, I get this:

Running script /mnt/local/apps/grails/scripts/Compile.groovy
Compiling sources ...
[javac] Compiling 2 source files to /usr/local/users/jja/grails/jkl/web-app/WEB-INF/classes

and the classes do indeed show up.

In 1.0, javac is never called, and I get this before the compilation errors in the original report:

Running script /mnt/local/apps/grails/scripts/Compile.groovy
[mkdir] Created dir: /h/eol/jja/.grails/1.0-RC2-SNAPSHOT/projects/jjj/classes
Compiling 8 source files to /h/eol/jja/.grails/1.0-RC2-SNAPSHOT/projects/jjj/classes
error: error reading /mnt/local/apps/grails/lib/readme.txt; error in opening zip file
1 error

Further, as suggested on the users mailing list, I tried "grails clean" first but that doesn't help. In 1.0, there are never any classes put in ~/.grails or web-app/WEB-INF/classes.


Graeme Rocher - 13/Nov/07 04:37 AM
I have tried following your steps, but cannot reproduce, everything compiles fine for me. Please could you attach a sample app that reproduces the problem

John Allison - 13/Nov/07 11:50 AM
Here's a "grails bug-report"

John Allison - 13/Nov/07 11:50 AM
Here's the terminal scrape of the failure

John Allison - 13/Nov/07 11:51 AM
Here's the terminal scrape of the failure

John Allison - 13/Nov/07 11:55 AM
Here's the "grails bug-report"
(sorry about the previous version, I flubbed a filename and got an unrelated error)

John Allison - 13/Nov/07 11:55 AM
Here's the terminal scrape of the failure

John Allison - 13/Nov/07 12:16 PM
Sorry for the spurious attachments.

I am using Grails 1.0-RC2-SNAPSHOT from Oct 24.

I was originally using Groovy 1.0 but as you can see in my terminal scrape, I have the same problems when using Groovy 1.1-rc-1 (the same version as the jar in Grails).

Grails 0.5.6 works fine (in a separate new project).

Thanks for your attention.


Graeme Rocher - 14/Nov/07 04:01 AM
Your attached bug report compiles fine for me on Mac OS X, so it looks like it may be a platform specific problem. What OS are you running?

John Allison - 14/Nov/07 12:40 PM
I am trying this on various Linuxes, most notably

uname -a
Linux remus 2.6.9-55.0.12.EL #1 Wed Oct 17 08:06:32 EDT 2007 i686 i686 i386 GNU/Linux

/etc/redhat-release
Red Hat Enterprise Linux WS release 4 (Nahant Update 5)

java -version
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)

ant -version
Apache Ant version 1.7.0 compiled on December 13 2006

I just tried JDK 6 and it compiles! I guess I should have tried that right off, but with the previous bug report I didn't think about it. So future Linux users finding this, try a newer Java:

java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)

Thanks for your help, Graeme; sorry to waste your time.


John Allison - 14/Nov/07 12:52 PM
After my last comment, a message came on the users list that reminded me I've been seeing this doing almost anything in grails:

error: error reading /mnt/local/apps/grails/lib/readme.txt; error in opening zip file

Apparently that was coming from javac. Removing readme.txt from the Grails installation allows Java 1.5 to work, too. Java 1.6 I guess just silently ignores it.

Please (re)move lib/readme.txt from the Grails distribution, thanks!


Graeme Rocher - 15/Nov/07 10:59 AM
the readme.txt has already been removed. closing issue