Guideline for defining modules in Jboss AS 7 - jboss7.x

is there any guideline for defining modules in JBoss AS 7/6.2 EAP ?
e.g
Is it wrong if we define a module like
jboss/modules/systems/layers/base/com/myproj/lib/main/
instead of
jboss/modules/com/myproj/main/
since in jboss the class/jar loading happens through defined module.xml.

You should not put your modules under the system layer. It will work, but the correct way is to put it directly under modules.
More information about the topic:
Chapter Configuring Modules in the EAP Administration Guide
Sample of installing a JDBC driver as a core module in the Administration Guide
Article about the Layered Distributions and Module Path Organization in the EAP & Wildfly

Related

How to vizualize spring integration file in intellij idea 14?

On the page https://www.jetbrains.com/idea/whatsnew/ it is said that Intellij Idea 14 has got a visual diagrams for spring integration.
But I can't find how to visualize my integration xml file.
(right click on file)/Diagrams/Show Diagram... shows a diagram with links between the beans. It is not very usefull.
Spring Integration Patterns plugin is enabled
I have Intellij Idea installed on a computer without access to the internet. May it be the reason why the diagrams are not working properly?
What do you want to see there?
For example.
We have stomp-chat sample: https://github.com/spring-projects/spring-integration-samples/tree/master/applications/stomp-chat
And here is a diagram for this config: https://github.com/spring-projects/spring-integration-samples/blob/master/applications/stomp-chat/src/main/resources/org/springframework/integration/samples/chat/stomp/server/stomp-server.xml
I'd say that it is OK, however I agree that it would better if I'd provide id attribute for all components.
Of course, Spring Integration Patterns plugin has to be switched on.
This link helps - https://devnet.jetbrains.com/message/5529839#5529839
"Please make sure the XML file is correctly configured in Spring context setup via Spring facet.
It requires spring-integration-core to be in module dependency of selected XML file."
I had the same problem, and found that in addition to having the Spring facet enabled, and having the spring-integration-core dependency and having the relevant context file set as an application context under the facet, you also need to have just the containing module open. i.e. the stomp-chat spring-integration sample provides the "Spring Integration" diagram option if it is opened from its own pom.xml, however if you open the parent applications\pom.xml then the "Spring Integration" diagram option is not available, regardless of facets etc.
I have the same problem in a project where I use spring integration 2.1.4.
In a newer project I use 4.0.0 and there Intellij Idea offers the option to open the spring integration diagram.
Perhaps that is the reason and you "only" need a newer version of spring integration.
The issue is that the newer versions of Intellij create separate modules per source set by default which somehow ends up conflicting with earlier setups. Using Intellij 2016.1, I instead reimported my project with the following options checked:
Once I did that then (right click on file)/Diagrams/Show Diagram once again gave me the Spring Integration Option.
Yes, click on your Spring Integration context file > Diagrams > Show Diagram... > Spring Integration., but if you haven't this menu follow below:
You should have identified integration context as Spring XML based configurations. Instruction here : Create a Intellij file set
I don't know why, but I had a problem with Spring Integration Diagram when I installed Springirun plugin.

Deployment of GridGain 6 as a custom module in JBoss 7.1.1-Final

We have attempted to package and deploy GridGain 6 as a custom static module within our JBoss 7.1.1-Final application server. When run locally, the configuration appears to work and grid jobs are executed by the local node, but when a job is executed on a remote node we get a ClassNotFoundException which appears to indicate that the module code cannot find a class that is contained within the EAR file that is deployed in that instance of JBoss.
Caused by: java.lang.ClassNotFoundException: com.our.company.CustomGridJob from [Module "com.gridgain:main" from local module loader #5e48a0e1 (roots: /path/to/jboss/modules)]
From initial debugging it looks like the GridGain module is attempting to un-marshal the serialized message it receives from the network and is looking for the class to construct to initiate the job that it was sent. When the same job is executed locally we assume the serialization/un-marshalling part doesn't happen as there is no network to traverse, so local execution works.
The class it is looking for is present in the EAR deployed to the server so it would appear to be a classloading visibility issue. Is it possible to make modules 'aware' of code that is deployed to the container? If so, how?
If this approach of deploying GridGain isn't possible are there any other alternatives to simply packing GridGain with our EAR deployment in the /lib directory of the EAR? (Which would really bloat the deployment). How have others deployed GridGain 6 in JBoss 7?
Any advice appreciated.
Thanks.
According to JBoss classloading documentation, every module can declare dependencies on other modules. I am not sure if static module can declare a dependency on dynamic module (if yes, problem is solved). If not, then you can deploy GridGain as a separate dynamic module, and declare a dependency from GridGain module to your EAR module. The EAR module would have to declare a dependency on the GridGain module (I believe that circular dependencies are supported).
This way all classes declared in the EAR module should be visible to the GridGain module.
Let me know if this works for you.

What is Java EE Endorsed API?

See here.
There are three different Java EE related API:s available in the Maven repository.
Specification APIs (Maven artifact: javaee-api)
Web Specification APIs (javaee-web)
Endorsed APIs (javaee-endorsed-api)
I know the specification API (the full blown suite of Java EE API:s) and the web API (a subset of the former, implemented by some application servers).
But what is the "endorsed API" and do I need to care?
Note: I did find this link but it tells me nothing.
I was having problems running a project because of this dependency in NetBeans. Installing "EJB and EAR" plugin solved it for me.
Looks to be GlassFish related. Download the jar and execute:
jar -tf javaee-endorsed-api-7.0.jar
Actually, if you look at the table in the "Standalone Technologies" section of that link you referenced, there seems to be a very good correspondence between the classes included in the javaee-endorsed-api-7.0.jar and the items in the table. I would say it seems that the jar is bundling up these for GlassFish so that the jar can be dropped into
<java-home>/lib/endorsed
And then become available to applications deployed on the GlassFish server.

To use ServiceMix my project has to be an OSGi bundle?

I' starting to use ServiceMix and Camel and I've run through many examples.
It seems that the examples that are OSGi can be deployed in ServiceMix via hot deploy or via console, but I don't know how to deploy a project that is not an OSGI. Can it be done?
For example, I'm looking at the example project from Camel 2.10.0 called camel-example-cxf-proxy. I did some alterations and now I wanted to load it in ServiceMix. If I copy/paste to the deploy directory it is loaded but when I try to run it via osgi:start id it fails.
However if I run it from the IDE as a standalone it runs just fine and I can send and receive requests via SoapUI.
When I'm done with the examples I'll want to create my own project in eclipse and do tests in the IDE and in ServiceMix. I don't really understand the advantage of OSGi yet. SO I'm not too compelled to use OSGi for my project.
My main question is: Can I deploy a non-OSGi non-JBI compliant project in servicemix? Something like the camel-example-cxf-proxy. If yes, how can I do it? If no, how can I OSGi-fy the camel-example-cxf-proxy?
Thank you :)
Apache ServiceMix which uses Apache Karaf as its kernel, support pluggable deployment units. Though OSGi is the main unit.
You can deploy JBI artifacts (eg JBI was used as deployment units for Apache ServiceMix 3.x). So we offer that as a migration path to run JBI in SMX 4.x.
A plain WAR file can be deployed as well. You can for example just drop a .war file in the deploy directory. If you deploy from the shell, you need to prefix the deployer with war so it knows to use the war deployer.
There is some documentation about the various pluggable deployers here
http://fusesource.com/docs/esbent/7.0/esb_deploy_osgi/UrlHandlers.html
For example to install an Apache Wicket WAR example using Maven you can do from the shell:
osgi:install war:mvn:org.apache.wicket/wicket-examples/1.4.7/war?Web-ContextPath=wicket
The Apache documentation about deployer is mainly documented at Apache Karaf
http://karaf.apache.org/manual/2.2.9/users-guide/deployer.html
Now to deploy OSGi applications can be a bit of pain to assemble. And that is why FuseSource created FAB to make it much easier. I blogged about this a bit, which references to videos and more material: http://www.davsclaus.com/2012/08/osgi-deployment-made-easy-with-fab.html
With FAB you can just deploy regular Maven projects out of the box without any OSGi pain.
If your project is a maven project, you can try :
mvn install
Then start your servicemix, and in servicemix command line :
install mvn:groupId/artifactId/version
This will prompt a bundle ID. Then, juste start the bundle :
start <bundle_id>
You can check the state of your bundle with command "list"
The project has to be a bundle to be installed in servicemix / karaf. So the steps to make a camel project work in OSGi are the following.
Use the maven bundle plugin in the pom and configure it to import / export the necessary packages if necessary.
Make sure your camel context is defined in a way that OSGi can start. This is either in the activator of the bundle or in a spring config in the right location or with a blueprint config in the right location.
See two of my karaf tutorials for the details:
CXF: http://www.liquid-reality.de/x/EoBk
Camel: http://www.liquid-reality.de/x/G4Bk

JBoss AS 6 Maven repository

I am upgrading an system I have been developing for some time now to JBoss AS 6 (6.0.0-Final). Everything works well with JBoss but I can't find a maven repository. I read the information on their web-site which directs me to: https://repository.jboss.org/nexus/content/repositories/releases
However it only contains Jboss 4.2.3.GA?!
I believe that my question is incorrect. This is what I believe is the correct answer:
Maven2 always uses http://repo1.maven.org/maven2/ as a fallback when packages are not found in the repositories supplied. So one should supply the jboss repository, https://repository.jboss.org/nexus/content/groups/public-jboss/, but it will only contain jboss specific packages. For everything else (javaee packages and so on) the maven2 fallback reposity should be used.
I didn't understand that a Maven2 repository was always used as a fallback. So I got confused when I couldn't find the packages I needed in the Jboss repository.
The groupId has changed to org.jboss.as
Here are some 7.x Alpha releases
And here are some 6.x release links through nexus (couldn't find a browsable version of these)