Hi,
thank you, I'm now able to deploy my bean.
But now, I don't get the client started.
In my bean, I have the "jboss.xml" with the following code:
<jboss>
| <enterprise-beans>
| <session>
| <ejb-name>KontoBean</ejb-name>
| <jndi-name>ejb/KontoBean</jndi-name>
| </session>
| </enterprise-beans>
| <resource-managers>
| </resource-managers>
| </jboss>
Here is my client code:
| import javax.naming.Context;
| import javax.naming.InitialContext;
| import javax.rmi.PortableRemoteObject;
| import java.util.*;
|
|
| public class HelloWorldClient
| {
| public static void main(String[] args)
| {
| try
| {
| // Die EJB Ãber JNDI ermitteln
| Context initial = new InitialContext();
| System.out.println(initial);
| Object ref = initial.lookup("java:comp/env/ejb/KontoBean");
| // Home-Interface referenzieren
| KontoHome home = (KontoHome)
| PortableRemoteObject.narrow
| (ref, KontoHome.class);
| // Konto-Bean referenzieren
| Konto konto = home.create();
| // Konto-Methoden nutzen
| System.out.println ("Startguthaben: "
| + konto.getKontostand());
| konto.einzahlen (1000);
| System.out.println ("Neues Guthaben: "
| + konto.getKontostand());
| double betrag = konto.abheben (500);
| System.out.println ("Abgehoben: " + betrag
| + "; neues Guthaben: "
| + konto.getKontostand());
| }
| catch(Exception e)
| {
| System.out.println ("Ein Fehler ist
aufgetreten!");
| e.printStackTrace();
| }
| }
| }
>From this, I get the exception:
anonymous wrote :
| javax.naming.NoInitialContextException: Need to specify class name in
environment or system property, or as an applet parameter, or in an application
resource file: java.naming.factory.initial
| at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
| at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
| at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
| at javax.naming.InitialContext.lookup(Unknown Source)
| at HelloWorldClient.main(HelloWorldClient.java:24)
|
If I use the following client code:
| import javax.naming.Context;
| import javax.naming.InitialContext;
| import javax.rmi.PortableRemoteObject;
| import java.util.*;
|
|
| public class HelloWorldClient
| {
| public static void main(String[] args)
| {
| try
| {
| // Die EJB Ãber JNDI ermitteln
| Properties p = new Properties();
| p.put(Context.INITIAL_CONTEXT_FACTORY,
| "org.jnp.interfaces.NamingContextFactory");
| p.put(Context. PROVIDER_URL, "jnp://localhost:1099");
| Context initial = new InitialContext(p);
| System.out.println(initial);
| Object ref = initial.lookup("java:comp/env/ejb/KontoBean");
| // Home-Interface referenzieren
| KontoHome home = (KontoHome)
| PortableRemoteObject.narrow
| (ref, KontoHome.class);
| // Konto-Bean referenzieren
| Konto konto = home.create();
| // Konto-Methoden nutzen
| System.out.println ("Startguthaben: "
| + konto.getKontostand());
| konto.einzahlen (1000);
| System.out.println ("Neues Guthaben: "
| + konto.getKontostand());
| double betrag = konto.abheben (500);
| System.out.println ("Abgehoben: " + betrag
| + "; neues Guthaben: "
| + konto.getKontostand());
| }
| catch(Exception e)
| {
| // System.out.println("Ein Fehler ist aufgetreten!");
| e.printStackTrace();
| }
| }
| }
Then I get: anonymous wrote : javax.naming.NameNotFoundException: comp not bound
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
| at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
| at org.jnp.server.NamingServer.lookup(NamingServer.java:253)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:324)
| at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
| at sun.rmi.transport.Transport$1.run(Transport.java:148)
| at java.security.AccessController.doPrivileged(Native Method)
| at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
| at
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
| at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
| at java.lang.Thread.run(Thread.java:534)
| at
sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
| at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
| at sun.rmi.server.UnicastRef.invoke(Unknown Source)
| at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:529)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:508)
| at javax.naming.InitialContext.lookup(Unknown Source)
| at HelloWorldClient.main(HelloWorldClient.java:28)
Please help me that my client is able to communicate the my bean.
Regards,
PeaceMaker
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3857861#3857861
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3857861
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user