-
1. Re: sca binding from ear to standalone component
jorgemoralespou_2 Feb 11, 2015 3:02 PM (in response to mlybarger)Hi Mark,
There are some issues related to sca, serialization and classloader propagation that were solved on Rollup patch 3. Please update from Rollup 2 to 3 and try again.
If that problem is not solved, you should own a support case given it is FSW.
I would also recommend you to try your app in switchyard 2 (latest) and to answer back here with your findings.
-
2. Re: sca binding from ear to standalone component
mlybarger Feb 11, 2015 3:10 PM (in response to jorgemoralespou_2)Thanks Jorge,
I'll see about the patch. Obviously, i'm on FSW, and as such, using SY 2 isn't going to be as easy as getting a rollup patch migrated.
-mark-
-
3. Re: sca binding from ear to standalone component
kcbabo Feb 11, 2015 6:18 PM (in response to mlybarger)+1 to Jorge's advice. Whether you have the patch or not, make sure there aren't multiple copies of this class floating around in your deployments. Any classes/resources shared between applications should be isolated in a separate module which is then a dependency of the apps which use those classes/resources. So in this case, make sure org.test.Context is in a separate jar and that the class is not packaged inside your ear or jar applications (you would add a dependency in these applications to the separate jar containing org.test.Context).
-
4. Re: sca binding from ear to standalone component
jorgemoralespou_2 Feb 12, 2015 3:11 AM (in response to kcbabo)Hi Mark,
Yes, I forgot to mention what Keith says cause I assumed you were doing it like that, but anyway, I've written a short description of what Keith mentioned before, so it can help more people.
http://unpoucode.blogspot.se/2015/02/where-to-bundle-switchyard-applications.html
-
5. Re: sca binding from ear to standalone component
jorgemoralespou_2 Feb 12, 2015 3:14 AM (in response to jorgemoralespou_2)And by the way,
Even if you are using FSW 6.0, you can deploy you app on top of Sy 2, just for testing purposes. If you are a supported FSW customer, which I guess you are, I also encourage you to try your app in SY2, as early as possible (on a separate server) to be able to detect defects so whenever next release of FSW comes out every little issue has been addressed, and there are no backward incompatibility effect affecting you. Also, you'll be able to affect the release, and avoid having to wait for a further Rollup patch on top of FSW for any issue that you might find.
These is just an advice.
Cheers,
-
6. Re: Re: sca binding from ear to standalone component
mlybarger Feb 12, 2015 1:50 PM (in response to jorgemoralespou_2)Thanks so much for all the replies. What is the recommended method to package/deploy api classes? The quickstart-demo-cluster (dealer and credit) suggests that the api classes (Bar and ComplexMessage in the below example) are copied between services. Note that this works fine when foo-jar.jar and bar-jar.jar are deployed without the ear wrappers. When the interface classes present in both jar files, and deployed as ear, an exception is thrown at runtime:
Caused by: org.switchyard.SwitchYardException: SWITCHYARD010813: Cannot convert from 'com.example.switchyard.bar.ComplexMessage' to 'com.example.switchyard.bar.ComplexMessage'. No registered Transformer available for transforming from 'java:com.example.switchyard.bar.ComplexMessage' to 'java:com.example.switchyard.bar.ComplexMessage'. A Transformer must be registered.
at org.switchyard.bus.camel.CamelMessage.getBody(CamelMessage.java:91) [switchyard-bus-camel-1.1.1-p7-redhat-1.jar:1.1.1-p7-redhat-1]
at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:47) [camel-core-2.10.0.redhat-60061.jar:2.10.0.redhat-60061]
at org.switchyard.bus.camel.CamelMessage.getContent(CamelMessage.java:64) [switchyard-bus-camel-1.1.1-p7-redhat-1.jar:1.1.1-p7-redhat-1]
at org.switchyard.component.bean.Invocation.castArg(Invocation.java:86) [switchyard-component-bean-1.1.1-p7-redhat-1.jar:1.1.1-p7-redhat-1]
foo-ear.ear/foo-jar.jar
bar-ear.ear/bar-jar.jar
where Bar has the interface:
public interface Bar {
public String message( String message );
public String complexMessage( ComplexMessage complexMessage );
}
.. and ComplexMessage is:
public class ComplexMessage {
private String message;
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
-
7. Re: sca binding from ear to standalone component
kcbabo Feb 12, 2015 1:56 PM (in response to mlybarger)Check out demos/multiApp for an example of how shared classes can be isolated. It doesn't use EAR packaging for any of the apps, but the same basic principle applies.
The demos/cluster set of applications can get away with packaging the same class in multiple applications because those applications are distributed across multiple servers and SY uses JSON serialization between instances in a cluster.
-
8. Re: Re: sca binding from ear to standalone component
mlybarger Feb 12, 2015 4:20 PM (in response to kcbabo)thanks for the insight. from what i understand of the multiApp, the shared classes are put into an artifacts jar and that is deployed to the container. i wasn't successful with my attempt. i modified my above example to use a bar-artifacts.jar that contains the Bar and ComplexMessage classes. I deployed the bar-artifact to the container, but when I deploy bar-ear, it can't find the classes in bar-jar.
15:21:17,346 INFO [org.jboss.as.repository] (management-handler-thread - 5) JBAS014900: Content added at location C:\Users\Lybama01\Downloads\tools\jboss-eap-6.1\standalone\data\content\98\30f48acf9ab608f082fd19ca8989daabf918c4\content
15:21:17,347 INFO [org.jboss.as.server.deployment] (MSC service thread 1-5) JBAS015876: Starting deployment of "bar-artifact-0.0.1-SNAPSHOT.jar" (runtime-name: "bar-artifact-0.0.1-SNAPSHOT.jar")
15:21:17,612 INFO [org.jboss.as.server] (management-handler-thread - 5) JBAS018559: Deployed "bar-artifact-0.0.1-SNAPSHOT.jar" (runtime-name : "bar-artifact-0.0.1-SNAPSHOT.jar")
15:22:04,526 INFO [org.jboss.weld.deployer] (MSC service thread 1-1) JBAS016008: Starting weld service for deployment bar-ear-0.0.1-SNAPSHOT.ear
15:22:04,557 INFO [org.switchyard] (MSC service thread 1-7) Deploying SwitchYard application 'bar-0.0.1-SNAPSHOT.jar'
15:22:04,604 WARN [org.jboss.modules] (MSC service thread 1-1) Failed to define class com.example.switchyard.bar.BarBean in Module "deployment.bar-ear-0.0.1-SNAPSHOT.ear.bar-0.0.1-SNAPSHOT.jar:main" from Service Module Loader: java.lang.LinkageError: Failed to link com/example/switchyard/bar/BarBean (Module "deployment.bar-ear-0.0.1-SNAPSHOT.ear.bar-0.0.1-SNAPSHOT.jar:main" from Service Module Loader)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:427) [jboss-modules.jar:1.2.2.Final-redhat-1]
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:260) [jboss-modules.jar:1.2.2.Final-redhat-1]
<cut>
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
Caused by: java.lang.NoClassDefFoundError: com/example/switchyard/bar/Bar
at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.7.0_51]
at java.lang.ClassLoader.defineClass(ClassLoader.java:800) [rt.jar:1.7.0_51]
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:344) [jboss-modules.jar:1.2.2.Final-redhat-1]
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:422) [jboss-modules.jar:1.2.2.Final-redhat-1]
... 20 more
-
9. Re: Re: sca binding from ear to standalone component
jorgemoralespou_2 Feb 12, 2015 4:45 PM (in response to mlybarger)Hi Mark,
As I mentioned on the blog, you need to reference the artifacts.jar needs to be referenced either in the META-INF or in the jboss-deployment-structure.xml file as a dynamic module (in this case, so deployments.arifacts.jar would be the name of the module.
Cheers,