The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

vyurik (76) [Avatar] Offline
#1
Dear Authors,
1. Targets "compile" and "run" reference launch.LaunchTutorialAdmin. This class is absent in chapter 02. I replaced it with scatours.LaunchNode.

2. While running "ant run", I have
[java] INFO: Creating node: scatours.composite
[java] Exception in thread "main" java.lang.NoClassDefFoundError: commonj/w
ork/WorkManager
[java] at java.lang.Class.getDeclaredConstructors0(Native Method)
[java] at java.lang.Class.privateGetDeclaredConstructors(Class.java:238
9)
[java] at java.lang.Class.getConstructors(Class.java:1459)
[java] at org.apache.tuscany.sca.core.DefaultUtilityExtensionPoint.getU
tility(DefaultUtilityExtensionPoint.java:110)
[java] at org.apache.tuscany.sca.node.impl.RuntimeBootStrapper.start(Ru
ntimeBootStrapper.java:112)
[java] at org.apache.tuscany.sca.node.impl.NodeImpl.initRuntime(NodeImp
l.java:432)
[java] at org.apache.tuscany.sca.node.impl.NodeImpl.<init>(NodeImpl.jav
a:315)
[java] at org.apache.tuscany.sca.node.impl.NodeFactoryImpl.createSCANod
e(NodeFactoryImpl.java:47)
[java] at scatours.LaunchNode.launchFromFileSystemDir(LaunchNode.java:3
9)
[java] at scatours.LaunchNode.main(LaunchNode.java:31)
[java] Java Result: 1

I couldn't figure out the location of commonj/work/WorkManager

Your help is appreciated,
Regards,
Vitaly
simon.nash (37) [Avatar] Offline
#2
Re: Chapter 2: problems running "ant run"
Hi Vitaly,
I am looking at this and I hope to have a fix soon.
vyurik (76) [Avatar] Offline
#3
Re: Chapter 2: problems running "ant run"
Hi Simon,
Thanks for your answer.
I'd like to share my thoughts related to the problem.
The chapter 01 implies that the book code uses SCA Java 1. The pom.xml files refer to 1.5-SNAPSHOT. Meanwhile, http://tuscany.apache.org/sca-java-releases.html has SCA Java 1.4 for downloads. That's what I used downloading binary type version apache-tuscany-sca-1.4.zip.
Upon expanding it, I didn't find any 'bin" directory there and therefore couldn't launch Tuscany.
The same Apache Tuscany site has also SCA Java 2.0-M2 which DOES have 'bin" directory and tuscany.bat to launch it.
So I wonder did they miss the 'bin" directory tuscany-sca-1.4.zip? If so is it safe to use SCA Java 2.0-M2 is the sense how the book source code is dependent on SCA Java version.

Your input is appreciated.
Regards,
Vitaly
simon.nash (37) [Avatar] Offline
#4
Re: Chapter 2: problems running "ant run"
You shouldn't try to use Tuscany SCA Java 2.0 with the examples in the book. The examples are based on Tuscany SCA Java 1.x and may not work correctly with Tuscany SCA Java 2.0.

I am hoping to be able to check a fix for this problem into svn later today or tomorrow. When I do this, I will post instructions here on how to download the correct Tuscany 1.x version and set up your environment so that "ant run" works.
vyurik (76) [Avatar] Offline
#5
Re: Chapter 2: problems running "ant run"
Thanks, Simon.

Regards,
Vitaly
simon.nash (37) [Avatar] Offline
#6
Re: Chapter 2: problems running "ant run"
I have made fairly good progress and I have Tuscany starting up and running the services from chapter 2 now. I still need to add a bit more code to run the demo scenario end to end. The next steps are to finish the code, check it into svn, and post instructions on how to run it. I'll try to get this done tomorrow, but it might not happen until the weekend.
vyurik (76) [Avatar] Offline
#7
Re: Chapter 2: problems running "ant run"
Thanks Simon,
I think being able to run and debug chapter 2 application is an
important step in understanding SCA.

Regards,
Vitaly
simon.nash (37) [Avatar] Offline
#8
Re: Chapter 2: problems running "ant run"
I have checked in the changes to chapter-02. Here is a summary of the changes:

1. Added a top-level ant script to build all the chapter-02 contributions and run a test of the components and services.
2. Fixed the problems with the ant script in the node directory.
3. Added a new contribution "client-contribution" containing test client code.
4. Made changes to NodeLauncher to load all the contributions and run the test client code in client-contribution.
5. Added a JUnit test case that runs as part of the maven build. It is functionally equivalent to the NodeLauncher code.
6. Fixed problems with imports and exports that prevented the contributions from loading and running.

To build and run this code, you need to do the following:

1. Check out the sca-java-1.5 branch from Tuscany svn.
2. Run a full top-level build. When I did this, the build failed in itest/jms. I was able to work around this by marking testOp2 in PropertiesTestCase with @Ignore.
3. Modify the distribution/bundle/pom.xml file to comment out the <dependency> sections for tuscany-binding-corba-runtime and tuscany-binding-sca-jms. This is needed so that you can build a distribution that doesn't contain these modules. Including these modules in the distribution causes runtime errors with the ant scripts.
4. Run a distribution build by changing to the distribution directory and typing "mvn".
5. Set the TUSCANY environment variable to the location of the distribution that you built in step 4. If you did your checkout into <mydir>, this value will be TUSCANY=<mydir>/sca-java-1.5/distribution/target/apache-tuscany-sca-1.5-SNAPSHOT.dir/tuscany-sca-1.5-SNAPSHOT
6. That's all! You are ready to build and run the chapter-02 code using either mvn or ant.

Please post here if you have any problems doing this.

Simon
vyurik (76) [Avatar] Offline
#9
Re: Chapter 2: problems running "ant run"
Thanks, Simon for your post.
I was running "mvn install" from the top level tuscany-sca-1.5 directory for about half an hour successfully.
Then I got error in org.apache.tuscany.sca.binding.gdata.GoogleBloggerServiceTestCase:
<error message="com.google.gdata.util.ParseException: org.xml.sax.SAXParseException: Premature end of file." type="org.osoa.sca.ServiceRuntimeException">
org.osoa.sca.ServiceRuntimeException: com.google.gdata.util.ParseException: org.xml.sax.SAXParseException: Premature end of file.
at org.apache.tuscany.sca.binding.gdata.provider.GdataBindingInvoker$PostInvoker.invoke(GdataBindingInvoker.java:174)
at org.apache.tuscany.sca.core.databinding.wire.PassByValueInterceptor.invoke(PassByValueInterceptor.java:107)
at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:311)
-------------------
I am not sure, how important this test, but I'll try to build with:
mvn -Dmaven.test.failure.ignore=true

Regards,
Vitaly
simon.nash (37) [Avatar] Offline
#10
Re: Chapter 2: problems running "ant run"
Hi Vitaly,
There has been some discussion on the Tuscany dev list about this recently. The failing tests have now been disabled (see http://tuscany.markmail.org/message/vze5qlfymst7h6hf). We suspect this is a Google problem. If you refresh your local copy and rebuild, you should be OK.