-
30. Re: invoking an EJB over iiop
ymartin Feb 6, 2013 2:17 AM (in response to giufus)Thank you for your answer.
As I guess my customer will not agree seing JBoss specific annotations on its EJB3, I wonder if it may be possible to add annotations at deployment thanks to an "AOP domain" as described here: http://docs.jboss.org/ejb3/docs/reference/1.0.7/html/SessionBean_and_MDB_configuration.html
By the way, I will give a try to JBoss 7 too.
-
31. Re: invoking an EJB over iiop
ymartin Feb 6, 2013 10:45 AM (in response to giufus)Hello,
I need some help to get my EJB3 published over IIOP.
My interface Service extends EJBObject.
I have added ServiceHome which extends EJBHome
My bean ServiceBean now have to implement 5 methods I do not know how to write them:
- EJBHome getEJBHome()
- Handle getHandle()
- Object getPrimaryKey()
- boolean isIdentical(EJBObject arg0)
- void remove()
Am I on the right path ? How to implement these five methods ?
-
32. Re: invoking an EJB over iiop
giufus Feb 6, 2013 11:05 AM (in response to ymartin)To expose bean v3 over iiop in jboss 5 you need the right profile (look @ slimming jboss to know how to enable corba/iiop naming service etc...i remember "all" profile has corba enabled by default)
and ejb/interfaces like these:
1)
public interface MyRemote extends EJBObject {
String hello(String name) throws RemoteException;
}
2)
public interface MyRemoteHome extends javax.ejb.EJBHome {
MyRemote create() throws javax.ejb.CreateException, java.rmi.RemoteException
}
3)
@Stateless
@RemoteHome(MyRemoteHome.class)
@IIOP(interfaceRepositorySupported=false)
public class MySessionBean {
public String hello(String name) {
System.out.println("hello called for name: " + name);
return "Hello " + name;
}
}
then in jmx-console -> corbaNamingservice you should find the right name to use.
Note: for @Clustered EJB --> no container failover and load-balancing if invoked via IIOP
Hope this help,
bye
G
-
33. Re: invoking an EJB over iiop
ymartin Feb 7, 2013 7:23 AM (in response to giufus)With @Stateless, @RemoteHome, @Remote and @IIOP annotations, my EJB3 no longer deploys in JBoss 6.1:
12:30:01,495 WARN [Ejb3AnnotationHandler] JBMETA-4: did not find any bean meta data for annotation bean ServiceBean, will create some
12:30:01,584 ERROR [RedirectingBeanInstantiatorDeployer] Error during undeploy: SNAPSHOT.jar/: java.lang.IllegalStateException: Not installed: org.jboss.ejb.bean.instantiator/EAR/SNAPSHOT/ServiceBean
Caused by: java.lang.ClassNotFoundException: Null class name
at org.jboss.classloader.plugins.ClassLoaderUtils.checkClassName(ClassLoaderUtils.java:53) [jboss-classloader.jar:2.2.1.GA]
at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:425) [jboss-classloader.jar:2.2.1.GA]
at java.lang.ClassLoader.loadClass(ClassLoader.java:247) [:1.6.0_39]
at org.jboss.ejb3.effigy.common.JBossEnterpriseBeanEffigy.<init>(JBossEnterpriseBeanEffigy.java:52) [:0.2.0]
at org.jboss.ejb3.effigy.common.JBossSessionBeanEffigy.<init>(JBossSessionBeanEffigy.java:40) [:0.2.0]
at org.jboss.ejb3.effigy.int2.JBossBeanEffigyFactory.create(JBossBeanEffigyFactory.java:52) [:0.2.0]
at org.jboss.ejb3.effigy.int2.JBossBeanEffigyFactory.create(JBossBeanEffigyFactory.java:37) [:0.2.0]
at org.jboss.ejb3.EJBContainer.effigy(EJBContainer.java:466) [:1.7.21]
Have you got any idea about the mistake I did ? Do you recommend me to remove ejb-jar.xml and jboss.xml ?
My ejb-jar.xml
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
version="3.0">
<enterprise-beans>
<session>
<ejb-name>ServiceBean</ejb-name>
<business-remote>my.Service</business-remote>
<ejb-class>my.ServiceBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
<interceptors>
<interceptor>
<interceptor-class>org.springframework.ejb.interceptor.SpringBeanAutowiringInterceptor</interceptor-class>
</interceptor>
<interceptor>
<interceptor-class>my.RollbackExceptionInterceptor</interceptor-class>
</interceptor>
</interceptors>
<assembly-descriptor>
<interceptor-binding>
<ejb-name>*</ejb-name>
<interceptor-class>org.springframework.ejb.interceptor.SpringBeanAutowiringInterceptor</interceptor-class>
<interceptor-class>my.RollbackExceptionInterceptor</interceptor-class>
</interceptor-binding>
</assembly-descriptor>
</ejb-jar>
My jboss.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss xmlns="http://www.jboss.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss_5_1.xsd" version="5.1">
<enterprise-beans>
<session>
<ejb-name>ServiceBean</ejb-name>
<jndi-name>my.service</jndi-name>
</session>
</jboss>
Many thanks for your help
Yves
-
34. Re: invoking an EJB over iiop
giufus Feb 7, 2013 10:14 AM (in response to ymartin)If you are talking about JBoss EAP 6 I think you should have a subscription, in that case you can ask to RH Support.
As I already mentioned, I tried it in AS 5 (with EJB and interfaces into an EAR archive).
I think you don't need descriptors..
At any rate my ejb-jar.xml was:
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:ejb="http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" version="3.0">
<display-name>MySampleSession</display-name>
<ejb-client-jar>MySessionClient.jar</ejb-client-jar>
</ejb-jar>
-
35. Re: invoking an EJB over iiop
ymartin Feb 7, 2013 11:17 AM (in response to giufus)OK. I am using JBoss AS 6.1. "EAP 6" is build over JBoss AS 7...
There were errors in my Remote interface JBoss 6.1 does not report properly where JBoss AS 7.1 did.
So now my EJB3 deploys in JBoss AS 7.1
But I still completely obscure "error due to the following reason(s): java.lang.ClassNotFoundException: Null class name" in JBoss AS 6.1