a main from a war? trying to get how you run your tests.
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau



2014-04-08 17:52 GMT+02:00 ttran <[email protected]>:
> Hi,
>
> the test client is just this Main class:
>
> package com.training.domain.ejb.testclient;
> import java.util.Properties;
> import javax.naming.InitialContext;
> import javax.naming.Context;
> import javax.naming.NamingException;
> import com.training.domain.ejb.entity.Personne;
> import com.training.domain.ejb.facade.PersonneFacadeLocal;
> import com.training.domain.ejb.facade.PersonneFacadeRemote;
>
> public class Main {
>
>         public static void main(String[] args) {
>                 // TODO Auto-generated method stub
>
>         try {
>
>                 Personne personne = new Personne();
>                 personne.setId(1);
>                 personne.setNom("test");
>                 personne.setPrenom("Personne facade remote");
>
>             Properties p = new Properties();
>             p.put("java.naming.factory.initial",
> "org.apache.openejb.client.RemoteInitialContextFactory");
>             p.put("java.naming.provider.url",
> "http://localhost:8082/tomee/ejb";);
>             //p.setProperty("java.naming.provider.url",
> "ejbd://localhost:8082");
>             InitialContext ic = new InitialContext(p);
>
>             PersonneFacadeRemote pfl = (PersonneFacadeRemote)
> ic.lookup("java:global/Ejb3/PersonneFacadeImpl!com.training.domain.ejb.facade.PersonneFacadeRemote");
>
>             pfl.create(personne);
>             System.out.println("Creer une nouvelle personne avec l'interface
> remote");
>
>         } catch (NamingException ex) {
>             ex.printStackTrace();
>         }
>
>         }
> }
>
> in the WEB-INF/lib folder, i have:
> ejb-3_0-api.jar
> ejb3-persistence-3.3.1.jar
> javaee-api-7.0.jar
> ojdbc6.jar
> openejb-client-4.6.0.jar
>
> Tomee version:
> apache-tomee-plus-1.6.0 used with jdk 1.7
>
> I can send you the .war by mail if you want because i can't not upload it
> here.
> Thks
>
>
>
>
> --
> View this message in context: 
> http://openejb.979440.n4.nabble.com/Problem-to-create-initialContext-tp4668512p4668657.html
> Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Reply via email to