How to control order of deployment (EJB first and then MBeans deployment) in Wildfly 8.2.0 AS - ejb-3.1

I am migrating an EAR application containing MBeans from JBoss 6 AS to Wildfly 8.2.0 AS. In my EAR application, MBeans depend on EJB before initialization.
In JBoss 6 AS, #DependsOn annotation used in MBean maintained the sequence of the deployment i.e. Dependent EJB gets deployed and then, MBean gets deployed.
In Wildfly 8.2.0, I am trying to implement the same and #DependsOn is not working.
I tried the below in jboss-service.xml to have MBeans deployed only after the deployment of EAR file but this did not happen.
<mbean code="sample.HelloWorldService" name="sample:service=HelloWorld,id=1">
<depends>jboss.j2ee:service=EARDeployment,url='application.ear'</depends>
</mbean>
I also tried #startup in EJB but I cannot control the sequence i.e. 1. EJB deployment 2. MBeans deployment.
Can anyone please help about how to control the order of deployment in Wildfly 8.2.0. I need to deploy EJB first and then MBeans. Many thanks.

Just a comment
About the EJB that you want to get from the MBeans, maybe you are misunderstanding the specificaction of jboss-deployment-structure.xml. It express an initialization dependency between singleton components (even if the related EJB are singleton be aware about possible problems with DependsOn like WLFY-4251).
Workaround
Due to you are working with Jboss/Wildfly Server, you have the option to use the jboss-deployment-structure.xml for specify dependency between modules.
Perhaps, as your are packing all in the same EAR application, you can separate the components into modules, let's say one MBean.sar module that contains the MBeans and other RelatedEJBs.jar module with the EJBs referenced by your MBeans.
Then you define the next dependency of MBeans.sar over RelatedEJBs.jar,
<jboss-deployment-structure>
...
<sub-deployment name="RelatedEJBs.jar">
...
</sub-deployment>
<sub-deployment name="MBeans.sar">
<dependencies>
<!-- Adds a dependency on the ejb jar. This could also be done with a Class-Path entry -->
<module name="deployment.YouApp.ear.RelatedEJBs.jar" />
</dependencies>
</sub-deployment>
</jboss-deployment-structure>
Edit: A useful migration guide to Wildfly.

Related

Deploying camel spring application in Apache Karaf 4.2.0

I am trying to deploy camel spring application in apache karaf. I am using maven to resolve the dependencies. The application runs fine in Intellij but when I deploy the application (along with all the project dependencies) in karaf the application won't start.
Can anyone tell me what is the correct way to deploy camel spring application in karaf?
And also the best approach in resolving the project dependencies?
Camel-version: 2.16.5
Karaf: 4.2.0
If the application is not starting, then it might be waiting for some resolvable dependency. Check the log and install the dependency manually using feature:install. Also ensure all libraries are properly mentioned in pom.xml

Migration from tomcat to wildfly

I am migrating my web application from tomcat to wildfly. I was able to deploy the app using a temporary workaround of placing the configurations inside the WEB-INF/web.xml (). But I wanted it outside my war file. Is there any equivalent for catalina/conf/localhost/myapplicationconfig.xml in wildfly. Any suggestions please. I tried naming subsytem configuration and also placing it in modules but it didn't work for me

Including camel-test-spring causes NoClassDefFoundError for DefaultParameterNameDiscoverer

I have a Camel project using Maven to build and manage dependencies. My project depends on Camel component versions 2.14.0. I've matched Spring dependencies with Camel and use Spring component versions 3.2.11.RELEASE. However, if I include camel-test-spring version 2.14.0 as a dependency in the test scope it pulls in both spring-beans version 4.0.7.RELEASE and spring-expression 4.0.7.RELEASE into the runtime scope, which result is my application throwing java.lang.NoClassDefFoundError: org/springframework/core/DefaultParameterNameDiscoverer. Oh, btw, the application boots from a Java main method with org.apache.camel.spring.Main.
Adding exclusions for both spring-beans and spring-expression into the POM dependency for camel-test-spring resolves the runtime exception but I'm not sure if this is the right thing to do. Does anyone have more insight into why camel-test-spring 2.14.0 depends on the 4.0.7.RELEASE versions of spring-beans and spring-expression when most (all?) the other Camel 2.14.0 components seem to depend on 3.2.11.RELEASE versions of Spring components?
Regards,
Matt
Please you camel-test-spring3 which support Spring 3.x instead of camel-test-spring (for Spring 4.0.x).

With maven, do I still need to configure jdb driver and datasources?

I want to write an Java EE 6 app, on JBoss 7.1, with JPA (Hibernate as JPA provider) and SqlServer.
The build tool is, for better or worse, Maven 3.
What does Maven arrange/set up for me in terms of connecting Jboss 7 to a database and JPA?
Do I need to set up a JDBC driver, as well as a datasource, or does Maven automagically set these up for me via transitive dependencies and its build cycle? In other words, do I need go into standalone.xml as well as into the module folder and modify a module.xml file, etc?
I can't find a tutorial that has all of the steps or a sample pom.xml.
No Maven will not automagically set up dependencies on JDBC providers. You must declare them explicitly in your own project pom.
As far as a tutorial, the canonical references and tutorials are on the Sonatype web site.
See: Maven by Example
and specifically regarding project dependencies in Maven: the Complete Reference:
http://books.sonatype.com/mvnref-book/reference/pom-relationships-sect-project-dependencies.html

ServiceMix (FuseESB) fails to find Camel javascript support when jar starts up

When deploying a Camel route to FuseESB, as FuseESB tries to start up the jar file, it gives the following exception in the log:
Found initial references null for OSGi service (&(language=js)
(objectClass=org.apache.camel.spi.LanguageResolver))
This causes the bundle to enter a grace period for a few minutes, after which it times out and its status moves to failed. Note that I'm not using javascript in the application, but I assume it is loaded as part of loading Camel core.
Details of my setup:
Code in question is written using an OSGi blueprint xml file to define the beans.
Code is packaged as a jar, as opposed to an OSGi bundle.
Code is deployed by being dropped into the deploy directory so it is deployed by the FAB deployer.
I believe I have the relevant Camel features installed.
Output from features:list:
[installed ] [2.10.0.fuse-71-047] camel-script-javascript camel-2.10.0.fuse-71-047
[installed ] [2.10.0.fuse-71-047] camel-script camel-2.10.0.fuse-71-047
I have worked around this by:
reverting to a spring xml file to define the beans
packaging the code as a bundle, not a jar
I still don't understand why the Blueprint version didn't work, but the question is now less urgent than it was.
With FAB you should declare the dependencies to your Camel components in your pom.xml file, and use scope=provided.
See more details at: http://fuse.fusesource.org/bundle/overview.html

Resources