Strange output in log when modyfying coffee resource during runtime #7

Closed
martindobias opened this Issue Mar 7, 2013 · 21 comments

Projects

None yet

3 participants

@martindobias

I am having this very strange output for some time. Although it says an error occured, my resources get compiled and reloaded into application properly.

It is only happening when the app is running and I update the original coffee file.

Application works but there might be something wrong, so if you could check on that, I would appreciate it. Thanks

The error has actually two steps:

By modyfing the coffee file, this is printed

grails> 2013-03-07 22:15:56,798 [Thread-10] INFO  compiler.CoffeeCompiler  - Compiling  ...\src\coffee\user_index.coffee to ...\web-app\cs\user_index.js

| Error 2013-03-07 22:15:57,110 [main] ERROR util.ProxyFactory  - exception
Message: interface ro.isdc.wro.config.ReadOnlyContext is not visible from class loader
   Line | Method
->>  73 | create                     in ro.isdc.wro.util.ProxyFactory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|    49 | proxy                      in     ''
|   272 | createReadOnlyContextProxy in ro.isdc.wro.model.group.processor.InjectorBuilder
|   126 | initMap                    in     ''
|   290 | build . . . . . . . . . .  in     ''
|    65 | compileFile                in org.grails.plugins.coffee.compiler.CoffeeCompiler
|    67 | compileFileFromConfig . .  in org.grails.plugins.coffee.compiler.CoffeeCompilerManager
|   102 | doCall                     in CoffeescriptCompilerGrailsPlugin$_closure2
|    80 | run . . . . . . . . . . .  in org.grails.plugins.tomcat.fork.ForkedTomcatServer
^    56 | main                       in     ''
| Error 2013-03-07 22:15:57,389 [main] ERROR compiler.CoffeeCompiler  - Generic Exception: interface ro.isdc.wro.config.ReadOnlyContext is not visible from class loader in ...\src\coffee\user_index.coffee
| Error 2013-03-07 22:15:57,436 [main] ERROR plugins.AbstractGrailsPluginManager  - Plugin [coffeescriptCompiler:0.9] could not reload changes to file [...\src\coffee\user_index.coffee]: interface ro.isdc.wro.config.ReadOnlyContext is not visible from class loader
Message: interface ro.isdc.wro.config.ReadOnlyContext is not visible from class loader
   Line | Method
->>  87 | compileFile           in org.grails.plugins.coffee.compiler.CoffeeCompiler
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|    67 | compileFileFromConfig in org.grails.plugins.coffee.compiler.CoffeeCompilerManager
|   102 | doCall . . . . . . .  in CoffeescriptCompilerGrailsPlugin$_closure2
|    80 | run                   in org.grails.plugins.tomcat.fork.ForkedTomcatServer
^    56 | main . . . . . . . .  in     ''
Caused by IllegalArgumentException: interface ro.isdc.wro.config.ReadOnlyContext is not visible from class loader
->>  73 | create                in ro.isdc.wro.util.ProxyFactory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|    49 | proxy                 in     ''
|   272 | createReadOnlyContextProxy in ro.isdc.wro.model.group.processor.InjectorBuilder
|   126 | initMap               in     ''
|   290 | build . . . . . . . . in     ''
|    65 | compileFile           in org.grails.plugins.coffee.compiler.CoffeeCompiler
|    67 | compileFileFromConfig in org.grails.plugins.coffee.compiler.CoffeeCompilerManager
|   102 | doCall                in CoffeescriptCompilerGrailsPlugin$_closure2
|    80 | run . . . . . . . . . in org.grails.plugins.tomcat.fork.ForkedTomcatServer
^    56 | main                  in     ''

This is immediately followed by NullPointerException.
Actually I can get this very same exception if I do modify the compiled js files manually:

Resource reload failed!:
java.lang.NullPointerException: Cannot get property 'grailsResourceProcessor' on null object
        at org.codehaus.groovy.runtime.NullObject.getProperty(NullObject.java:56)
        at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:169)
        at org.codehaus.groovy.runtime.callsite.NullCallSite.getProperty(NullCallSite.java:44)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:227)
        at ResourcesGrailsPlugin$_closure4_closure20.doCall(ResourcesGrailsPlugin.groovy:212)
        at ResourcesGrailsPlugin$_closure4_closure20.doCall(ResourcesGrailsPlugin.groovy)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1243)
        at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:272)
        at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:64)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
        at ResourcesGrailsPlugin$_triggerReload_closure7.doCall(ResourcesGrailsPlugin.groovy:199)
        at ResourcesGrailsPlugin$_triggerReload_closure7.doCall(ResourcesGrailsPlugin.groovy)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1243)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1076)
        at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:906)
        at groovy.lang.Closure.call(Closure.java:415)
        at ResourcesGrailsPlugin$_triggerReload_closure7.call(ResourcesGrailsPlugin.groovy)
        at groovy.lang.Closure.call(Closure.java:409)
        at ResourcesGrailsPlugin$_triggerReload_closure7.call(ResourcesGrailsPlugin.groovy)
        at groovy.lang.Closure.run(Closure.java:493)
        at ResourcesGrailsPlugin$_triggerReload_closure7.run(ResourcesGrailsPlugin.groovy)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)

Thanks for any help or idea how to fix.
I will try to put the NullPointerException as an issue to resources plugin to see if there is not anything wrong

@brian428
Owner
brian428 commented Mar 7, 2013

Hmm...I've never seen this, and obviously modify my .coffee files while the app is running all the time. Do you see this EVERY time you edit a file while the app is running? Or is it only specific files?

@martindobias

I am getting the first part of the issue just when modifying coffee files, but always.
I haven't trying to do anything with it as the app is running and working and I got other issues to solve first.

The other part (NullPointerException) appears to me also when modifying the compiled .js files.
I have tested now for other resources (html) as well and it seems it is more generic. I have opened an issue on resources plugin as well.

@brian428
Owner

Just checking back to see if you ever found out what the issue here was? Was it related to the resources plugin? My guess is that it has to be, since I use this CS compiler plugin all the time and don't have any problems, but then I also don't do much with the resources plugin...

@martindobias

Unfortunatelly not. The guys at resources plugin were not able to reproduce the issue. It seems to be specific to my configuration. I really do not know what is going on there.
So far I have managed to live with it, no direct consequences visible.
I will close this issue as it seems to be only my local problem.

@brian428
Owner

Also, might be a dumb question, but are you using latest (0.9.2)?

@rosenfeld

I'm experiencing this same issue and I think we should reopen this ticket. Maybe this is related to this plugin somehow...

@rosenfeld

I don't get the first issue though, just the last one

@brian428
Owner
brian428 commented Jul 5, 2013

I'll re-open it for now, but I'll need some sort of reproducible test case, ideally a pull request with a unit test that shows the issue, or a very simple test app. Exact versions of Grails, Groovy, and plugin versions would also help.

Are you using the resources plugin in conjunction with your CS or the generated JS? I'm still thinking it has to do with the resources plugin, because again, I use this plugin all the time and have never seen this.

@brian428 brian428 reopened this Jul 5, 2013
@rosenfeld

I didn't use to experience this problem but after upgrading to 2.3.0.M2 this started to happen.

I also believe this is a bug in the resources plugin, but since the only people reporting this issue are using your plugin, I can't be sure...

I use your plugin to generate the JS files under web-app/js/coffee-generated, which will then trigger a reload event in the resources plugin...

Your plugin does however generate the JS files correctly upon changes in the CoffeeScript file, that's why I believe this is a bug in the resources plugin only, but I just suggested to keep this ticket open to increase its visibility until we can find some sample application to create a new JIRA since this one has been closed:

http://jira.grails.org/browse/GPRESOURCES-209

@rosenfeld

I should notice I'm also using resources 1.2 and coffeescript-compiler 0.6

@rosenfeld

I've upgraded coffeescript-compiler to 0.9.2 and it works on 2.2.3 but I get this error with Grails 2.3.0.M2

@rosenfeld

java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

@brian428
Owner
brian428 commented Aug 1, 2013

If it works on 2.2.3 but not 2.3.0, it seems like it has to be an issue with the resources plugin that is now apparently gone? I guess I'll go ahead and close this again. Let me know if it rears its head again. Thanks.

@brian428 brian428 closed this Aug 1, 2013
@rosenfeld

Now that 2.3.0 is released I think you should consider reopen and fix this issue...

@brian428
Owner
brian428 commented Oct 2, 2013

I think I've tracked down the source of the issue. It looks like the runtime resource change now fires off a new thread, and some of the Wro4J classes aren't included in the Thread classpath.

I think that helps narrow down the cause, but I honestly have no idea what to do about it. I'll see what I can figure out.

@brian428 brian428 reopened this Oct 2, 2013
@brian428 brian428 added a commit that closed this issue Oct 2, 2013
@brian428 Update to 0.9.4. Fixes #7. Adds a missing dependency from the Wro4j l…
…ibrary that affected Grails 2.2+; ensures Thread classpath includes necessary classes; removes Tomcat plugin.
5167f5e
@brian428 brian428 closed this in 5167f5e Oct 2, 2013
@rosenfeld

thanks

@brian428
Owner
brian428 commented Oct 2, 2013

If you can, let me know if updating fixes the problem for you as well.

@brian428
Owner
brian428 commented Oct 2, 2013

Also, note the new section of the Readme titled "Special Note for Grails 2.2.x and Up, When Resources Plugin Is Used".

@rosenfeld

I'm afraid I won't be able to test it soon. I recently stopped using this plugin in favor of a custom background job which will compile not only CoffeeScript, but also ECO templates and SASS. Since I'm short in time with my current backlog, it may take a while before I can test the new version to let you know.

@rosenfeld

Also, I don't have the option to remove the resources plugin since all my dependencies are managed by the resources plugin.

@brian428
Owner

FYI, looks like this was indeed a bug in the Grails core. Burt just pushed a fix so I assume it'll be included in the next dot release of Grails. grails/grails-core@280fa80

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment