Guiseppe,
Namespaces are used in the XML file to provide context to the elements
and to disambiguate whenever multiple element have the same name, e.g.
jms:endpoint, http:endpoint, ... in the case of servicemix. Your
xml-elab-su xbean.xml is missing the namespace declaration for your own
service engine. It should look about like this:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:beppe="http://giuseppe.org/beppe"
xmlns:se="http://namespace/of/your/se">
<se:endpoint service="beppe:xmlelab" endpoint="endpoint"/>
</beans>
You can find out your SE's namespace by looking in your source
xml-elab-se/target/xbean/xml-elab-se.xsd at the targetNamespace.
Next, there is difference in installing the SE and deploying your SA. Have a
look at [1] for a more detailed description of what goes in which directory,
but for your project:
- you install the SE by copying it to <SERVICEMIX_HOME>/install (in your case,
copy xml-elab-se.zip there)
- you deploy the SA by copying it to <SERVICEMIX_HOME>deploy (in your case,
copy xml-elab-sa.zip there)
There is no need to deploy/install the separate service units, as they are
already part of your service assembly. Only copy the two files mentioned above.
Gert
[1] http://incubator.apache.org/servicemix/6-configuring-servicemix.html
beppe82 wrote:
Hi, so this is my situation: I created a eval-smx folder; under that, I have
xml-elab-se, created with maven archetype, which just does a
Systtem.out.println() and sends back "done" when it receives a "in" message;
a xml-elab-su, created with maven, contains the following xbean.xml file
under src/main/resources:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:beppe="http://giuseppe.org/beppe">
<endpoint service="beppe:xmlelab" endpoint="endpoint"/>
</beans>
Further, I have a ftp-poller-su which contains the following xbean.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:ftp="http://servicemix.apache.org/ftp/1.0"
xmlns:beppe="http://giuseppe.org/beppe">
<ftp:poller service="beppe:ftp" endpoint="poller"
targetService="beppe:xmlelab" targetEndpoint="endpoint"
uri="ftp://localhost" />
</beans>
At the end, I created a SA whit the following pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>eval.smx</groupId>
<artifactId>eval-smx-sa</artifactId>
<packaging>jbi-service-assembly</packaging>
<version>1.0</version>
<name>SA per eval-smx</name>
<url>http://www.myorganization.org</url>
<pluginRepositories>
<pluginRepository>
<id>apache.incubating</id>
<name>Apache Incubating Repository</name>
<url>http://people.apache.org/repo/m2-incubating-repository</url>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>apache.incubating</id>
<name>Apache Incubating Repository</name>
<url>http://people.apache.org/repo/m2-incubating-repository</url>
</repository>
</repositories>
<properties>
<servicemix-version>3.1-incubating</servicemix-version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>eval.smx</groupId>
<artifactId>xml-elab-su</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>eval.smx</groupId>
<artifactId>ftp-poller-su</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.servicemix.tooling</groupId>
<artifactId>jbi-maven-plugin</artifactId>
<version>${servicemix-version}</version>
<extensions>true</extensions>
<configuration>
<type>service-assembly</type>
</configuration>
</plugin>
</plugins>
</build>
</project>
Now, I copied xml-elab-se, xml-elab-su and ftp-poller-su to install
directory under servicemix. I launch servicemix with bin\servicemix and,
from another prompt and under eval-smx-sa directory, I write mvn
jbi:projectDeploy.
Here's what I get:
ERROR - AutoDeploymentService - Failed to update Service Assembly:
eval
-smx-sa
java.lang.Exception: <?xml version="1.0" encoding="UTF-8"?>
<jbi-task xmlns="http://java.sun.com/xml/ns/jbi/management-message"
version="1.0
">
<jbi-task-result>
<frmwk-task-result>
<frmwk-task-result-details>
<task-result-details>
<task-id>deploy</task-id>
<task-result>FAILED</task-result>
<message-type>ERROR</message-type>
</task-result-details>
</frmwk-task-result-details>
</frmwk-task-result>
<component-task-result
xmlns="http://java.sun.com/xml/ns/jbi/management-message"
<component-name>xml-elab-se</component-name>
<component-task-result-details>
<task-result-details>
<task-id>deploy</task-id>
<task-result>FAILED</task-result>
<message-type>ERROR</message-type>
<task-status-msg>
<msg-loc-info>
<loc-token/>
<loc-message>No endpoints found</loc-message>
</msg-loc-info>
</task-status-msg>
</task-result-details>
</component-task-result-details>
</component-task-result>
<component-task-result
xmlns="http://java.sun.com/xml/ns/jbi/management-message"
<component-name>servicemix-ftp</component-name>
<component-task-result-details>
<task-result-details>
<task-id>deploy</task-id>
<task-result>SUCCESS</task-result>
</task-result-details>
</component-task-result-details>
</component-task-result>
</jbi-task-result>
</jbi-task>
at
org.apache.servicemix.jbi.framework.ManagementSupport.failure(Managem
entSupport.java:121)
at
org.apache.servicemix.jbi.framework.ManagementSupport.failure(Managem
entSupport.java:107)
at
org.apache.servicemix.jbi.framework.DeploymentService.deployServiceAs
sembly(DeploymentService.java:563)
at
org.apache.servicemix.jbi.framework.AutoDeploymentService.updateArchi
ve(AutoDeploymentService.java:334)
at
org.apache.servicemix.jbi.framework.AutoDeploymentService.updateExter
nalArchive(AutoDeploymentService.java:201)
at
org.apache.servicemix.jbi.container.JBIContainer.updateExternalArchiv
e(JBIContainer.java:473)
at
org.apache.servicemix.jbi.container.JBIContainer.updateExternalArchiv
e(JBIContainer.java:483)
at
org.apache.servicemix.jbi.framework.AdminCommandsService.deployServic
eAssembly(AdminCommandsService.java:229)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.jav
a:216)
at
org.apache.servicemix.jbi.management.BaseStandardMBean.invoke(BaseSta
ndardMBean.java:318)
at
com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImp
l.java:213)
at
com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:220)
at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultM
BeanServerInterceptor.java:815)
at
com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:784
)
at
javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnecti
onImpl.java:1408)
at
javax.management.remote.rmi.RMIConnectionImpl.access$100(RMIConnectio
nImpl.java:81)
at
javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run
(RMIConnectionImpl.java:1245)
at java.security.AccessController.doPrivileged(Native Method)
at
javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(R
MIConnectionImpl.java:1348)
at
javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImp
l.java:782)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
at
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:4
60)
at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
.java:701)
at java.lang.Thread.run(Thread.java:595)
What happens? Thanks for the patience...
P.S.: Can you also explain me how to use xml namespaces, please?
Gert Vanthienen wrote:
You have to add an xbean.xml file to your service unit project, to
describe the configuration for your service unit. Add an xbean.xml file
to hello-world-su/src/main/resources with this contents and rebuild the
project.
<beans
xmlns:hello="http://org.apache.servicemix.samples.helloworld.se/1.0"
xmlns:beppe="http://guiseppe.org">
<hello:endpoint service="beppe:service" endpoint="endpoint"/>
</beans>
Now, create a second service unit project, now containing this xbean.xml:
<beans xmlns:ftp="http://servicemix.apache.org/ftp/1.0"
xmlns:beppe="http://guiseppe.org">
<ftp:poller service="beppe:ftp" endpoint="poller"
targetService="beppe:service" targetEndpoint="endpoint"
uri="ftp://anonymous:[EMAIL PROTECTED]" />
</beans>
beppe82 wrote:
Hi all, please help me because it's three days I'm wasting my time into
things that I think are not too difficult (but I can't do that!).
I have a simple SU, written following the tutorial about hello world SE.
My
process() method just receive a "in" message, print a phrase (using
System.out.println(...)... can I use this method to write on standard
output?) and sets exchange status to "done". I'd like to use it together
with the ready component ftp-poller... can you write me a step-by-step
guide
to do that? I'm not able to integrate, build and deploy this very simple
application... I'm a bit confused about using maven, or using ant, using
servicexml.xml... I don't exactly know what to do! Thank you very much,
Giuseppe