Issue Details (XML | Word | Printable)

Key: RIO-272
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Dennis Reedy
Reporter: Dennis Reedy
Votes: 0
Watchers: 0
Operations

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

Unable to reload service that has a groovy configuration

Created: 06/Jul/10 11:39 PM   Updated: 06/Jul/10 11:56 PM
Component/s: Core, Deployment
Affects Version/s: 4.0
Fix Version/s: 4.1

Time Tracking:
Not Specified


 Description  « Hide
Start a cybernode & a monitor. Go to the examples/events directory and run mvn install -Dmaven.test.skip, then run mvn rio:deploy. Once deployed run mvn rio:undeploy.

Change a source file and rebuild. Then (re-)deploy (mvn rio:deploy). You will get the following:


SEVERE: Failed to load the ServiceBean [Hospital] classpath []
java.io.FileNotFoundException: JAR entry HospitalConfig.groovy not found in /Users/dreedy/.m2/repository/org/rioproject/examples/hospital/1.0/hospital-1.0.jar
at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:122)
at sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:132)
at java.net.URL.openStream(URL.java:1010)
at sun.reflect.GeneratedMethodAccessor154.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:229)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:121)
at org.rioproject.config.GroovyConfig.traverseInputs(GroovyConfig.groovy:92)
at org.rioproject.config.GroovyConfig$traverseInputs.callCurrent(Unknown Source)
at org.rioproject.config.GroovyConfig.<init>(GroovyConfig.groovy:57)
at sun.reflect.GeneratedConstructorAccessor50.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at net.jini.config.ConfigurationProvider.getInstance(ConfigurationProvider.java:236)
at org.rioproject.config.AggregateConfig.<init>(AggregateConfig.java:73)
at org.rioproject.jsb.JSBContext.getConfiguration(JSBContext.java:224)
at org.rioproject.cybernode.ServiceBeanLoader.load(ServiceBeanLoader.java:425)
at org.rioproject.cybernode.JSBDelegate$1.run(JSBDelegate.java:528)


 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Dennis Reedy added a comment - 06/Jul/10 11:54 PM
GroovyConfig was creating a URL to load the jar resource. It seems that the URL creates a connection that it caches. So when the jar gets changed and the Cybernode attempts to (re-)load the configuration file as a resource we get the FileNotFoundException: JAR entry .... raised.

In order to get around this behavior, GroovyConfig will no longer rely on creatin a URL and opening a connection to the URL to obtain the InputStream of the configuration to parse.

GroovyConfig will first check to see if the configuration file to be loaded is to be loaded from a jar:, if so, GroovyConfig uses the provided ClassLoader (if not provided the current thread's context ClassLoader), then gets the name of the resource to load. The resource to load will be of the form:

jar:file:/Users/dreedy/.m2/repository/org/rioproject/examples/hospital/1.0/hospital-1.0.jar!/DoctorConfig.groovy

where the resource is "DoctorConfig.groovy"

If the configuration does not start with "jar:", a configuration file (not a classpath resource) is assumed.