title: EJB 3.0 test client working without maven but not with
body: <p>here is my problem, I made an EJB with maven and 2 test clients,</p>
  <ul>
  <li>a test client without maven, only added jnp-client and the EJB to it's class path, work like a charm</li>
  <li>a test client using MAVEN, added the EJB through the POM and jnp-client, does not work</li>
  </ul>
  <p>this is my EJB :</p>
  <p>it's POM :</p>
  <pre><code>&lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
    xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
    &lt;groupId&gt;com.toto.mp&lt;/groupId&gt;
    &lt;artifactId&gt;MyFirstMavenEjb&lt;/artifactId&gt;
    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
    &lt;packaging&gt;ejb&lt;/packaging&gt;
    &lt;name&gt;MyFirstMavenEjb&lt;/name&gt;
    &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  
    &lt;dependencies&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;javax&lt;/groupId&gt;
        &lt;artifactId&gt;javaee-api&lt;/artifactId&gt;
        &lt;version&gt;6.0&lt;/version&gt;
        &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
    &lt;/dependencies&gt;
  
     &lt;!-- setting default EJB2 to EJB3 --&gt;
    &lt;build&gt;
      &lt;plugins&gt;
        &lt;plugin&gt;
          &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
          &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
          &lt;version&gt;2.0.2&lt;/version&gt;
          &lt;configuration&gt;
            &lt;source&gt;1.5&lt;/source&gt;
            &lt;target&gt;1.5&lt;/target&gt;
          &lt;/configuration&gt;
        &lt;/plugin&gt;
        &lt;plugin&gt;
          &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
          &lt;artifactId&gt;maven-ejb-plugin&lt;/artifactId&gt;
          &lt;version&gt;2.1&lt;/version&gt;
          &lt;configuration&gt;
            &lt;ejbVersion&gt;3.0&lt;/ejbVersion&gt;
          &lt;/configuration&gt;
        &lt;/plugin&gt;
  
      &lt;/plugins&gt;
    &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  <p>this is my first test client, the one without maven wich has no problem whatsoever to speak with the EJB</p>
  <p>this is my second test client, using maven, it cannot speak with the EJB, all I'm getting is :</p>
  <pre><code>Context lookup finished
  Exception in thread &quot;main&quot; java.lang.ClassCastException: javax.naming.Reference cannot be cast to com.toto.mp.MyFirstMavenEjb.TestMavenEjb
      at com.toto.mp.TestClientMavenEjb.App.main(App.java:27)
  </code></pre>
  <p>It's POM :</p>
  <pre><code>&lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
    xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
    &lt;groupId&gt;com.toto.mp&lt;/groupId&gt;
    &lt;artifactId&gt;TestClientMavenEjb&lt;/artifactId&gt;
    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
    &lt;packaging&gt;jar&lt;/packaging&gt;
  
    &lt;name&gt;TestClientMavenEjb&lt;/name&gt;
    &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  
    &lt;properties&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
    &lt;/properties&gt;
    
    &lt;!-- pour la dependance jnp-client, besoin de la version 5.0.3.GA --&gt;
    &lt;repositories&gt;
      &lt;repository&gt;
        &lt;id&gt;Jboss&lt;/id&gt;
        &lt;url&gt;https://repository.jboss.org/nexus/content/repositories/releases/&lt;/url&gt;
      &lt;/repository&gt;
    &lt;/repositories&gt;
  
    &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.jboss.naming&lt;/groupId&gt;
          &lt;artifactId&gt;jnp-client&lt;/artifactId&gt;
          &lt;version&gt;5.0.3.GA&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.toto.mp&lt;/groupId&gt;
          &lt;artifactId&gt;MyFirstMavenEjb&lt;/artifactId&gt;
          &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;/dependency&gt;
    &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>
  <p>Both clients have the same main :</p>
  <pre><code>public static void main( String args[] ) throws NamingException
  {
      Hashtable env = new Hashtable(); 
      env.put(Context.INITIAL_CONTEXT_FACTORY, &quot;org.jnp.interfaces.NamingContextFactory&quot;); 
      env.put(Context.PROVIDER_URL, &quot;localhost&quot;); 
      env.put(Context.URL_PKG_PREFIXES, &quot;org.jboss.naming:org.jnp.interfaces&quot; ); 
      Context ctx = new InitialContext(env);
          System.out.println(&quot;Context lookup finished&quot;);
          
          TestMavenEjb proxy = (TestMavenEjb)(ctx.lookup(&quot;TestMavenEjbBean/remote-com.toto.mp.MyFirstMavenEjb.TestMavenEjb&quot;));
          System.out.println(proxy.getClass());
          
          System.out.println(&quot;do something!&quot;);
          
          proxy.doSomething();
  }
  </code></pre>
  <p>So, anybody has even the slightest idea about why the maven test client is not working?</p>
  <p>Jboss 5.1.0.GA
  Eclipse indigo
  Maven 3.0.4</p>