tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Tuscany: Tuscany SCA Java - FAQ (page edited)
Date Thu, 28 Aug 2008 04:56:00 GMT
Tuscany SCA Java - FAQ (TUSCANY) edited by haleh mahbod
      Page: http://cwiki.apache.org/confluence/display/TUSCANY/Tuscany+SCA+Java+-+FAQ
   Changes: http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=35040&originalVersion=45&revisedVersion=46






Content:
---------------------------------------------------------------------

{section:border=true}
{column:width=15%}
{include: SCA Java Subproject Menu}
{column}
{column:width=85%}
Welcome to the Apache Tuscany Java SCA FAQ page. Please help to keep the information on this
page current.

\\
{panel:title=Apache Tuscany SCA Frequently Asked Questions|borderStyle=solid|borderColor=#C3CDA1|titleBGColor=#C3CDA1|bgColor=#ECF4D1}
* [Build and Devlopment Questions|#Build Questions]
** [What version of Java do I need? |#BuildA]
** [What version of Maven do I need? |#BuildB]
** [Why does the Tuscany code I checked out of Subversion not build? |#BuildC]
** [Java Heap Error during compilation|#BuildD]
** [How do I generate Eclipse projects from the source distribution or from Subversion trunk?|#BuildE]
** [How do I generate an Eclipse WTP project for the WebApp samples?|#BuildF]
** [When running the WSConfidentialityTestCase using IBM JDK I experience java.lang.ExceptionInInitializerError
arising from the base java.security.InvalidKeyException: Public key presented not for certificate
signature - how do I get over this?|#BuildG]
** [How do I run the samples from a release candidate before the maven artifacts have been
published?|#BuildH]
** [How do I turn on more trace output?|#BuildI]
** [How do I remote debug Tuscany Java SCA applications from Eclipse?|#BuildJ]
** [Maven locks up during a build. What's going on?|#BuildK]
** [When deploying war into Tomcat, I get failure?|#BuildL]
** [Build stops because of test failure, what to do?|#BuildM]
* [Implementation Java Questions|#Implementation JavaQuestions]
** [What is the format for specifying multiple interfaces with the @Service annotation? |#ImplementationJavaA]
** [Why are references not being injected into my component? |#ImplementationJavaB]
** [How to deploy EJBs (stateless session bean, EJB2) in Tuscany? |#ImplementationJavaC]
** [Is it possible to use the calculator-distributed example to run on multiple hosts? |#ImplementationJavaD]
* [Binding Questions|#Binding Questions]
** [Can I use the EJB binding to publish an SCA services as an SLSB? |#BindingA]
** [How to return application exception in RMI binding? |#BindingB]
* [DataBinding Questions|#DataBinding Questions]
** [What is the difference between Logical Type and Physical Type?|#DataBindingA]
* [Contribution Questions|#Contribution Questions]
** [What is META-INF/sca-contribution.xml for?|#ContributionA]
** [What is What is META-INF/sca-deployables/ for?|#ContributionB]
* [Policy Framework Questions|#Policy Framework Questions]
** [What is the level of policy support in Tuscany Release 1.0 ?|#PolicyA]
** [How do I try out the 'confidentiality' policy intent for my webservice binding ?|#PolicyB]
* [Specification Questions|#Specification Questions]
** [Where are the specifications that Tuscany implements?|#SpecificationA]
** [what does the promote keyword in the composite file mean?|#SpecificationB]
* [Hosting Questions|#Hosting Questions]
** [WebSphere - java.lang.ClassNotFoundException: org.apache.tuscany.sca.host.webapp.WebSCADomain?|#HostingA]
** [WebSphere - java.lang.IllegalArgumentException: http://www.w3.org/2001/XMLSchema?|#HostingB]
** [WebSphere - java.net.ConnectException: Connection refused: connect|#HostingC]
* [General SCA Questions|#General SCA Questions]
** [Get Tearget Name From Composite without parsing? |#GetTargetName]
* [Didn't Find My Answer|#Didn't Find it]

 
{panel}

h2. {anchor:Build Questions}

{bgcolor:#C3CDA1}Build Questions
{bgcolor}

h3. {anchor:BuildA}

{bgcolor:#C3CDA1}What version of Java do I need?
{bgcolor}
Both IBM and Sun JDK 1.5 are known to work and are used regularly by our development community.

JDK1.4 will not work as the Tuscany SCA code base relies on some of the features of JDK1.5
such as generics and annotations.

JDK1.6 can be problematic depending on what version you are running with. The problems are
usually due to bundled versions of either STaX or JAXB  being in conflict with the versions
we are using in Tuscany.

If you are getting errors that look like the following stack trace

{noformat}
java.lang.LinkageError: JAXB 2.0 API is being loaded from the bootstrap classloader, but this
RI 
       (from jar:file:/home/jim/.m2/repository/com/sun/xml/bind/jaxb-impl/2.1.5/jaxb-impl-2.1.5.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.class)

       needs 2.1 API. Use the endorsed directory mechanism to place jaxb-api.jar in the bootstrap
classloader. 
       (See http://java.sun.com/j2se/1.5.0/docs/guide/standards/)
       at com.sun.xml.bind.v2.model.impl.ModelBuilder.<clinit>(ModelBuilder.java:172)
       at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:422)
       at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:286)
       at com.sun.tools.xjc.reader.xmlschema.bindinfo.BindInfo.getJAXBContext(BindInfo.java:332)
{noformat}

Then it's related to JDK 6 shipping with its own version of JAXB impl. Up to JDK 6 Update
3, the JDK ships with JAX-WS 2.0 (which includes JAXB 2.0), but Tuscany requires JAXB 2.1.
There are some possible solutions to this problem:

# Upgrade your JDK to 1.6.0_04 or above, which will include JAX-WS (and JAXB) 2.1 
# Copy the version 2.1 jaxb-api.jar or jaxws-api.jar (you can probably find them in your local
maven repo) to <JAVA_HOME>/lib/endorsed to override the API jars that ship with the
JDK 
# Use the -Djava.endorsed.dir=<a folder containing our JAXB jars> to override the JAXB
from JDK 6.

If you see an error like the following 

{noformat}
javax.xml.stream.FactoryConfigurationError: Provider
javax.xml.stream.XMLInputFactory could not be
instantiated: java.lang.InstantiationException
at
javax.xml.stream.XMLInputFactory.newInstance(XMLInputFactory.java:158)
{noformat}

It's the same problem but related to the version of the STaX API in use. TODO - locate the
specific jar that causes the problem

h3. {anchor:BuildB}

{bgcolor:#C3CDA1}What version of Maven do I need?
{bgcolor}
To build the Apache Tuscany source code that you have checked out of subversion you need to
install Maven. The build is know to work relatively reliably with Maven 2.0.5. People have
had it working with later versions but it you are encountering unpredicatbility in the build
then give 2.0.5 a go.

h3. {anchor:BuildC}

{bgcolor:#C3CDA1}Why does the Tuscany code I checked out of Subversion not build?
{bgcolor}
If you are taking code out of the trunk of the Tuscany Subversion repository then you may
have been unlucky and picked up a revision of the code where the build is broken. As trunk
is where the development takes place this happens now and again although the development community
tries to avoid build breaks if at all possible and tries to fix them quickly when they do
happen.

There are may and various other things that can cause your build to break. Its worth checking
on the mail list that the trunk is building. Assuming that it is we will usually ask you to
do the following as a basic level set.

Stop any ide you may have running
Check out the latest trunk revision

 cd mytuscanydir
 svn checkout [https://svn.apache.org/repos/asf/incubator/tuscany/java/]

or (if you already have a version of the code)

 svn update [https://svn.apache.org/repos/asf/incubator/tuscany/java/]

Clean all the maven projects

 cd mytuscanydir/sca
 mvn clean

Remove all the sca artifacts from the local maven repository by removing (or renaming) all
of the directories under

 .m2\repository\org\apache\tuscany\sca

Rebuild sca

 cd mytuscanydir/sca
 mvn

If it still doesn't work then get back on the mail list

h3. {anchor:BuildD}

{bgcolor:#C3CDA1}Java Heap error during compilation
{bgcolor}
I always get a "Java heap space" error during the build while the itests are running these
days. Runs fine if I build from within the itests folder but building from the top sca folder
always fails.

try "MAVEN_OPTS="-Xmx1024m \-Xms512m" or You can also increase the memory options in the sca
pom [1], in the surefire plugin configuration section.

[1] [https://svn.apache.org/repos/asf/incubator/tuscany/java/sca/pom.xml]

h3. {anchor:BuildE}

{bgcolor:#C3CDA1}How do I generate Eclipse projects from the source distribution or from Subversion
trunk?
{bgcolor}
If you have unpacked the source distribution or have checked out all of the code under the
tuscany/java/sca directory in subversion then you should end up with a source directory containing
something like:
{noformat}
demos
distribution
itest
modules
samples
tools
pom.xml
{noformat}
You can build the source from using maven with the command
{code}
mvn
{code}
If you are going to use Eclipse with the Tuscany code, first ensure that Eclipse is aware
of your Maven setup, which you can do using the command
{code}
mvn -Declipse.workspace=<path-to-eclipse-workspace> eclipse:add-maven-repo
{code}
For more details on using Eclipse with Maven, look at this page: [http://maven.apache.org/guides/mini/guide-ide-eclipse.html|http://maven.apache.org/guides/mini/guide-ide-eclipse.html]
You can then build Eclipse projects for all the modules in the project using the command
{code}
mvn -Peclipse eclipse:eclipse
{code}
This builds ".classpath" and ".project" files for each modules. The easiest thing to do is
import all of these generated projects. In Eclipse choose "File/Import/Existing Projects Into
Workspace". From the wizard select your source directory and Eclipse should now find all of
the Eclipse projects that have been generated.

If you imported all modules into Eclipse you should find that project dependencies are satisfied
by reference to other Tuscany SCA projects in your workspace. This is convenient for debugging
as all Tuscany SCA source it now available in your workspace.

h3. {anchor:BuildF}

{bgcolor:#C3CDA1}How do I generate an Eclipse WTP project for the WebApp samples?
{bgcolor}
If you're using Eclipse WTP and want to get WTP Web Projects generated for our Webapp samples
you can simply pass a \-Dwtpversion=1.5 option tothe usual mvn eclipse:eclipse command, like
this:
{code}
mvn -Dwtpversion=1.5 -Peclipse eclipse:eclipse
{code}
The magic \-Dwtpversion=1.5 option will add the WTP Web project nature to all the Eclipse
projects with <packaging>war</packaging> in their Maven pom.xml. You'll then be
able to add these projects to a WTP Tomcat or Geronimo Server configuration, to publish and
run them straight from your Eclipse workspace.

h3. {anchor:BuildG}

{bgcolor:#C3CDA1}When running the WSConfidentialityTestCase using IBM JDK I experience java.lang.ExceptionInInitializerError
arising from the base java.security.InvalidKeyException: Public key presented not for certificate
signature - how do I get over this?
{bgcolor}
To get over this exception please go over to the jre\lib\security\java.security of the IBM
JDK installation and set up the security providers as follows.
{noformat}
#
# List of providers and their preference orders:
#
security.provider.1=org.bouncycastle.jce.provider.BouncyCastleProvider
security.provider.3=com.ibm.jsse2.IBMJSSEProvider2
security.provider.2=com.ibm.crypto.provider.IBMJCE
security.provider.4=com.ibm.security.jgss.IBMJGSSProvider
security.provider.5=com.ibm.security.cert.IBMCertPath
security.provider.6=com.ibm.security.sasl.IBMSASL
{noformat}

h3. {anchor:BuildH}
{bgcolor:#C3CDA1}How do I run the samples from a release candidate before the maven artifacts
have been published?
{bgcolor}

The samples in the binary distribution won't build with mvn till we actually release and the
artifacts get published to the live maven repository. To test things you can bypass this by
setting up a mirror pointing to the release candidate maven repository. You do that by adding
the following to your maven settings.xml file:

{code}
   <mirrors>
    <mirror>
      <id>ant.staging</id>
      <url>http://people.apache.org/~antelder/tuscany/1.0-RC1a/maven</url>
      <mirrorOf>apache.incubator</mirrorOf>
    </mirror>
{code}

The settings.xml is in a .m2 folder in your home directory, eg mines at: "C:\Documents and
Settings\Administrator\.m2". If you don't have one then we've an example at: [settings.xml|https://svn.apache.org/repos/asf/incubator/tuscany/java/etc/settings.xml]

h3. {anchor:BuildI}
{bgcolor:#C3CDA1}How do I turn on more trace output?
{bgcolor}
Tuscany uses the JDK logger for writing out info, warning etc. How much gets written out is
controlled by a logging.properties file. We don't ship a file with Tuscany as we rely in the
default INFO logging level that Java assumes. If you wan't to change the defaults then you
can create (or edit) a logging.properties file in you jre/lib directory. Foe example, if you're
using the IBM JDK you should end up with the file

{code}
C:\thedirwhereiinstalledjava\jre\lib\logging properties
{code}

You might want to go and change the logging level by setting it to FINE to get more information
generally

{code}
.level= FINE
{code}

or for getting more information printed on the console

{code}
java.util.logging.ConsoleHandler.level = INFO
{code}

See [here|http://java.sun.com/j2se/1.4.2/docs/guide/util/logging/overview.html] for some overview
information about JDK logging.

h3. {anchor:BuildJ}
{bgcolor:#C3CDA1}How do I remote debug Tuscany Java SCA applications from Eclipse?
{bgcolor}

There are many good articles about how to turn on java remote debugging, for exampe, [here's
one|http://www.eclipsezone.com/eclipse/forums/t53459.html]

The long and short of it is that you need to tell the JVM to list on a port for debug connections.
For example, here the Calculator sample is being debugged.

{code}
java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator.jar;.calculator.CalculatorClient
Listening for transport dt_socket at address: 8000
3 + 2=5.0
3 - 2=1.0
3 * 2=6.0
3 / 2=1.5
{code}

The important bits are the arguments starting -X. Note the address is set to port 8000. In
Eclipse you can then simply open the debug dialog and create a new "Remote Java Application"
profile specifying the port of 8000 to match the above command line. 

Assuming that you have the Tuscany SCA source available to Eclipse you can then debug through
the calculator sample and the Tuscany SCA code. 

If you want to remote debug some tests running in the maven build then you can either do.

{code}
set MAVEN_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"
{code}
or use the following surefire option
{code}
-Dmaven.surefire.debug . 
{code}

This opens the debugger on port 5005 with suspend=y. You then run mvn as you normally would
and connect Eclipse to the running test as described above.

If you want to debug through a webapp running in tomcat you can set up tomcat as follows:
{code}
set JPDA_TRANSPORT=dt_socket
set JPDA_ADDRESS=5005
set JPDA_SUSPEND=y
tomcat-install\bin>catalina jpda run
{code}
Again from eclipse choose to remote debug. 

h3. {anchor:BuildK}
{bgcolor:#C3CDA1}Maven locks up during a build. What's going on?
{bgcolor}
The short answer is that we don't know. However we have seen this occasionally on Windows
and is some cases it can be tracked back to some kind of interaction between Maven and other
applications running on the machine. So the first thing to try is to stop all other applications
that you are running and retry the Maven build and see if that helps.

h3.{anchor:BuildL}
{bgcolor:#C3CDA1}When I deploy my war in tomcat,while thereare no previous errors in the 
stack trace!
{bgcolor}

When the StandardContext catches errors like this there will be additional
messages about the problem written to the logs in the Tomcat log directory,
please check to see what the errors are.

h3.{anchor:BuildM}
{bgcolor:#C3CDA1} My build fails when I get any test failure. Is there a way to make progress?
{bgcolor}
You can use the following mvn command to ignore test failures.  {code} 
mvn clean install -fn 
{code} 

This depends on what you want to do! With -fn the tests still run with -
Dmaven.test.skip=true they don't. Not running the tests makes the build much
faster but without running the tests you don't know what problems there
might be with the jars that get built. A key thing is that with -fn a test
failure in one module does not stop the build of other modules, but, the jar
for the module with the test failure does not get built so if you want to
ignore a test failure but still rebuild a module then you need to use -
Dmaven.test.skip=true. On the other hand for things like the itest modules
you just want to see the tests results so it doesn't make much sense to use
-Dmaven.test.skip=true but -fn can be useful to see how good or bad the
state of the code is.


h2. {anchor:MavenQuestions}

{bgcolor:#C3CDA1}Maven Questions
{bgcolor}

h2. {anchor:Implementation JavaQuestions} Implementation Java Questions

h3. {anchor:ImplementationJavaA} What is the format for specifying multiple interfaces with
the @Service annotation?
{code}
@Service(interfaces={Interface1.class, Interface2.class, Interface3.class} )
public class ServiceImpl implements Interface1, Interface2, Interface3{
 ...
}
{code}

h3. {anchor:ImplementationJavaB} Why are references not being injected into my component?
If you have a component implementation that looks something like...
{code}
public class ServiceImpl implements ServiceInterface1{
 @Reference
 ServiceInterface2 serviceReference1;

 @Reference
 private ServiceInterface2 serviceReference2;

 @Reference
 protected ServiceInterface2 serviceReference3;

 @Reference
 public ServiceInterface2 serviceReference4;

 ...
}
{code}
Then in you operation you will find that serviceReference1 and serviceReference2 are null
because SCA will only inject references into fields marked protected or public. This is true
for the other injecting annotations, for example, @Callback, @ConversationId and @Context.

h3. {anchor:ImplementationJavaC} How to deploy EJBs (stateless session bean, EJB2) in Tuscany?

There are different options for this:   
* Use binding.ejb to expose an SCA service as a stateless session bean. You can find some
experimental implementation using OpenEJB.
* Develop EJBs using JEE programming model and use them as SCA component implementations (implementation.ejb).

h3. {anchor:ImplementationJavaD} Is it possible to use the calculator-distributed example
to run on multiple hosts?

The calculator-distributed is configured to run in multiple VMs. The node launchers are hard
coded to talk to the domain at "http://localhost:9990".   
{code}
   (In each of the node launcher classes, the 'NodeLauncher.main(new String[] {"http://localhost:9990/node-config/NodeC"});'
statement does this) 
{code}
In order to run the domain in a remote location, change the localhost to the host where domain
is running in above mentioned statement .

h2. {anchor:Binding Questions}

{bgcolor:#C3CDA1}Binding Questions
{bgcolor}

h3. {anchor:BindingA} Can I use the EJB binding to publish an SCA services as an SLSB? 
Unfortunately, we only have the reference binding support for SLSB (call
SLSB from SCA) in Tuscany at this moment. Any contribution to support SLSB
service binding is welcome. :-)

h3. {anchor:BindingB} How to return application exception in RMI binding?
RemoteException and its subclasses are usually used to represent communication issues and
not treated as      business exceptions by Tuscany (Ref.: JAXWS Specification v2.1 section
3.7). In order to return application pecific exception, you can add the RemoteException on
the "throws" clause instead of having the user exception extend the RemoteException.

h2. {anchor:DataBinding Questions}

{bgcolor:#C3CDA1}DataBinding Questions
{bgcolor}

h3. {anchor:DataBindingA}

{bgcolor:#C3CDA1}What is he difference between Logical Type and Physical Type?
{bgcolor}
 The logical type represents the data type the user thinks is flowing across a wire. This
could be a Java type, a XML type, a CORBA type, whatever depending on the /logical/ service
contract defined in the assembly.
 The physical type is the actual representation of that type that is flowed by the runtime.
In the Java runtime this will always be a Java type (i.e. some subclass of Object). In some
cases it will be the same as the logical type - e.g. when a Java component calls another Java
component over a local wire using a Java interface then both logical and physical types will
be the same. In many cases though they will be different - for example, if the service contract
was WSDL then the logical type would be the XML type used by the WSDL.
 Within the runtime the same logical type may have different physical forms. For example,
the same XML document could be represented physically as a DOM, a StAX stream, an SDO, a JAXB
object, or an AXIOM stream. The framework supports conversion between these different physical
forms.
{quote}

{quote}
# *What is the role of a data mediator interceptor? Can you cite an example of how mediation
works say for a component A with reference R that references a service S in component B.?*
 The interceptor gets added by the connector. A's outbound wire and B's inbound wire describe
the datatypes their implementations can support. When the wire ends are connected the connector
adds the interceptor if mediation is needed.
 One job of a transport binding is to convert an in-memory physical representation to a suitable
set of bits on the network (aka serialization and deserialization). Rather than reinvent the
different transports we reuse existing implementations such as Axis2 or RMI. As such we need
to convert the physical representation on our internal wire with that used by the transport.
So, for example, Axis2 only understands AXIOM so in a reference we need to convert the user's
physical representation to AXIOM and in a service we need to convert the AXIOM generated by
the transport into the form the user's implementation requires. The steps could be described
as follows:
## A calls reference R with physical Java object X(java)
## X is placed on R's outbound wire
## data mediation converts X(java) to AXIOM object X(axiom)
## X(axiom) is placed on inbound wire for the Axis2 binding
## Axis2 binding serializes X(axiom) onto the network as XML
## Axis2 binding on the target deserializes the XML from the network to X(axiom)
## X(axiom) is placed on the outbound wire from the Axis2 binding
## data mediation converts X(axiom) to X(java) as needed by the target component
## X(java) is placed on B's inbound wire
## the target instance for B is invoked passing in X(java)
. An important thing to note here is that from the fabric's perspective we are dealing with
two physical wires: the wire on the client connecting the source component A to the outbound
Axis2 transport and the wire on the server connecting the inbound Axis2 transport to the target
component B.
>From a global perspective there is one logical wire from A to B but because A and B are
located on two different runtimes that logical wire gets split into two physical wires A->net
and net->B.

h2. {anchor:Contribution Questions}

{bgcolor:#C3CDA1}Contribution Questions
{bgcolor}

h3. {anchor:ContributionA}

{bgcolor:#C3CDA1}What is META-INF/sca-contribution.xml for?
{bgcolor}
The [SCA Assembly Model Specification V1.00|http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications]
describes this file in section 1.10.2.3.  Any composites that are named in the sca-contribution.xml
file will be automatically be included in the deployable list maintained by the contribution.

If you have a contribution in a directory say.

/my/contribution/dir

Then all composites, along with any other resources, under this directory will be located
by the contribution service. For example, assume we have

/my/contribution/dir/META-INF/sca-contribution.xml
/my/contribution/dir/mycomposite.composite

Where sca-contribution.xml is

<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://mycomposite"
 xmlns:management="http://mycomposite">
 <deployable composite="mycomposite:MyComposite"/>
</contribution>

So in this case the contribution service will locate the file mycomposite.composite and, assuming
it contains a composite called mycomposite:MyComposite, will present it as being deployable
based on the information in sca-contribution.xml.

h3. {anchor:ContributionB}

{bgcolor:#C3CDA1}What is META-INF/sca-deployables/ for?
{bgcolor}
This is a Tuscany specific shorthand for defining deployable components, i.e. you won't find
it in the SCA specifications.

If you have a contribution in a directory say.

/my/contribution/dir

Then all components in composites under this directory will be located by the contribution
service and any components in composites under the directory /META-INF/sca-deployables/ will
automatically be included in the deployable list maintained by the contribution, for example

/my/contribution/dir/META-INF/sca-deployables/mycomposite.composite

h2. {anchor:Policy Framework Questions}

{bgcolor:#C3CDA1}Policy Framework Questions
{bgcolor}

h3. {anchor:PolicyA}

{bgcolor:#C3CDA1}What is the level of policy support in Tuscany Release 1.0 ?
{bgcolor}
In Java SCA Release 1.0, policy intents and policysets can be defined for an SCA Domain in
the definitions.xml file and specified for various SCA Artifacts in assembly composites (composite,
component, services, references, bindings, implementation).  With respect to processing, computing
aplicable policies and applying them is concerned here is what the Release 1.0 supports:
- appplicable policysets are computed only for 'binding' elements only i.e. only Interaction
Policies are supported.  The next release will have support for 'implementation' elements
also
- definition of policy attachments to represent axis2 config params.  As sample representations
of this, there are itests in the binding-ws-axis2 module and there is a sample (helloworld-ws-service-secure)
that defines policies to enable ws-security in Axis2.  The intents that are supported in the
itests and sample are athentication, integrity and confidentiality
- the itest and sample does not exercise confidentiality intent due to legal issues that Tuscany
has with respect to distributing bouncycastle encryption provider jars.
- support for WS-Policy attachments, annotated intents and policyset are not yet supported
- in identifying policysets applicable to sca elements, the xpath expression in the 'appliesTo'
attribute of policy sets is not yet processed as xpath since we are sorting out some specs
and implementation details with this - http://www.mail-archive.com/tuscany-dev%40ws.apache.org/msg21699.html

h3. {anchor:PolicyB}
{bgcolor:#C3CDA1}How do I try out/exercise the 'confidentiality' policy intent for the Axis2
WS binding ?
{bgcolor}
- First you must ensure that you are not encumbered by the legal and licensing requirements
of bouncycastle.  There are algorithms in the bouncycastle distributions (such as IDEA) that
have patent obligations and you are responsible for sorting this out for yourself.
- Next you must be familiar with setting up Axis2 for confidentiality.  Here are some useful
links for this http://wso2.org/library/234, http://wso2.org/library/174, http://wso2.org/library/255.
- The itest in the ws-binding-axis2 module and the helloworld-ws-service-secure have definitions.xml
file that define the intents and policyset for confidentiality.  Change the values that have
been provided in the Axis2ConfigParam policy attachment, to suit what you have defined for
your application - such as the keystore, the userid and password to the keystore, the password
callback handler class etc.
- Now, specify the confidentiality intent on any of the binding.ws elements in your application
composite and ensure that the bcprov-jdk15-132.jar is in the classpath.  
- Some JREs might require a bit of tweaking with the security.policy settings that deal with
encryption providers.  We have tried and tested this successfuly on Sun and IBM JREs.

h2. {anchor:Specification Questions}

{bgcolor:#C3CDA1}Specification Questions
{bgcolor}

h3. {anchor:SpecificationA}
{bgcolor:#C3CDA1}Where are the specifications that Tuscany implements?
{bgcolor}
You can find the 6 SCA technical committees here:

[http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=sca-assembly]
[http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=sca-policy]
[http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=sca-bindings]
[http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=sca-j]
[http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=sca-c-cpp]
[http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=sca-bpel]

Meeting minutes, documents, issues and so on are linked from the main page.

Mailing list archives can be found here:

[http://www.oasis-open.org/archives/sca-assembly/]

[http://www.oasis-open.org/archives/sca-policy/]
[http://www.oasis-open.org/archives/sca-bindings/]
[http://www.oasis-open.org/archives/sca-j/]
[http://www.oasis-open.org/archives/sca-c-cpp/]
[http://www.oasis-open.org/archives/sca-bpel/]

h3. {anchor:SpecificationB}
{bgcolor:#C3CDA1}What does the promote keyword in the composite file mean?
{bgcolor}

An SCA composite can be used as an implementation (implementation.composite) for a component.
This is so-called recursive composition. It allows pre-assembled composites to be reused.

"promote" can be used to make services or references declared on a component inside the composite
visible for wiring at the composite level. The composite services and references can be then
further configured when it's used as a component implementation at outer level.

Hope the following samples help.

{code}
<composite name="Composite1" xmlns:ns="http://dummy">
   <component name="C1">
           <implementation.composite name="ns:Composite2">
           <!-- wire ref1 to component C3's service1 -->
           <reference name="ref1" target="C3/service1"/>
           <!-- configure the service with ws binding -->
           <service name="svc1">
               <binding.ws .../>
           </service>
   </component>
</composite>
{code}

{code}
<composite name="Composite2" targetNamespace="http://dummy"
xmlns:ns="http://dummy">
   <component name="C2">
           <implementation.java class="my.C2Impl">
   </component>

   <!-- innerService of component C2 is promoted as svc1 -->
   <service name="svc1" promote="C2/innerService"/>
   <!-- innerReference of component C2 is promoted as ref1 -->
   <reference name="ref1" promote="C2/innerReference"/>
</composite>
{code}



h2. {anchor:Hosting Questions}

{bgcolor:#C3CDA1}Hosting Questions
{bgcolor}

h3. {anchor:HostingA}
{bgcolor:#C3CDA1}WebSphere - java.lang.ClassNotFoundException: org.apache.tuscany.sca.host.webapp.WebSCADomain
?
{bgcolor}

f you are trying to run some of the Tuscany sample and demo web applications on WebSphere,
you may see the following exception:

{code}
Caused by: java.lang.ClassNotFoundException: org.apache.tuscany.sca.host.webapp.WebSCADomain
       at java.lang.Class.forNameImpl(Native Method)
       at java.lang.Class.forName(Class.java:169)
{code}

The solution to this problem is that you must set application properties to use the application
class loader before the parent container class loader. Then Tuscany class dependencies packaged
in your web app will be successfully loaded and resolved.

A step by step explanation and walk through is given my Jean-Sebastien at http://jsdelfino.blogspot.com/2007/10/how-to-use-apache-tuscany-with.html.

h3. {anchor:HostingB}
{bgcolor:#C3CDA1}WebSphere - java.lang.IllegalArgumentException: http://www.w3.org/2001/XMLSchema?
{bgcolor}
This means that, for some reason, you don't have the correct XML parser packages in your webapp.
Usually including Xerces and Xalan implementations in your webapp will solve this problem.
Arrange for the files xercesImpl.2.8.1.jar and xalan-2.7.0.jar to be copied to the webapp
lib folder

h3. {anchor:HostingC}
{bgcolor:#C3CDA1}WebSphere - java.net.ConnectException: Connection refused: connect?
{bgcolor}

There are a couple of likely reasons why this can happen. 

Firstly, by default, WebSphere is set up to use port 9080 while all of the Tuscany samples
are set up to use port 8080 so if, for example, you are trying to deploy samples/calculator-ws-webapp
to a default WebSphere configuration you will need to go in and change the client component
reference description to read:

{code}
    <component name="CalculatorServiceComponent">
        <implementation.java class="calculator.CalculatorServiceImpl"/>
        <reference name="addService" >
           <interface.java interface="calculator.AddService" />        
            <binding.ws uri="http://localhost:9080/sample-calculator-ws-webapp/AddServiceComponent"/>
       
        </reference>  
{code}

Another thing to watch out for is a WebSphere configuration that tells the web container to
pass requests on to the filter chain when URLs remain unsatisfied. 

{code}
com.ibm.ws.webcontainer.invokeFiltersCompatibility = true
{code}

See the details here [http://www-1.ibm.com/support/docview.wss?rs=180&uid=swg1PK31377]

{bgcolor:#C3CDA1}General SCA Questions{bgcolor}

h3. {anchor:GetTargetName}
{bgcolor:#C3CDA1}How to get Target Name from Composite without parsing? {bgcolor}
You can use the StAX to get the QName as follows:

Assuming url points to the composite file:
{oode}
              URLConnection connection = url.openConnection();
              connection.setUseCaches(false);
              XMLStreamReader reader = factory.createXMLStreamReader(connection.getInputStream());
              reader.nextTag();

              assert Constants.COMPOSITE_QNAME.equals(reader.getName());
              String ns = reader.getAttributeValue(null, "targetNamespace");
              if (ns == null) {
                  ns = XMLConstants.NULL_NS_URI;
              }
              String name = reader.getAttributeValue(null, "name");
              reader.close();
{code}


h3. {anchor:Didn't Find it}
{bgcolor:#C3CDA1}Didn't Find my answer{bgcolor}
If you still have not found your answer, please take a look at the email archive. You can
do a search on your topic. 

[User Discussion Archives|http://www.mail-archive.com/user@tuscany.apache.org/]
[User Discussion Archives (when under incubation)|http://www.mail-archive.com/tuscany-user@ws.apache.org/]
[Dev Discussion Archives|http://www.mail-archive.com/dev@tuscany.apache.org/]
[Dev Discussion Archives (when under incubation)|http://www.mail-archive.com/tuscany-dev@ws.apache.org/]
{column}
{section}


---------------------------------------------------------------------
CONFLUENCE INFORMATION
This message is automatically generated by Confluence

Unsubscribe or edit your notifications preferences
   http://cwiki.apache.org/confluence/users/viewnotifications.action

If you think it was sent incorrectly contact one of the administrators
   http://cwiki.apache.org/confluence/administrators.action

If you want more information on Confluence, or have a bug to report see
   http://www.atlassian.com/software/confluence



Mime
View raw message