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 876641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:28:00+00:00 2026-05-15T11:28:00+00:00

I have 2 ejbs. Ejb-A that calls Ejb-B. They are not in the same

  • 0

I have 2 ejbs. Ejb-A that calls Ejb-B. They are not in the same Ear.

For portability Ejb-B may or may not exist on the same server. (There is an external property file that has the provider URLs of Ejb-B. I have no control over this.)

Example Code: in Ejb-A

EjbBDelegate delegateB = EjbBDelegateHelper.getRemoteDelegate(); // lookup from list of URLs from props... 
BookOfMagic bom = delegateB.getSomethingInteresting();

Use Cases/Outcomes:

  1. When Ejb-B DOES NOT EXIST on the same server as Ejb-A, everything works correctly. (it round-robbins through the URLs)
  2. When Ejb-B DOES EXIST on the same server, and Ejb-A happens to call Ejb-B on the same server, everything works correctly.
  3. When Ejb-B DOES EXIST on the same server, and Ejb-A calls Ejb-B on a different server, I get:

javax.ejb.EJBException: nested exception is: java.lang.ClassCastException: $Proxy126
java.lang.ClassCastException: $Proxy126

I’m using Weblogic 10.0, Java 5, EJB3

Basically, if Ejb-B Exists on the server, it must be called ONLY on that server.

Which leads me to believe that the class is getting loaded by a local classloader (on deployment?), then when called remotely, a different classloader is loading it. (causing the Exception) But it should work, as it should be Serialized into the destination classloader…

What am I doing wrong??

Also, when reproducing this locally, Ejb-A would favor the Ejb-B on the same server, so it was difficult to reproduce. But this wasn’t the case on other machines.

NOTE: This all worked correctly for EJB2

  • 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-05-15T11:28:00+00:00Added an answer on May 15, 2026 at 11:28 am

    So I was able to ‘fix’ this issue by adding a @RemoteHome(MyRemoteHome.class) to the bean

    public interface MyRemoteMethods {
        String myMethod() throws RemoteException; // this Ex is required
    }
    
    public interface MyRemote extends EJBObject, MyRemoteMethods { 
    }
    
    public interface MyRemoteHome extends EJBHome {
        public MyRemote create() throws CreateException, RemoteException;
    }
    

    then my bean

    ...
    @RemoteHome(MyRemoteHome.class)
    public class MyBean implements MyRemoteMethods {
    ...
    

    Previously, only the bean and the Remote interface existed. (there is no local usage)

    Overall, this fix makes my EJB 3 a bit more EJB 2-ish and not as clean (more code and classes involved). I am also unclear why I can do a jndi lookup for the RemoteHome interface (and call create) from my local and remote servers and not get a ClassCastException, but when I do this for the Remote interface, I do get a ClassCastException. Is this a bug in Weblogic? (I’ve also seen some posts similar using JBoss)

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

Sidebar

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.