Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8089515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:25:06+00:00 2026-06-05T19:25:06+00:00

here is my problem, I made an EJB with maven and 2 test clients,

  • 0

here is my problem, I made an EJB with maven and 2 test clients,

  • a test client without maven, only added jnp-client and the EJB to it’s class path, work like a charm
  • a test client using MAVEN, added the EJB through the POM and jnp-client, does not work

this is my EJB :

it’s POM :

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.toto.mp</groupId>
  <artifactId>MyFirstMavenEjb</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>ejb</packaging>
  <name>MyFirstMavenEjb</name>
  <url>http://maven.apache.org</url>

  <dependencies>
    <dependency>
      <groupId>javax</groupId>
      <artifactId>javaee-api</artifactId>
      <version>6.0</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>

   <!-- setting default EJB2 to EJB3 -->
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.0.2</version>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-ejb-plugin</artifactId>
        <version>2.1</version>
        <configuration>
          <ejbVersion>3.0</ejbVersion>
        </configuration>
      </plugin>

    </plugins>
  </build>
</project>

this is my first test client, the one without maven wich has no problem whatsoever to speak with the EJB

this is my second test client, using maven, it cannot speak with the EJB, all I’m getting is :

Context lookup finished
Exception in thread "main" 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)

It’s POM :

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.toto.mp</groupId>
  <artifactId>TestClientMavenEjb</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>TestClientMavenEjb</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  
  <!-- pour la dependance jnp-client, besoin de la version 5.0.3.GA -->
  <repositories>
    <repository>
      <id>Jboss</id>
      <url>https://repository.jboss.org/nexus/content/repositories/releases/</url>
    </repository>
  </repositories>

  <dependencies>
    <dependency>
        <groupId>org.jboss.naming</groupId>
        <artifactId>jnp-client</artifactId>
        <version>5.0.3.GA</version>
    </dependency>
    <dependency>
        <groupId>com.toto.mp</groupId>
        <artifactId>MyFirstMavenEjb</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </dependency>
  </dependencies>
</project>

Both clients have the same main :

public static void main( String args[] ) throws NamingException
{
    Hashtable env = new Hashtable(); 
    env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); 
    env.put(Context.PROVIDER_URL, "localhost"); 
    env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces" ); 
    Context ctx = new InitialContext(env);
        System.out.println("Context lookup finished");
        
        TestMavenEjb proxy = (TestMavenEjb)(ctx.lookup("TestMavenEjbBean/remote-com.toto.mp.MyFirstMavenEjb.TestMavenEjb"));
        System.out.println(proxy.getClass());
        
        System.out.println("do something!");
        
        proxy.doSomething();
}

So, anybody has even the slightest idea about why the maven test client is not working?

Jboss 5.1.0.GA
Eclipse indigo
Maven 3.0.4

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T19:25:08+00:00Added an answer on June 5, 2026 at 7:25 pm

    The awnser was quite simple but couldn’t have been found by what I posted 😡

    I was using a jee6 archetype and Jboss 5.1.0.GA is not compatible with jee6.
    If I uses a jee5 archetype I have no problems making them talk.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made a little example of my problem here: http://peterbriers.be/test/float_html5.html As you can see,
Hey here is my problem : i made a flash and i can`t change
Here's my problem: I have an unmanaged dll that I made.I'm calling one of
I'm facing a huge problem here which is driving me crazy, I've made an
Confused with the problem here. New to C, as made obvious by the below
Ive made a fiddle of my problem here. http://jsfiddle.net/E9cUS/1/ JavaScript: $('.top').click(function () { var
I made a program that has a class with static-only members in it in
I made a website that depends on PHP, AJAX and Javascript. The problem here
Well I am having a stranger problem here in my android app. I made
Maddening problem here. When my page loads: <body onload=getClientDateTime();> It runs this function: document.getElementById('ClientDateTime').value=hello

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.