You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Subash Chaturanga <su...@gmail.com> on 2011/07/11 15:31:05 UTC

NoClassDefFoundError Exception occurred from SCADomain.newInstance() method

Hi all,
I am new to Tuscany and I am trying to write a test case to an already
existing tuscany service component, in a webapp.
So I am trying to invoke my service directly from a JUnit test and tried the
following code block.

      SCADomain   scaDomain;
             scaDomain = SCADomain.newInstance("web.composite");  ------
 line1
             FaceRecognitionService  patSvc =
scaDomain.getService(FaceRecognitionService.class,
"FaceRecognitionService");
             Photo p = patSvc.detectFromUrls("....").get(0)
             System.out.println(p.toString());
             scaDomain.close();

and got the following Exception. Any ideas to resolve this ?

java.lang.NoClassDefFoundError: org/osoa/sca/ServiceRuntimeException
at
org.apache.photark.face.facebook.test.GenericFaceRecognitionTestCase.test1(GenericFaceRecognitionTestCase.java:74)
 at
org.apache.photark.face.facebook.test.GenericFaceRecognitionTestCase.testFaceRecognition(GenericFaceRecognitionTestCase.java:50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
 at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
 at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
 at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
 at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
 at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
 at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:94)
 at
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:192)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:64)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at com.intellij.rt.execution.application.AppMain.main(AppMain.java:110)
Caused by: java.lang.ClassNotFoundException:
org.osoa.sca.ServiceRuntimeException
 at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
 ... 29 more

Thanks
-- 
Subash Chaturanga
Department of Computer Science & Engineering
University of Moratuwa
Sri Lanka

Blog -  http://subashsdm.blogspot.com/
Twitter - http://twitter.com/subash89

Re: NoClassDefFoundError Exception occurred from SCADomain.newInstance() method

Posted by Subash Chaturanga <su...@gmail.com>.
On Mon, Jul 11, 2011 at 7:01 PM, Subash Chaturanga <su...@gmail.com>wrote:

> Hi all,
> I am new to Tuscany and I am trying to write a test case to an already
> existing tuscany service component, in a webapp.
> So I am trying to invoke my service directly from a JUnit test and tried
> the following code block.
>
>       SCADomain   scaDomain;
>              scaDomain = SCADomain.newInstance("web.composite");  ------
>  line1
>              FaceRecognitionService  patSvc =
> scaDomain.getService(FaceRecognitionService.class,
> "FaceRecognitionService");
>              Photo p = patSvc.detectFromUrls("....").get(0)
>              System.out.println(p.toString());
>              scaDomain.close();
>

I also went through a tuscany simple tutorial [1] , but still couldn't find
out the problem. Is there any issues with the above code,
Does SCADomain.newInstance("") finds where my composite is when I provide
its name (in PhotArk its web.composite) ?
WDYT?

[1] - http://tuscany.apache.org/getting-started-with-tuscany.html


>
> and got the following Exception. Any ideas to resolve this ?
>
> java.lang.NoClassDefFoundError: org/osoa/sca/ServiceRuntimeException
> at
> org.apache.photark.face.facebook.test.GenericFaceRecognitionTestCase.test1(GenericFaceRecognitionTestCase.java:74)
>  at
> org.apache.photark.face.facebook.test.GenericFaceRecognitionTestCase.testFaceRecognition(GenericFaceRecognitionTestCase.java:50)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>  at
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
> at
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>  at
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
> at
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
>  at
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
> at
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
>  at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
> at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
>  at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
>  at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
> at
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
>  at
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
> at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
>  at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
> at
> com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:94)
>  at
> com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:192)
> at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:64)
>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>  at com.intellij.rt.execution.application.AppMain.main(AppMain.java:110)
> Caused by: java.lang.ClassNotFoundException:
> org.osoa.sca.ServiceRuntimeException
>  at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
> at java.security.AccessController.doPrivileged(Native Method)
>  at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>  ... 29 more
>
> Thanks
> --
> Subash Chaturanga
> Department of Computer Science & Engineering
> University of Moratuwa
> Sri Lanka
>
> Blog -  http://subashsdm.blogspot.com/
> Twitter - http://twitter.com/subash89
>
>
>


-- 
Subash Chaturanga
Department of Computer Science & Engineering
University of Moratuwa
Sri Lanka

Blog -  http://subashsdm.blogspot.com/
Twitter - http://twitter.com/subash89

Re: NoClassDefFoundError Exception occurred from SCADomain.newInstance() method

Posted by Luciano Resende <lu...@gmail.com>.
On Mon, Jul 11, 2011 at 8:21 AM, Luciano Resende <lu...@gmail.com> wrote:
>
> First, it seems that you are using Tuscany 1.x, compared to Tuscany
> 2.x which is what Photark is using.
> To me, it seems that there are runtime dependencies missing an thus
> the Tuscany runtime is not started properly.
> Do you what to share your pom.XML and web.composite to help us
> investigate the issue ?
>

Also, the following files can give you some more ideas on how to
create the unit tests :

Required dependencies :
https://svn.apache.org/repos/asf/incubator/photark/branches/photark-rest/photark-filesystem/pom.xml

Composite :
https://svn.apache.org/repos/asf/incubator/photark/branches/photark-rest/photark-filesystem/src/test/resources/gallery.composite

Unit Test that bootstraps Tuscany :
https://svn.apache.org/repos/asf/incubator/photark/branches/photark-rest/photark-filesystem/src/test/java/org/apache/photark/services/filesystem/FileSystemGalleryTestCase.java

-- 
Luciano Resende
http://people.apache.org/~lresende
http://twitter.com/lresende1975
http://lresende.blogspot.com/

Re: NoClassDefFoundError Exception occurred from SCADomain.newInstance() method

Posted by Subash Chaturanga <su...@gmail.com>.
On Mon, Jul 11, 2011 at 8:51 PM, Luciano Resende <lu...@gmail.com>wrote:

> On Monday, July 11, 2011, Subash Chaturanga <su...@gmail.com> wrote:
> > Hi all,I am new to Tuscany and I am trying to write a test case to an
> already existing tuscany service component, in a webapp.So I am trying to
> invoke my service directly from a JUnit test and tried the following code
> block.
> >
> >       SCADomain   scaDomain;
> >              scaDomain = SCADomain.newInstance("web.composite");  ------
>  line1             FaceRecognitionService  patSvc =
> scaDomain.getService(FaceRecognitionService.class,
> "FaceRecognitionService");
> >
> >              Photo p = patSvc.detectFromUrls("....").get(0)
> System.out.println(p.toString());             scaDomain.close();
> >
> > and got the following Exception. Any ideas to resolve this ?
> > java.lang.NoClassDefFoundError: org/osoa/sca/ServiceRuntimeException  at
> org.apache.photark.face.facebook.test.GenericFaceRecognitionTestCase.test1(GenericFaceRecognitionTestCase.java:74)
> >
> >       at
> org.apache.photark.face.facebook.test.GenericFaceRecognitionTestCase.testFaceRecognition(GenericFaceRecognitionTestCase.java:50)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >
> >       at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >
> >       at
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
> at
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
> >
> >       at
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
>   at
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
> >
> >       at
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
>        at
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
> >
> >       at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
>    at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
> >
> >       at
> org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)    at
> org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
> >
> >       at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
>     at
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
> >
> >       at
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
>  at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
> >
> >       at org.junit.runner.JUnitCore.run(JUnitCore.java:137)   at
> com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:94)
> >
> >       at
> com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:192)
>   at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:64)
> >
> >       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >
> >       at
> com.intellij.rt.execution.application.AppMain.main(AppMain.java:110)Caused
> by: java.lang.ClassNotFoundException: org.osoa.sca.ServiceRuntimeException
> >       at java.net.URLClassLoader$1.run(URLClassLoader.java:202)       at
> java.security.AccessController.doPrivileged(Native Method)
> >
> >       at java.net.URLClassLoader.findClass(URLClassLoader.java:190)   at
> java.lang.ClassLoader.loadClass(ClassLoader.java:307)
> >
> >       at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>      at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
> >
> >       ... 29 more
> > Thanks
> > --
> > Subash ChaturangaDepartment of Computer Science & EngineeringUniversity
> of Moratuwa
> > Sri Lanka
> > Blog -  http://subashsdm.blogspot.com <http://subashsdm.blogspot.com/>/Twitter
> - http://twitter.com/subash89
> >
> >
> >
>
> First, it seems that you are using Tuscany 1.x, compared to Tuscany
> 2.x which is what Photark is using.
> To me, it seems that there are runtime dependencies missing an thus
> the Tuscany runtime is not started properly.
> Do you what to share your pom.XML and web.composite to help us
> investigate the issue ?
>

Sure., this problem occurred in Apache PhotArk, and as it is under Apache
license I will share the relevant pom and the composite.
I have created a JIRA[1] to share those files and there I have uploaded both
those files.

[1] - https://issues.apache.org/jira/browse/TUSCANY-3895


>
>
>
> --
> Luciano Resende
> http://people.apache.org/~lresende
> http://twitter.com/lresende1975
> http://lresende.blogspot.com/
>



-- 
Subash Chaturanga
Department of Computer Science & Engineering
University of Moratuwa
Sri Lanka

Blog -  http://subashsdm.blogspot.com/
Twitter - http://twitter.com/subash89

Re: NoClassDefFoundError Exception occurred from SCADomain.newInstance() method

Posted by Luciano Resende <lu...@gmail.com>.
On Monday, July 11, 2011, Subash Chaturanga <su...@gmail.com> wrote:
> Hi all,I am new to Tuscany and I am trying to write a test case to an already existing tuscany service component, in a webapp.So I am trying to invoke my service directly from a JUnit test and tried the following code block.
>
>       SCADomain   scaDomain;
>              scaDomain = SCADomain.newInstance("web.composite");  ------  line1             FaceRecognitionService  patSvc = scaDomain.getService(FaceRecognitionService.class, "FaceRecognitionService");
>
>              Photo p = patSvc.detectFromUrls("....").get(0)             System.out.println(p.toString());             scaDomain.close();
>
> and got the following Exception. Any ideas to resolve this ?
> java.lang.NoClassDefFoundError: org/osoa/sca/ServiceRuntimeException	at org.apache.photark.face.facebook.test.GenericFaceRecognitionTestCase.test1(GenericFaceRecognitionTestCase.java:74)
>
> 	at org.apache.photark.face.facebook.test.GenericFaceRecognitionTestCase.testFaceRecognition(GenericFaceRecognitionTestCase.java:50)	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
> 	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>
> 	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
>
> 	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
>
> 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
>
> 	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
>
> 	at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
>
> 	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)	at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
>
> 	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:94)
>
> 	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:192)	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:64)
>
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
> 	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:110)Caused by: java.lang.ClassNotFoundException: org.osoa.sca.ServiceRuntimeException
> 	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)	at java.security.AccessController.doPrivileged(Native Method)
>
> 	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)	at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>
> 	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>
> 	... 29 more
> Thanks
> --
> Subash ChaturangaDepartment of Computer Science & EngineeringUniversity of Moratuwa
> Sri Lanka
> Blog -  http://subashsdm.blogspot.com <http://subashsdm.blogspot.com/>/Twitter - http://twitter.com/subash89
>
>
>

First, it seems that you are using Tuscany 1.x, compared to Tuscany
2.x which is what Photark is using.
To me, it seems that there are runtime dependencies missing an thus
the Tuscany runtime is not started properly.
Do you what to share your pom.XML and web.composite to help us
investigate the issue ?



-- 
Luciano Resende
http://people.apache.org/~lresende
http://twitter.com/lresende1975
http://lresende.blogspot.com/