3 Replies Latest reply on May 5, 2012 8:23 AM by ouertaniines Branched from an earlier discussion.

    EJB invocation from a remote client

    ouertaniines

      Hey everyone i'm new in the jboss comunity ; i'm having some troubles dealing with EJB deployement ( remoting client side ) , actually i'm getting Capture.PNG

      my jboss-ejb-client.properties :

      endpoint.name=client-endpoint

      remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false

      remote.connections=default

      remote.connection.default.host=127.0.0.1

      remote.connection.default.port = 9999

      remote.connection.default.username=ines

      remote.connection.default.password=root

       

       

      java.naming.provider.url=remote://localhost:9999

      java.naming.factory.initial=org.jboss.naming.remote.client.InitialContextFactory

      java.naming.factory.url.pkgs=org.jboss.ejb.client.naming

      jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=true

      jboss.naming.client.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS=JBOSS-LOCAL-USER

      jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT=false

       

      my main class :

      package Test;

       

       

      import java.security.Security;

      import java.util.Hashtable;

       

       

      import javax.naming.Context;

      import javax.naming.InitialContext;

      import javax.naming.NamingException;

       

       

      import org.jboss.sasl.JBossSaslProvider;

       

       

      import com.esprit.persistence.User;

      import com.esprit.service.gestionUser.gestionUser;

      import com.esprit.service.gestionUser.gestionUserRemote;

       

       

      public class ClientUser {

       

       

      static {

      Security.addProvider(new JBossSaslProvider());

      }

       

       

      //STATIC BLOCK - YOU MUST HAVE THIS

       

       

      public static void main(String[] args) throws NamingException {

       

       

      final Hashtable<String, String> jndiProperties = new Hashtable<String, String>();

      jndiProperties.put(Context.URL_PKG_PREFIXES,"org.jboss.ejb.client.naming");

      final Context context = new InitialContext(jndiProperties);

       

       

      final String appName = "";

       

       

      final String moduleName = "PFE";

      // THIS IS THE NAME OF THE JAR WITH YOUR EJBs. Write its name here, without the .jar.

       

       

      final String distinctName = "";

      //    AS7 allows deployments to have an distinct name. If you don't use this feature, let this field empty.

       

       

      final String beanName = gestionUser.class.getSimpleName();

      //EJB CLASS WITH THE IMPLEMENTATION (simple name)

       

       

      final String viewClassName = gestionUserRemote.class.getName();

      // FULLY QUALIFIED NAME OF THE REMOTE CLASS (interface).

       

       

      gestionUserRemote bean = (gestionUserRemote) context.lookup("ejb:" + appName + "/" + moduleName + "/" + distinctName + "/" + beanName + "!" + viewClassName);

      User user = new User();

      user.setPassword("password");

      bean.create(user);

       

       

      //NOTICE THAT DOING LOOKUP FOR STATELESS EJBs IS DIFFERENT FROM  STATEFUL EJBs!!!

       

       

      }

       

       

      }

       

       

      Can anyone Help me

      Thanks