I have simplified my CORBA client and session bean, so that it should just return a
String, no callback, so that I can test a very simple case.
The error i get in my client when i run it is:
| [jacorb.giop] INFO : ClientConnectionManager: created new conn to target
192.168.0.64:3528
| [jacorb.iiop.conn] INFO : Connected to 192.168.0.64:3528 from local port 33511
| org.omg.CosNaming.NamingContextPackage.NotFound:
IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
| at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(Unknown
Source)
| at org.omg.CosNaming._NamingContextStub.resolve(Unknown Source)
| at callbackClient.main(callbackClient.java:59)
|
I have copied my code below. Can you see where I am going wrong? Do I need to do
something else with JBOSS to get it to accept CORBA connections?
Also does JBOSS just output the IOR for the naming service to the terminal when it
starts up, or can you get it to put it elsewhere.
Lots of questions I know, sorry.
The Client code is the following
| import org.omg.CORBA.ORB;
|
| import java.util.Properties;
| import org.omg.CosNaming.NamingContext;
| import org.omg.CosNaming.NamingContextHelper;
| import org.omg.CosNaming.NameComponent;
| import com.ssl.simple.*;
| /**
| *
| * @author geoff
| * @version
| */
| public class callbackClient {
|
| /** Creates new callbackClient */
| public callbackClient() {
| }
|
| /**
| * @param args the command line arguments
| */
| public static void main(String args[]) {
|
| try {
| // setting system properties is necessary in order to use this ORB in
JDK
| Properties props = System.getProperties();
| props.put("org.omg.CORBA.ORBClass", "org.jacorb.orb.ORB");
| props.put("org.omg.CORBA.ORBSingletonClass", "org.jacorb.orb.ORB");
| System.setProperties(props);
|
| ORB orb = ORB.init(args, props);
|
| // the client will use Naming Service
| org.omg.CORBA.Object ns =
orb.resolve_initial_references("NameService");
| //org.omg.CORBA.Object ns =
orb.resolve_initial_references("CorbaNaming");
| if (ns == null)
| throw new RuntimeException();
| NamingContext nc = NamingContextHelper.narrow(ns);
| if (nc == null)
| throw new RuntimeException();
| // resolve names with the Naming Service
| String[] client_name_hierarchy = new String [] {"CorbaNaming",
"JBoss"};
| NameComponent[] aName = new NameComponent[client_name_hierarchy.length
/ 2];
| for (int i=0; i<(client_name_hierarchy.length / 2); i++) {
| aName = new NameComponent();
| aName.id = client_name_hierarchy[i*2];
| aName.kind = client_name_hierarchy[i*2+1];
| }
| org.omg.CORBA.Object obj = nc.resolve(aName);
|
| com.ssl.simple.GoodDay srv = com.ssl.simple.GoodDayHelper.narrow(obj);
| if (srv == null)
| throw new RuntimeException();
| System.out.println(srv.requestHello());
| // add your client code here
|
| } catch (Exception ex) {
| ex.printStackTrace();
| }
| }
| }
|
the Goodday bean class
| package com.ssl.simple;
|
| import javax.ejb.CreateException;
| import javax.ejb.SessionBean;
| import javax.ejb.SessionContext;
|
|
| /**
| *Created May 28 Fri, 2004 3:28:29 PM
| [EMAIL PROTECTED] geoff
| */
|
|
| public class GoodDayBean implements SessionBean {
|
| private SessionContext sessionContext = null;
|
| public void ejbCreate() throws CreateException {
|
|
| }
|
| public String requestHello() {
|
| return "hello I WONDER IF THIS WILL WORK";
|
| }
|
|
|
| public void ejbActivate() {
| }
|
| public void ejbPassivate() {
| }
|
| public void ejbRemove() {
| }
|
| public void setSessionContext(SessionContext sessionCtx){
|
| this.sessionContext = sessionCtx;
|
| }
|
| }
|
The Goodday interface
| package com.ssl.simple;
|
| import java.rmi.RemoteException;
| import javax.ejb.EJBObject;
|
|
| /**
| *Created May 28 Fri, 2004 3:28:29 PM
| [EMAIL PROTECTED] geoff
| */
|
|
| public interface GoodDay extends EJBObject {
| public String requestHello() throws RemoteException ;
|
| }
|
and the goodday home
| package com.ssl.simple;
|
| import java.rmi.RemoteException;
| import javax.ejb.CreateException;
| import javax.ejb.EJBHome;
|
|
| /**
| *Created May 28 Fri, 2004 3:28:29 PM
| *Code generated by the NetBeans for java EJB Module
| [EMAIL PROTECTED] geoff
| */
|
|
| public interface GoodDayHome extends EJBHome {
|
| public GoodDay create() throws CreateException,RemoteException;
|
| }
|
And finally the deployent descriptor for this.
ejb-jar.xml
| <?xml version="1.0"?>
|
| <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans
1.1//EN'
| 'http://alpha-am02-mx01/dtd/ejb-jar_1_1.dtd'>
|
| <ejb-jar>
| <enterprise-beans>
| <session>
| <ejb-name>GoodDay</ejb-name>
|
| <home>com.ssl.simple.GoodDayHome</home>
| <remote>com.ssl.simple.GoodDay</remote>
| <ejb-class>com.ssl.simple.GoodDayBean</ejb-class>
|
| <session-type>Stateful</session-type>
|
| <transaction-type>Container</transaction-type>
| </session>
| </enterprise-beans>
|
| <assembly-descriptor>
| <container-transaction>
| <method>
| <ejb-name>GoodDay</ejb-name>
| <method-intf>Remote</method-intf>
| <method-name>*</method-name>
| </method>
| <trans-attribute>Required</trans-attribute>
| </container-transaction>
| </assembly-descriptor>
| </ejb-jar>
|
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3837044#3837044
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3837044
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user