I'm working with JBossAS7.
My application has some OSGI modules and big non-OSGI part.
I tried lookup osgi services in non-osgi subsystem through JNDI but they are not present in JNDI context.
I found similar problem at JBOSS 7 - Osgi Bundles not present in JNDI TREE but I dont found any solution there. If JBoss team didn't implement this functionality yet, how can I resolve this problem now?
I tried adding my service to JNDI context manually but got an exception because JNDI context is read only(according to https://issues.jboss.org/browse/AS7-421)
It's not fully integrated yet (monitor JBOSGI-81 to check the status), however I think you can make this work by taking the Apache Aries JNDI OSGi bundles and deploying them in JBoss AS7.
To do this, deploy and start
The Aries JNDI bundle
The Aries Proxy bundle
The Aries Util bundle
The JNDI bundle will complain that it can't set some statics with the NamingManager, but you can ignore that as AS7 JNDI takes care of that.
With the bundles above installed you should be able to do
osgi:service/org.foo.SomeInterface
and
osgi:servicelist
type lookups... E.g. you could try the following to look up the Start Level Service which is registered by the framework:
osgi:service/org.osgi.service.startlevel.StartLevel
I just tried it with AS7 7.1.2 and it works for me...
One thing to note, if the entity you're looking up implements an interface defined in another AS7/MSC module or OSGi bundle, you need to ensure that the consumer has visibility to it if you want to be able to cast to this interface. In the OSGi world you can just import the package, but in an AS7 module (e.g. a war file) you can achieve this by adding a Dependencies manifest header.
Related
In one of our java code we are performing a look up in WebLogic 12.2.1.3 version.
ctx.lookup("weblogic.management.server");
Apparently we received an exception NamingNotFoundException due to the JNDI name is not available in WebLogic 12.2.1.3 version , where as it is available in 12.1.3.
We also tried using foreign JNDI name feature but it doesn't resolve the problem.
Could you please provide us any suggestions or alternatives on this?
The MBean interface has been removed on WebLogic 12.2.1, then, this jndi context is no longer available. You should review your code and use another way to get your connection to the jmx server.
Ok I'm having quite some issues setting both jbpm and jboss working together...something as simple as running the jbpm process from a servlet is trunning to be a pain and all because jBoss can't find classes.
I made a Dynamic Web Project and didn't use Maven project so things are cleaner...and because it should work.
I just want to load a jbpmn2.0 from the repository in a servlet and run it using a WorkItemHanlder....but I get this:
java.lang.ClassNotFoundException: org.drools.runtime.process.WorkItemHandler
For some reason jBoss can't find a class from jBPM that should work on JBoss. What I did....and I think it's not the right solution...was add the knowledge-api.jar to the WEB-INF/lib. Although I can now deploy the app when I try to run it I get:
Error Unable to instantiate service for Class 'org.drools.builder.KnowledgeBuilderFactoryService'
I Honestly don't get why is it so hard to make a Jboss Web app using jBpm.
You need to make sure all dependencies are on your classpath, this is the same for all Java applications (not just jbpm) and application servers (not just JBossAS).
Which jars did you add? Depending on which features you are using, there could be quite a number of jars that you need to add. One option would for example would be to extract the jars in the jBPM runtime zip that is part of the jBPM downloads into your WEB-INF/lib.
If you use Maven, you would be able to automatically derive all required jars.
Kris
Can anyone explain or point me to a good resource on configuring Glassfish 3.1.1 to use the Equinox 3.7 OSGI runtime, and creating/running some simple OSGI bundle for it? Trying to work my way up to deploying an RAP application on glassfish as OSGI bundle but haven't really been able to get off the ground.
Pretty simple:
Just copy equinox jar (org.eclipse.osgi_$version.jar) to glassfish/osgi/equinox/.
Set an environment variable: GlassFish_Platform=Equinox
Start GlassFish.
Now deploy your OSGi bundles by just copying them to glassfish/domains/domain1/autodeploy/bundles/
For more information, see GlassFish/OSGi guide at
http://glassfish.java.net/public/GF-OSGi-Features.pdf
Is it possible to run Jboss 4.2.3 as a bundle inside OSGI container? What would be the challenges associated with it?
For those who cares, I am looking at running dcm4chee inside OSGI.
While not impossible it would be incredibly hard, a simpler alternative would be to embed OSGi inside JBoss, see:
http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.html
and
Programmatically Start OSGi (Equinox)?
and
http://njbartlett.name/2011/03/07/embedding-osgi.html
http://www.dcm4che.org/jira/browse/DCM-308 Looks like they're adding support to make the Jars valid bundles - couldn't you just work out the dependencies and deploy these to an OSGi framework? OSGi has support for JMX and JNDI.
Unless there are huge dependencies on JBoss' internals, I'd suggest the second option, but beware of Class.forName usage and other non-osgi-friendly code.
I logged the bug specifically for the dcm4che (note 1 e) toolkits, not the dcm4chee war. I would suggest logging a new issue for the dcm4chee assembly. However, making the dcm4che toolkit components osgi bundles would likely be a required step in the direction of getting dcm4chee to run in an osgi container.
Seam 2.1 and JBoss 4.2.2
I have set up the first App to have the EJB in the EAR with a local interface.
the 2nd app can look up JDNI name "ear-name/ejbname/local" but fails with "NoClassDefFound".
Does the EJB .jar need to be outside of the EAR?
Is this a classloader visibility issue or Is this a JBoss version issue? or something else?
Thank you for your thoughts..
I cannot answer if it will work or not. However, I can tell you how we do this.
We have created a #Webservice component that uses this EJB. And then we connect to the Webservice from our other application.
I blogged about this a while back. You can have a read if you are interested.