Hello i have want to try EJB 3.0 but i have problems.
the problem is this i have EJB 3.0 like this :
package beans;

import javax.ejb.Stateless;

@Stateless(name="SimpleSession")
public class SimpleSessionBean implements SimpleSession {
    public SimpleSessionBean() {
    }

    public String sayHello(String name) {
        return "Hello "+name;
    }
}

package beans;

import javax.ejb.Remote;

@Remote
public interface SimpleSession {
public String sayHello(String name) ;
}


and i make test client for it .

    package client;

import beans.SimpleSession;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public class SimpleSessionClient {
    public static void main(String[] args) {
        InitialContext ctx;
        try {
            

            ctx = new InitialContext();
            ctx.addToEnvironment("java.naming.factory.initial", 
"org.jnp.interfaces.NamingContextFactory");
              ctx.addToEnvironment("java.naming.factory.url.pkgs", 
"org.jboss.naming:org.jnp.interfaces");
            ctx.addToEnvironment(Context.PROVIDER_URL,"jnp://localhost:1099");
        SimpleSession simpleSession
        = (SimpleSession) ctx.lookup(SimpleSession.class.getName());
        System.out.println(simpleSession.sayHello("EJB3"));
        } catch (NamingException e) {
            e.printStackTrace();
        }
    }
}


but when i delpoy the EJB and start the client i get :
 cannot find : org.jboss.naming:org.jnp.interfaces 
Nothink UNNORAML 
i add to the CLASSPATH everythink in jbossServer/client/*.jars
when i start now i get :


log4j:WARN No appenders could be found for logger 
(org.jnp.interfaces.NamingContext).
log4j:WARN Please initialize the log4j system properly.
javax.naming.CommunicationException: Could not obtain connection to any of 
these urls: jnp://localhost:1099 and discovery failed with error: 
javax.naming.CommunicationException: Receive timed out [Root exception is 
java.net.SocketTimeoutException: Receive timed out] [Root exception is 
javax.naming.CommunicationException: Failed to connect to server localhost:1099 
[Root exception is javax.naming.ServiceUnavailableException: Failed to connect 
to server localhost:1099 [Root exception is java.net.ConnectException: 
Connection refused: connect]]]
        at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1414)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:594)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
        at javax.naming.InitialContext.lookup(InitialContext.java:351)
        at client.SimpleSessionClient.main(SimpleSessionClient.java:19)
Caused by: javax.naming.CommunicationException: Failed to connect to server 
localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: 
Failed to connect to server localhost:1099 [Root exception is 
java.net.ConnectException: Connection refused: connect]]
        at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:269)
        at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1385)
        ... 4 more
Caused by: javax.naming.ServiceUnavailableException: Failed to connect to 
server localhost:1099 [Root exception is java.net.ConnectException: Connection 
refused: connect]
        at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:243)
        ... 5 more
Caused by: java.net.ConnectException: Connection refused: connect
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
        at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:364)
        at java.net.Socket.connect(Socket.java:507)
        at java.net.Socket.connect(Socket.java:457)
        at java.net.Socket.(Socket.java:365)
        at java.net.Socket.(Socket.java:265)
        at 
org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:84)
        at 
org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:76)
        at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:239)
        ... 5 more
Process exited with exit code 0.

i try with just "localhost" and  "jnp://localhost" but then the problem is the 
same.



View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3956387#3956387

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3956387


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to