-1

Since:

  • the @EJB doesn't work on desktop apps, because there's no container,
  • Weblogic doesn't expose through JNDI the names of the EJB's (3.0),
  • I didn't find anything about it in the official documentation for a few days now,

does anyone know how I could consume an EJB from a desktop app?

I got hints that i have to modify web.xml... but then what web.xml, there's more of them and at least some of them break my app.

Clarification: I have a WebLogic server running, NOT exposing some EJB's inside an EAR hosted on that server. Specifically, the server is not exposing the names of EJB3.0 Session beans, while it DOES expose the names of some other EJB2.1 names. How do i get a reference to the EJB3.0 objects, hosted on my server, from my desktop app?

FURTHER Clarification: Weblogic Specifically does not expose the names of EJB3.0 within the JNDI, because the specifications of EJB3.0 don't require it.

vlad-ardelean
  • 7,480
  • 15
  • 80
  • 124
  • What do you mean WebLogic doesnt expose the JNDI names of EJB 3.0s? Did you create and deploy the necessary ejb-jar.xml? Fix your server side then consume the EJB in your desktop app by looking it up in the Initial Context. – Perception Jan 26 '12 at 15:48
  • 1
    The problem might be that although the EJB 3 spec allows EJBs to be exposed over RMI/IIOP, it doesn't require it, and some containers are currently only providing local EJBs (JBoss AS7, for example). Perhaps WebLogic is in the same basket. – Tom Anderson Jan 26 '12 at 15:51
  • yes, that's the thing.... Weblogic DOES NOT EXPOSE EJB3.0 names, because the specification doesn't require it. – vlad-ardelean Jan 26 '12 at 15:53
  • 1
    The WebLogic 11g manual suggests that you CAN access EJBs remotely: http://docs.oracle.com/cd/E17904_01/web.1111/e13719/implementing.htm#i1186413 – Jeremiah Orr Jan 26 '12 at 15:54
  • @TomAnderson that's interesting. Can you point relevant part of the specification to support your words? JBoss AS7 is not supporting the remote interfaces because it's officially supporting the Web Profile (and it doesn't require to implement remote interfaces - that's spec compliant). However, EJB 3.0 is a part of Java EE 5 and there were no such term as WebProfile / FullProfile at that time. If Weblogic doesn't allow you to access the remote interface EJB, than what's the purpose of 'remote' part in this term? – Piotr Nowicki Jan 26 '12 at 16:08

1 Answers1

0

To answer my own question (got it after some effort), to expose an EJB3.0 object through a remote interface, in the Weblogic 11g server, these steps must be taken:

This is what my ejb-jar.xml says about the bean RolyBean:

<enterprise-beans>       
    <session id="Session_Roly">
      <display-name>Roly</display-name>
      <ejb-name>Roly</ejb-name>
      <remote>com.medicon.server.RolyRemote</remote>
      <ejb-class>com.medicon.server.RolyBean</ejb-class>
      <session-type>Stateless</session-type>
    </session>
  </enterprise-beans>

This is what the weblogic-ejb-jar.xml (in the same dir) says:

<wls:weblogic-enterprise-bean>
    <wls:ejb-name>Roly</wls:ejb-name>
<wls:jndi-name>Roly</wls:jndi-name>
</wls:weblogic-enterprise-bean>

These 2 deployment descriptors seem to be the only 2 places where it's required to specify exposure of the EJB through JNDI.

vlad-ardelean
  • 7,480
  • 15
  • 80
  • 124