Announcement Announcement Module
Collapse
No announcement yet.
Cannot resolve domain classes & breakpoint issues Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cannot resolve domain classes & breakpoint issues

    I'm having two problems with STS running grails, posting them together because I think they could be interrelated.

    1. STS sometimes does not resolve domain classes. I get the typical red cross saying "Groovy:unable to resolve class ...", e.g. when working in a controller, although the domain classes and the controller are in the same package. The strange thing is that these errors disappear when I do the following: In the Project Properties, I add an arbitrary exclusion to the domain class source folder, e.g. "xyz". After leaving the dialog, the project refreshes and the errors are gone; then I can also remove the dummy filter again. Only when I start working in (i.e. editing) classes again (not only controllers but also test cases etc. which all share the same package), STS starts adding the cannot resolve errors within the classes I work on. I can also remove the errors by using the full package and class name, but I think that's not a clean solution for classes within one package.

    2. Although I've successfully set breakpoints already and executed grails in debug mode, I'm currently having problems again setting breakpoints in the right line. I double click on the left side of the editor window, but the breakpoint appears in another line than the one I was clicking at.

    Maybe those are both just symptoms of some deeper problems compiling my code in the background, however the grails application runs correctly and I think package and class namings are ok.

    Thanks in advance for any help, and P.S. grails rulez!
    Last edited by werner5471; May 26th, 2010, 07:12 AM. Reason: Heading

  • #2
    Hi,

    They both sound like underlying groovy-eclipse issues rather than grails issues. What version of Groovy-Eclipse are you on? Have you tried updating it?

    The latest snapshot dev builds for groovy-eclipse are here:

    http://dist.codehaus.org/groovy/dist...snapshot/e3.5/

    cheers,
    Andy
    ---
    Andy Clement
    SpringSource

    Comment


    • #3
      Re: STS & grails: Cannot resolve domain classes & breakpoint issues

      I had 2.0.2.20100520-2200-e35 installed and now updated to 2.0.2.20100525-1500-e35. Currently everything seems to work again, so I'll let you know when the problems occur again. Thanks for your support!

      Originally posted by Andy Clement View Post
      They both sound like underlying groovy-eclipse issues rather than grails issues. What version of Groovy-Eclipse are you on? Have you tried updating it?

      Comment


      • #4
        Re: Cannot resolve domain classes & breakpoint issues

        Now the errors are occuring again. I looked in the Error Log and found lots of entries called "Groovy bug when compiling". Here's an example:

        eclipse.buildId=2.3.2.201003230009-RELEASE
        java.version=1.6.0_18
        java.vendor=Sun Microsystems Inc.
        BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
        Framework arguments: -product com.springsource.sts.ide
        Command-line arguments: -os win32 -ws win32 -arch x86_64 -product com.springsource.sts.ide


        Error
        Fri May 28 12:03:21 CEST 2010
        Groovy bug when compiling.

        BUG! exception in phase 'semantic analysis' in source unit '/project/grails-app/controllers/com/project/ProjectUserController.groovy'
        at org.codehaus.groovy.control.CompilationUnit.applyT oSourceUnits(CompilationUnit.java:957)
        at org.codehaus.groovy.control.CompilationUnit.doPhas eOperation(CompilationUnit.java:580)
        at org.codehaus.groovy.control.CompilationUnit.proces sPhaseOperations(CompilationUnit.java:556)
        at org.codehaus.groovy.control.CompilationUnit.compil e(CompilationUnit.java:533)
        at org.codehaus.jdt.groovy.internal.compiler.ast.Groo vyCompilationUnitDeclaration.processToPhase(Groovy CompilationUnitDeclaration.java:161)
        at org.codehaus.jdt.groovy.internal.compiler.ast.Groo vyCompilationUnitDeclaration.generateCode(GroovyCo mpilationUnitDeclaration.java:1287)
        at org.eclipse.jdt.internal.compiler.Compiler.resolve (Compiler.java:967)
        at org.eclipse.jdt.internal.core.CompilationUnitProbl emFinder.process(CompilationUnitProblemFinder.java :190)
        at org.codehaus.jdt.groovy.model.GroovyCompilationUni t.buildStructure(GroovyCompilationUnit.java:358)
        at org.eclipse.jdt.internal.core.Openable.generateInf os(Openable.java:258)
        at org.eclipse.jdt.internal.core.JavaElement.openWhen Closed(JavaElement.java:515)
        at org.eclipse.jdt.internal.core.CompilationUnit.make Consistent(CompilationUnit.java:1096)
        at org.eclipse.jdt.internal.core.ReconcileWorkingCopy Operation.makeConsistent(ReconcileWorkingCopyOpera tion.java:170)
        at org.eclipse.jdt.internal.core.ReconcileWorkingCopy Operation.executeOperation(ReconcileWorkingCopyOpe ration.java:89)
        at org.eclipse.jdt.internal.core.JavaModelOperation.r un(JavaModelOperation.java:728)
        at org.eclipse.jdt.internal.core.JavaModelOperation.r unOperation(JavaModelOperation.java:788)
        at org.codehaus.jdt.groovy.model.GroovyCompilationUni t.reconcile(GroovyCompilationUnit.java:431)
        at org.eclipse.jdt.internal.ui.text.java.JavaReconcil ingStrategy.reconcile(JavaReconcilingStrategy.java :126)
        at org.eclipse.jdt.internal.ui.text.java.JavaReconcil ingStrategy.access$0(JavaReconcilingStrategy.java: 108)
        at org.eclipse.jdt.internal.ui.text.java.JavaReconcil ingStrategy$1.run(JavaReconcilingStrategy.java:89)
        at org.eclipse.core.runtime.SafeRunner.run(SafeRunner .java:42)
        at org.eclipse.jdt.internal.ui.text.java.JavaReconcil ingStrategy.reconcile(JavaReconcilingStrategy.java :87)
        at org.eclipse.jdt.internal.ui.text.java.JavaReconcil ingStrategy.reconcile(JavaReconcilingStrategy.java :151)
        at org.eclipse.jdt.internal.ui.text.CompositeReconcil ingStrategy.reconcile(CompositeReconcilingStrategy .java:86)
        at org.eclipse.jdt.internal.ui.text.JavaCompositeReco ncilingStrategy.reconcile(JavaCompositeReconciling Strategy.java:102)
        at org.eclipse.jface.text.reconciler.MonoReconciler.p rocess(MonoReconciler.java:77)
        at org.eclipse.jface.text.reconciler.AbstractReconcil er$BackgroundThread.run(AbstractReconciler.java:20 6)
        Caused by: org.eclipse.jdt.internal.compiler.problem.AbortCom pilation:
        at org.eclipse.jdt.internal.core.CancelableNameEnviro nment.checkCanceled(CancelableNameEnvironment.java :34)
        at org.eclipse.jdt.internal.core.CancelableNameEnviro nment.findType(CancelableNameEnvironment.java:44)
        at org.eclipse.jdt.internal.compiler.lookup.LookupEnv ironment.askForType(LookupEnvironment.java:130)
        at org.eclipse.jdt.internal.compiler.lookup.PackageBi nding.getTypeOrPackage(PackageBinding.java:183)
        at org.eclipse.jdt.internal.compiler.lookup.Scope.get Type(Scope.java:2395)
        at org.codehaus.jdt.groovy.internal.compiler.ast.Groo vyCompilationUnitScope.lookupClassNodeForSource(Gr oovyCompilationUnitScope.java:172)
        at org.codehaus.jdt.groovy.internal.compiler.ast.JDTR esolver.resolveFromCompileUnit(JDTResolver.java:14 5)
        at org.codehaus.groovy.control.ResolveVisitor.resolve NestedClass(ResolveVisitor.java:304)
        at org.codehaus.groovy.control.ResolveVisitor.resolve (ResolveVisitor.java:276)
        at org.codehaus.jdt.groovy.internal.compiler.ast.JDTR esolver.resolve(JDTResolver.java:260)
        at org.codehaus.groovy.control.ResolveVisitor.resolve (ResolveVisitor.java:243)
        at org.codehaus.groovy.control.ResolveVisitor.transfo rmVariableExpression(ResolveVisitor.java:984)
        at org.codehaus.groovy.control.ResolveVisitor.transfo rm(ResolveVisitor.java:754)
        at org.codehaus.groovy.control.ResolveVisitor.transfo rmPropertyExpression(ResolveVisitor.java:877)
        at org.codehaus.groovy.control.ResolveVisitor.transfo rm(ResolveVisitor.java:756)
        at org.codehaus.groovy.control.ResolveVisitor.transfo rmBinaryExpression(ResolveVisitor.java:1011)
        at org.codehaus.groovy.control.ResolveVisitor.transfo rm(ResolveVisitor.java:760)
        at org.codehaus.groovy.ast.expr.BooleanExpression.tra nsformExpression(BooleanExpression.java:44)
        at org.codehaus.groovy.control.ResolveVisitor.transfo rm(ResolveVisitor.java:771)
        at org.codehaus.groovy.ast.ClassCodeExpressionTransfo rmer.visitIfElse(ClassCodeExpressionTransformer.ja va:78)
        at org.codehaus.groovy.ast.stmt.IfStatement.visit(IfS tatement.java:41)
        at org.codehaus.groovy.ast.CodeVisitorSupport.visitBl ockStatement(CodeVisitorSupport.java:35)
        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.vi sitBlockStatement(ClassCodeVisitorSupport.java:176 )
        at org.codehaus.groovy.control.ResolveVisitor.visitBl ockStatement(ResolveVisitor.java:1360)
        at org.codehaus.groovy.ast.stmt.BlockStatement.visit( BlockStatement.java:51)
        at org.codehaus.groovy.ast.ClassCodeExpressionTransfo rmer.visitIfElse(ClassCodeExpressionTransformer.ja va:80)
        at org.codehaus.groovy.ast.stmt.IfStatement.visit(IfS tatement.java:41)
        at org.codehaus.groovy.ast.CodeVisitorSupport.visitBl ockStatement(CodeVisitorSupport.java:35)
        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.vi sitBlockStatement(ClassCodeVisitorSupport.java:176 )
        at org.codehaus.groovy.control.ResolveVisitor.visitBl ockStatement(ResolveVisitor.java:1360)
        at org.codehaus.groovy.ast.stmt.BlockStatement.visit( BlockStatement.java:51)
        at org.codehaus.groovy.control.ResolveVisitor.transfo rmClosureExpression(ResolveVisitor.java:1088)
        at org.codehaus.groovy.control.ResolveVisitor.transfo rm(ResolveVisitor.java:764)
        at org.codehaus.groovy.ast.ClassCodeExpressionTransfo rmer.visitField(ClassCodeExpressionTransformer.jav a:65)
        at org.codehaus.groovy.control.ResolveVisitor.visitFi eld(ResolveVisitor.java:184)
        at org.codehaus.groovy.ast.ClassNode.visitContents(Cl assNode.java:1084)
        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.vi sitClass(ClassCodeVisitorSupport.java:51)
        at org.codehaus.groovy.control.ResolveVisitor.visitCl ass(ResolveVisitor.java:1300)
        at org.codehaus.groovy.control.ResolveVisitor.startRe solving(ResolveVisitor.java:150)
        at org.codehaus.jdt.groovy.internal.compiler.ast.JDTR esolver.startResolving(JDTResolver.java:571)
        at org.codehaus.groovy.control.CompilationUnit$1.call (CompilationUnit.java:689)
        at org.codehaus.groovy.control.CompilationUnit.applyT oSourceUnits(CompilationUnit.java:948)
        ... 26 more

        Comment


        • #5
          So you are back to the original problem of unable to find class for a domain class from a controller? Can you share a small project with me that shows the problem?

          Exceptions like the one you showed there are usually nothing to worry about. AbortCompilations are normal when working with eclipse, they indicate in the middle of doing something, you did something else that made the original activity irrelevant so an Abort is thrown to cancel the original activity. For example, if we started reconciling a file, then you started typing again, the original reconcile isn't much use so is stopped with an Abort. We *should* stop logging those things as they tend to cause worry...

          Andy

          Comment


          • #6
            Re: Cannot resolve domain classes & breakpoint issues

            Ok then I'll ignore those errors in the future... however yes, I'm again having the problem about unresolved domain classes, this time in a functional test I'm working in (also the same package). I also saw two other errors, maybe they are related to this - see one of them below.

            If not, I'll try if the error occurs also when creating a small new project and let you know!

            --- StructuredTextViewer.exception.verifyText ---

            eclipse.buildId=2.3.2.201003230009-RELEASE
            java.version=1.6.0_18
            java.vendor=Sun Microsystems Inc.
            BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
            Framework arguments: -product com.springsource.sts.ide
            Command-line arguments: -os win32 -ws win32 -arch x86_64 -product com.springsource.sts.ide


            Error
            Fri May 28 16:33:06 CEST 2010
            StructuredTextViewer.exception.verifyText

            java.lang.NullPointerException
            at org.codehaus.groovy.eclipse.refactoring.formatter. JavaProjectPreferences.refresh(JavaProjectPreferen ces.java:46)
            at org.codehaus.groovy.eclipse.refactoring.formatter. JavaProjectPreferences.<init>(JavaProjectPreferenc es.java:51)
            at org.codehaus.groovy.eclipse.refactoring.formatter. FormatterPreferences.preferencesFor(FormatterPrefe rences.java:53)
            at org.codehaus.groovy.eclipse.refactoring.formatter. FormatterPreferences.<init>(FormatterPreferences.j ava:45)
            at org.codehaus.groovy.eclipse.editor.GroovyAutoInden tStrategy.customizeDocumentCommand(GroovyAutoInden tStrategy.java:122)
            at org.eclipse.jface.text.TextViewer.customizeDocumen tCommand(TextViewer.java:3734)
            at org.eclipse.jface.text.TextViewer.handleVerifyEven t(TextViewer.java:3764)
            at org.eclipse.jface.text.source.projection.Projectio nViewer.handleVerifyEvent(ProjectionViewer.java:12 76)
            at org.eclipse.wst.sse.ui.internal.StructuredTextView er.handleVerifyEvent(StructuredTextViewer.java:706 )
            at org.eclipse.jface.text.TextViewer$TextVerifyListen er.verifyText(TextViewer.java:433)
            at org.eclipse.swt.widgets.TypedListener.handleEvent( TypedListener.java:249)
            at org.eclipse.swt.widgets.EventTable.sendEvent(Event Table.java:84)
            at org.eclipse.swt.widgets.Widget.sendEvent(Widget.ja va:1003)
            at org.eclipse.swt.widgets.Widget.sendEvent(Widget.ja va:1027)
            at org.eclipse.swt.widgets.Widget.sendEvent(Widget.ja va:1012)
            at org.eclipse.swt.widgets.Widget.notifyListeners(Wid get.java:770)
            at org.eclipse.swt.custom.StyledText.modifyContent(St yledText.java:6605)
            at org.eclipse.swt.custom.StyledText.sendKeyEvent(Sty ledText.java:7446)
            at org.eclipse.swt.custom.StyledText.doContent(Styled Text.java:2442)
            at org.eclipse.swt.custom.StyledText.handleKey(Styled Text.java:5817)
            at org.eclipse.swt.custom.StyledText.handleKeyDown(St yledText.java:5842)
            at org.eclipse.swt.custom.StyledText$7.handleEvent(St yledText.java:5542)
            at org.eclipse.swt.widgets.EventTable.sendEvent(Event Table.java:84)
            at org.eclipse.swt.widgets.Widget.sendEvent(Widget.ja va:1003)
            at org.eclipse.swt.widgets.Widget.sendEvent(Widget.ja va:1027)
            at org.eclipse.swt.widgets.Widget.sendEvent(Widget.ja va:1012)
            at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget .java:1040)
            at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget .java:1036)
            at org.eclipse.swt.widgets.Widget.wmChar(Widget.java: 1368)
            at org.eclipse.swt.widgets.Control.WM_CHAR(Control.ja va:4053)
            at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java :346)
            at org.eclipse.swt.widgets.Control.windowProc(Control .java:3946)
            at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.j ava:342)
            at org.eclipse.swt.widgets.Display.windowProc(Display .java:4619)
            at org.eclipse.swt.internal.win32.OS.DispatchMessageW (Native Method)
            at org.eclipse.swt.internal.win32.OS.DispatchMessage( OS.java:2411)
            at org.eclipse.swt.widgets.Display.readAndDispatch(Di splay.java:3501)
            at org.eclipse.ui.internal.Workbench.runEventLoop(Wor kbench.java:2405)
            at org.eclipse.ui.internal.Workbench.runUI(Workbench. java:2369)
            at org.eclipse.ui.internal.Workbench.access$4(Workben ch.java:2221)
            at org.eclipse.ui.internal.Workbench$5.run(Workbench. java:500)
            at org.eclipse.core.databinding.observable.Realm.runW ithDefault(Realm.java:332)
            at org.eclipse.ui.internal.Workbench.createAndRunWork bench(Workbench.java:493)
            at org.eclipse.ui.PlatformUI.createAndRunWorkbench(Pl atformUI.java:149)
            at org.eclipse.ui.internal.ide.application.IDEApplica tion.start(IDEApplication.java:113)
            at org.eclipse.equinox.internal.app.EclipseAppHandle. run(EclipseAppHandle.java:194)
            at org.eclipse.core.runtime.internal.adaptor.EclipseA ppLauncher.runApplication(EclipseAppLauncher.java: 110)
            at org.eclipse.core.runtime.internal.adaptor.EclipseA ppLauncher.start(EclipseAppLauncher.java:79)
            at org.eclipse.core.runtime.adaptor.EclipseStarter.ru n(EclipseStarter.java:368)
            at org.eclipse.core.runtime.adaptor.EclipseStarter.ru n(EclipseStarter.java:179)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.eclipse.equinox.launcher.Main.invokeFramework( Main.java:559)
            at org.eclipse.equinox.launcher.Main.basicRun(Main.ja va:514)
            at org.eclipse.equinox.launcher.Main.run(Main.java:13 11)
            at org.eclipse.equinox.launcher.Main.main(Main.java:1 287)

            Comment


            • #7
              Hi Werner,

              The Null pointer exception log entry you posted seems to show that a project reference is null when trying to get preferences for a project, while typing in a Groovy editor.

              I don't know why this would happen, since I expect that the groovy file is in a Java/Groovy/Grails project, so it should have Java nature and should have an IJavaProject associated with it.

              I've opened a Jira issue for this and will look into it further.

              http://jira.codehaus.org/browse/GRECLIPSE-760

              Kris

              Comment

              Working...
              X