Note, I did make a change to the way the ComponentType sidefile was done as the code I'd pointed you to in the JavaScript container for this was a bit out of date. Any chance you'd be interested in submitting another fix for the JavaScript container to do this properly?
...ant On 1/13/07, ant elder <[EMAIL PROTECTED]> wrote:
Thanks very much for this, I've committed these changes. I added a JIRA component for this that you mentioned was missing. It maybe worth reviewing the components and consolidating some into a more generic scripting or container extension component. ...ant On 1/13/07, lee zhenghui <[EMAIL PROTECTED]> wrote: > > hi,ant elder > I have opened JIRA TUSCANY-1051 to trace this issue, and also > attached > the patch and helloworld sample(I have added ASF copyright in the sample > code) there. if you have time, could you review them, anything > incorrect, > pls feel free to let me know. thanks in advance. > By the way, I have run all existing UT cases, all of them passed. > For your convenience, i am listing the updated code here: > 1.ImplementationLoader.java : add two fields with getter/setters. > applicationLoader, this will be used for construct > GroovyClassloader > scriptResourceName, this is script resource name, will be > used > for generate side file name (componentType) > 2. ImplementationLoader.loader() > add following statement: > implementation.setApplicationLoader( > deploymentContext.getClassLoader()); > implementation.setScriptResourceName (script); > 3. GroovyComponentBuilder.build > groovyClassLoader = new GroovyClassLoader( > implementation.getApplicationLoader()); > 4. GroovyComponentType.java > Adding two constructor method , it is similar with what > did > in javaScriptComponentType > 5. GroovyComponentTypeLoader.java > adding sild file(ComponentType) support, just like what we > have > in JavaScript. > TODO: i did not implement "loadFromIntrospection" now, I am > not > sure whether it will use the same logic as javaScript. So mark it as > TODO > section in this patch now. > 6. GroovyComponentTypeLoaderTestCase > enhancement due to corresponding modification above. > > One quick question is, During opening JIRA , I can not found Groovy > component in the list, maybe it belong to antoher component, but I did > not > know, who can tell me which component does Groovy container belong to in > > JIRA system? > > On 1/12/07, ant elder <[EMAIL PROTECTED]> wrote: > > > > Thats wonderful! > > > > Could you attach it to a new JIRA instead of the wiki? The Tuscany > JIRA > > system is at: http://issues.apache.org/jira/browse/TUScany. If you > don't > > already have a JIRA account you'll have to create yourself one before > you > > can open a new JIRA. > > > > Thanks, > > > > ...ant > > > > On 1/12/07, lee zhenghui <[EMAIL PROTECTED] > wrote: > > > > > > hi, ant.elder > > > Thanks for your advices, I have fixed the issue(both > > GroovyClassloader > > > and initializing the Scope issues ), for now, my helloworld samle > works > > > fine. For safe, I will double check the patch and sample. and Will > > > post them on wiki several hours later. also I will provide my > detailed > > > modification here too. > > > By the way, I am really happy to have chance to do something > for > > SCA. > > > I > > > like it very much.. :-) > > > > > > > > > On 1/12/07, ant elder <[EMAIL PROTECTED]> wrote: > > > > > > > > Hey its great to hear you're writing a groovy sample, would you > > > contribute > > > > it back to Tuscany to include in our samples? > > > > > > > > I think you're correct, the classloader is not being initialized > > > > correctly. > > > > In the GroovyComponentBuilder the ClassLoader from the > > DeploymentContext > > > > is > > > > the wrong one to be using, its null as you've seen. It really > wants > > the > > > > application ClassLoader which is available in the > DeploymentContext > > > passed > > > > into the load method of the ImplementationLoader class in the > Groovy > > > > package. I think what needs to happen is GroovyImplementation > should > > > have > > > > a > > > > ClassLoader field added with getter/setters, the > > > > ImplementationLoader.loadmethod should set the Classloader on the > > > > GroovyImplementation from the > > > > DeploymentContext, then the GroovyComponentBuilder should create > the > > > > GroovyClassLoader using the ClassLoader from the > > > > GroovyImplementation (the > > > > implementation variable) instead of the DeploymentContext. > > > > > > > > You can see all that being done if you look at the Tuscany > JavaScript > > > > container. > > > > > > > > Does this make sense to you? Would you be interested in submitting > a > > > patch > > > > for this? Say if you'd prefer to be just be using Groovy and I'll > fix > > > this > > > > for you right away. > > > > > > > > ...ant > > > > > > > > PS. Note, i think there's another problem you'll hit after fixing > this > > > > > > which > > > > is the GroovyComponentType is not initializing the Scope > correctly. > > This > > > > could be done in a a default constructor just as the > > > > JavaScriptComponentType > > > > does. > > > > > > > > On 1/12/07, lee zhenghui < [EMAIL PROTECTED]> wrote: > > > > > > > > > > hi, > > > > > I am writing a helloworld sample for sca groovy service, but > > > > > encountered > > > > > a problem here: > > > > > > > > > > java.lang.NoClassDefFoundError: groovy/lang/GroovyObject > > > > > at java.lang.ClassLoader.defineClass1 (Native Method) > > > > > at java.lang.ClassLoader.defineClass (ClassLoader.java:620) > > > > > at java.security.SecureClassLoader.defineClass( > > > > SecureClassLoader.java > > > > > :124) > > > > > at groovy.lang.GroovyClassLoader.access$300 ( > > GroovyClassLoader.java > > > > :92) > > > > > at groovy.lang.GroovyClassLoader$ClassCollector.createClass( > > > > > GroovyClassLoader.java :457) > > > > > at groovy.lang.GroovyClassLoader$ClassCollector.onClassNode( > > > > > GroovyClassLoader.java:475) > > > > > at groovy.lang.GroovyClassLoader$ClassCollector.call( > > > > > GroovyClassLoader.java :479) > > > > > at org.codehaus.groovy.control.CompilationUnit$9.call( > > > > > CompilationUnit.java:757) > > > > > at > > > > > > org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes ( > > > > > CompilationUnit.java:947) > > > > > at org.codehaus.groovy.control.CompilationUnit.compile( > > > > > CompilationUnit.java:478) > > > > > at groovy.lang.GroovyClassLoader.parseClass ( > > GroovyClassLoader.java > > > > > :306) > > > > > at groovy.lang.GroovyClassLoader.parseClass( > > GroovyClassLoader.java > > > > > :275) > > > > > at groovy.lang.GroovyClassLoader.parseClass ( > > GroovyClassLoader.java > > > > > :270) > > > > > at groovy.lang.GroovyClassLoader.parseClass( > > GroovyClassLoader.java > > > > > :242) > > > > > at > > > org.apache.tuscany.container.groovy.GroovyComponentBuilder.build ( > > > > > GroovyComponentBuilder.java:80) > > > > > at org.apache.tuscany.core.builder.BuilderRegistryImpl.build( > > > > > BuilderRegistryImpl.java:106) > > > > > at > > > > > > > > > org.apache.tuscany.core.implementation.composite.CompositeBuilder.build( > > > > > CompositeBuilder.java :56) > > > > > at org.apache.tuscany.core.builder.BuilderRegistryImpl.build > ( > > > > > BuilderRegistryImpl.java:106) > > > > > at org.apache.tuscany.core.deployer.DeployerImpl.build ( > > > > > DeployerImpl.java > > > > > :142) > > > > > at org.apache.tuscany.core.deployer.DeployerImpl.deploy ( > > > > > DeployerImpl.java:97) > > > > > at > org.apache.tuscany.core.launcher.LauncherImpl.bootApplication > > ( > > > > > LauncherImpl.java:215) > > > > > at org.apache.tuscany.test.SCATestCase.setUp ( > SCATestCase.java > > :88) > > > > > at test.tuscany.groovy.HelloWorldTest.setUp( > HelloWorldTest.java > > > :35) > > > > > at junit.framework.TestCase.runBare(TestCase.java:125) > > > > > at junit.framework.TestResult$1.protect (TestResult.java > :106) > > > > > at junit.framework.TestResult.runProtected(TestResult.java > :124) > > > > > at junit.framework.TestResult.run(TestResult.java:109) > > > > > at junit.framework.TestCase.run(TestCase.java:118) > > > > > at junit.framework.TestSuite.runTest(TestSuite.java:208) > > > > > at junit.framework.TestSuite.run(TestSuite.java:203) > > > > > at > > > > > > org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run > > ( > > > > > JUnit3TestReference.java:128) > > > > > at org.eclipse.jdt.internal.junit.runner.TestExecution.run ( > > > > > TestExecution.java:38) > > > > > at > > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests > > > ( > > > > > RemoteTestRunner.java:460) > > > > > at > > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests > > > ( > > > > > RemoteTestRunner.java:673) > > > > > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run ( > > > > > RemoteTestRunner.java:386) > > > > > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main ( > > > > > RemoteTestRunner.java:196) > > > > > > > > > > I gave an investigation on this issue, What I found is, > > > > > GroovyClassLoader's parent class loader is Null (pls see in > > > > > GroovyComponentBuilder.java) , in addition, the parent > classloader > > for > > > > > GroovyClassLoader is obtained from DeploymentContext, actually > this > > > > > DeploymentContext will always be constructed without specify a > > > > > classloader. > > > > > (pls see line 90 in DeployerImpl.java). > > > > > > > > > > Does anybody can tell me that this problem is caused by usage > > error > > > or > > > > > product issue? > > > > > -- > > > > > Thanks & Best Wishes > > > > > ----------------------------------- > > > > > [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > Thanks & Best Wishes > > > ----------------------------------- > > > Zhenghui Li(李正辉) > > > > > > > > > -- > Thanks & Best Wishes > ----------------------------------- > Zhenghui Li(李正辉) >
