Seam EJB3 in an EAR is it usable by another App? - jboss

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.

Related

Accessing OSGi bundle's interface from an EJB

I have a very basic knowledge of OSGi and I would like to ask the following questions:
Is it possible to call a service or interface of OSGi from an EJB in the JBoss 7.1 server running?
If yes, let's say I have an EJB that implements "HelloWorld" from a bundle. What exactly happens in the runtime if I stop this bundle and start another one?
I would really appreciate if anyone can provide an example how to do manage this.
Thank you!

How to use CDI on TomEE

I'm currently writing JSF code and using Mojarra 2.1.6-FCS, using Tomcat and Eclipse Juno. Now I want to move to CDI, for I discovered it's more practical than JSF.
I need to know stuff like whether I need web.xml and faces-config.xml in order to write and run CDI code; in JSF it's not required.
I just need easy step-by-step instructions for deploying to TomEE. Any flash put into my asking would be way appreciated, thanks a punch.
You don't need web.xml or faces.config.xml just to use CDI. The only thing you need is beans.xml (which can be an empty file!), placed inside the WEB-INF directory.
I can't give you step-by-step instructions for deploying a CDI application on TomEE, but it should be no different to deploying any other application. Have you read the TomEE and Eclipse tutorial?
here a sample http://tomee.apache.org/examples-trunk/jsf-cdi-and-ejb/
hope it will help you

JNDI lookup JBoss Application Server 7

How can I access remote EJB in Jboss AS 7? When I deploy application on Jboss AS 7 , I can see portable jndi names but unable to access using same name.
Will be implemented in JBoss AS 7.1: https://issues.jboss.org/browse/AS7-1338
Make sure your ejb module has the same class loader with the module which needs the access of EJB.
and then, use these code
InitialContext ic = new InitialContext();
ic.lookup(*the jndi name you see*);
Doesn't this work if you start as -server-config standalone-preview.xml ?
Since this turns on the rest of the JavaEE6 (not certified though). I'm talking about the Jboss 7.0.2 (Everything).
Good luck!
I solved with latest release of JBoss 7.1

Use singleton EJBs in Eclipse Projects

I just downloaded some days ago the last versions of Eclipse and JBoss, created a SessionBean (EJB3.x) project and now I'm trying to create an Singleton EJB, but eclipse is not allowing me to do it and gives me the folowing warning message " The 'Singleton' state type is allowed only for EJB projects with version 3.1 or later". Unhappily, when I create the project, the hihgst version possible is 3.0.
What am I doing wrong? I need a singleton Ejb now!!!
Thanks in advance,
Saul
Problem solved!
Indeed Jboss 5.1 didn't support EJB 3.1, but JBoss 6.0 does!
Just an observation to those are facing this same problem. Eclipse doesn't have the adapter for JBoss 6.0, but if you use the one provided for JBoss 5.0 it works just fine (I read somewhere there might be some problems, but at least till now, it's ok).
Also, if you try to create an singleton EJB through Eclipse, it'll not work, but you can create another type of EJB and then change the annotation to #Singleton and it'll work.
Best Regards,
Saul

Java EE6 App + EJB in Glassfish 3.0/Netbeans 6.8?

Has anyone got this configuration working?
Latest Netbeans, latest Glassfish, I created an EJB project, also an EE Application.
The EJB in itself builds & deploys to Glassfish OK.
Now when I want to reference the EJB, I have to add the EJB jar to the EE Application path, if I don't do this the code does not compile.
But, the EJB jar gets packaged in the App jar and as a result when I try to deploy the app to Glassfish it says:
"java.lang.IllegalArgumentException:
Sniffers with type [ejb] and type
[appclient] should not claim the
archive at the same time. Please check
the packaging of your archive"
How do I tell Netbeans NOT TO package the EJB in the App jar? Or is the problem somewhere else?
btw. if I remove the EJB manually from the JAR then the app deploys successfully (with asadmin deploy), but when I try to run it with appclient, I get a NullPointerException.
Surely there must be a solution to this, I thought Netbeans was for web application development after all...
Edit: I found this:
http://forums.netbeans.org/topic23499.html
Which lists exactly the same steps that I did to resolve the problem.
Here is a solution candidate:
https://netbeans.org/bugzilla/show_bug.cgi?id=183488
Which basically says that Glassfish v3 is seriously broken, and it won't work.
Here is how I got it to work: the EJB and the EE Application MUST BE packaged in an EAR (project), and they MUST BE deployed within the EAR. Deploying the application jar individually WILL NOT WORK (at least not with Netbeans 6.8 + Glassfish v3).