I'm tryng to create a remote EJB (stateless) which would expose some feature of my app. under Weblogic 10.
This SSB is going to be invoked from a Java client.
I'd like this SSB to use some services I already implemented for my web app which are packaged in a specific jar (myCode.jar).
The deployment structure would be as follows:
myApp.ear -- APP-INF -- lib -- myCode.jar -- myEjb.jar -- myWar.war
When I inject some component (packaged in myCode.jar) in my SSB (packaged in a different jar: myEjb.jar) using
@In (combined with create="true)
I get an error saying that the context is not available.
Is there a way of doing what I want to do? Can Remote EJBs be used with Seam?
All the examples I see are EJBs being invoked from the web app (backing bean) which is not my case ...
I only see local EJBs in the examples but not remote ones.
Thanks in advance,
P.S.1: We've been running the application (without the new remote EJB) under Weblogic 10.x for one year without any problems so we already did the necessary changes for Weblogic.
The old ear structure was as follows:
myApp.ear -- APP-INF -- lib -- myCode.jar -- myWar.war
All the code used from the myWar.war is inside myCode.jar
P.S.2: This is the exception message I'm getting:
nested exception is: java.lang.IllegalStateException: No application context active at org.jboss.seam.Component.forName(Component.java:1810) at org.jboss.seam.Component.getInstance(Component.java:1860) at org.jboss.seam.Component.getInstance(Component.java:1843)
It seems that the seam context are not initialized...
I faced almost the same issue, when trying invoke a remote EJB from a separated war file (outside of ear). I tried some alternatives, but I am still having problems in my application. Anyway, I'll tell you what I've done, because it could be useful for someone...
My EJB application was deployed in a ear, and nothing was calling the seam init process. What I've done was to create an empty war file inside the ear, and setting the SeamListener class. This made the seam context (that uses a ServletContext by default to place their scopes maps) begin to initialize, but I still had the same exception you had.
After a little research in documentation, I developed an interceptor for the EJBs facades, that invokes the Lifecycle.beginCall(), proceed, and the LifeCicle.endCall(). Then, the
No application context activeappeared to end, but the Seam annotations (@In, @Out) caused no efects, ie, simply the seam didn't inject the components... In JBoss and Glassfish, it works, but in weblogic don't.
Debugging my application I've seen that the weblogic makes a
wrapperfor EJB classes, and when the Interceptor runs, the InvocationContext.getTarget() returns an object of weblogic
wrapperclass type, instead of EJB class type itself. It doesn't occurs on Glassfish and JBoss, where InvocationContext.getTarget() returns an object of EJB class itself. So, the class that is intercepted is not a seam annoted class, and the annotations doesn't work. (It can carry the annotations in its superclass, but it is not mapped by the seam, that do not recognizes the weblogic generated classes)
Then, I left it, (i have my deadline) and started to use seam only in web application. In my Ejb app I am using the default container dependency injection.
Another thing that made me crazy was the fact that weblogic 10.3 DO NOT register in JNDI Locals EJBs (because of performance!!!!!). As seam uses internaly Context.lookup to create the EJB components, whit the @jndiPattern@, the only way was to declare ALL my EJBs remote...
Well, these are my problems and I am waiting for a way to learn and fix it. Meanwhile, I am using seam only in my web module...