Hi,

no worries.
If you have an EAR file, it must be also deployed on apps/ directory not on
webapps.
Otherwise, it should work the same way more or less than JBoss AS.

If you have a war file with all jar module in WEB-INF/lib dir, you only
have a single module so that it's easier to reference each other.
If you have independant jar modules deployed in a standalone manner in
apps/ you must use global JNDI names.
If you have an EAR file in apps/ and JAR modules in ear/lib/, you can use
the app jndi subtree.

Check out the JNDI names part of the spec. It's pretty clear AFAIR.

Hope it helps
JLouis



2013/6/3 AndrewClarke <[email protected]>

> Hi Jean-Louis.  Thanks for your response.  I'm not sure how I'm deploying
> my app either!  The app is currently running in JBoss, and many of the EJBs
> are packaged in a separate JAR file in JBoss, and in the end all deployed
> in an EAR.  I'm trying to port it to TomEE and I'm not sure what I'm doing.
>  I did get a simplified version of all this working on Friday, with the
> EJBs deployed locally in the same webapp.  So, JNDI naming is working in
> that context; I just need to start adding things in until something else
> breaks.
>
> Thanks for letting me know that I can't package my EJBs in a separate JAR
> without using global JNDI names.  I didn't know that.
>
> - Andrew.
>
> On 2013-06-03, at 02:57, Jean-Louis MONTEIRO [via OpenEJB] <
> [email protected]> wrote:
>
> > Hi,
> >
> > not sure to understand how you deploy your app.
> > For instance, you jar module (if alone as I understood) should be in
> apps/
> > (see deployment tag in tomee.xml).
> > If you wanna call components between Java EE modules (separate jar file
> for
> > example), you have to use global JNDI names.
> >
> > As a side note, using beanName is not portable at all.
> >
> > If you have a small example to share, we can git it a try.
> >
> > JLouis
> >
> >
> >
> > 2013/5/31 AndrewClarke <[hidden email]>
> >
> > > I should explain my subject a bit better.  In addition to what I
> described
> > > below, code like this in a bean just populates the variable with null:
> > >
> > > @EJB( beanName = "MessageManager" )
> > > private MessageManager messageManager;
> > >
> > > I assumed it's the same basic issue as I wrote below, although maybe
> that's
> > > not the case.
> > >
> > > Thanks again,
> > > - Andrew.
> > >
> > >
> > > AndrewClarke wrote
> > > > I have a simple webapp named services.war.  I also have a JAR file
> named,
> > > > say, example.jar, deployed in TomEE's lib directory.  In example.jar
> I
> > > > have the following files (amongst others):
> > > >
> > > > /com/example/ws/proxies/TestServiceProxy.class
> > > > /com/example/account/ApplicationManager.class
> > > > /com/example/account/ApplicationManagerBean.class
> > > >
> > > > ApplicationManagerBean.class is set up as follows:
> > > > @Stateless( name = "ApplicationManager" )
> > > > @Local( ApplicationManager.class )
> > > >
> > > > In /services, my Test web service instantiates
> > > > com.example.ws.proxies.TestServiceProxy and calls a method in there.
> > >  This
> > > > in turn tries to do this:
> > > >
> > > > ApplicationManager applicationManager = (ApplicationManager) (new
> > > > InitialContext()).lookup("example/ApplicationManager/local");
> > > >
> > > > This in turn gives me this error:
> > > >
> > > > 2013-05-31 10:28:16,068 WARN  [http-bio-8080-exec-1]
> > > > ws.proxies.TestServiceProxy.testGet(152): Exception getting
> > > > ApplicationManager: Name "/example/ApplicationManager/local" not
> found.
> > > > javax.naming.NameNotFoundException: Name
> > > > "/example/ApplicationManager/local" not found.
> > > >
> > > > How do I use this naming system to refer to an object within its own
> JAR
> > > > file?  I'm using this format in system.properties:
> > > >
> > > > java.naming.factory.initial =
> > > > org.apache.openejb.client.LocalInitialContextFactory
> > > > openejb.deploymentId.format = {ejbJarId}/{ejbName}
> > > > openejb.jndiname.format =
> {deploymentId}/{interfaceType.annotationNameLC}
> > > >
> > > > I've tried using the global JNDI name too and I haven't been able to
> get
> > > > that to work either.
> > > >
> > > > Thanks,
> > > > - Andrew.
> > >
> > >
> > >
> > >
> > >
> > > --
> > > View this message in context:
> > >
> http://openejb.979440.n4.nabble.com/EJB-within-JAR-tp4663375p4663376.html
> > > Sent from the OpenEJB User mailing list archive at Nabble.com.
> > >
> >
> >
> >
> > --
> > Jean-Louis
> >
> >
> > If you reply to this email, your message will be added to the discussion
> below:
> >
> http://openejb.979440.n4.nabble.com/EJB-within-JAR-tp4663375p4663414.html
> > To unsubscribe from @EJB within JAR, click here.
> > NAML
>
>
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/EJB-within-JAR-tp4663375p4663424.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>



-- 
Jean-Louis

Reply via email to