0

my problem is similar to this: LINK but i need to invoke method on one @Stateless bean from second @Stateless bean in another package. I tried do it like this:

@Stateless
public class StatelessBean1 implements IStatelessBean1{
@EJB
    private packagename.StatelessBeanw pr;

after this i get error:

javax.ejb.EJBException: javax.ejb.EJBException: javax.ejb.CreateException: Could not create stateless EJB

note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 4.0 logs.

StatelessBean1 is into defaut package and StatelessBean2 is into package with name. When i get these two int same package all works fine by using:

StatelessBean1 pr = new StatelessBean1();

Ineed to make it into that kind of 2 different packages

Could someone told how it should look like or where is my mistake?

I tested some more and it look like that even if they are into same package it makes error.

@Stateless
    public class StatelessBean1 implements IStatelessBean1{
    @EJB
        private StatelessBeanw pr;
Community
  • 1
  • 1
Rag
  • 65
  • 9

2 Answers2

0

If I am not wrong, you can use mappedName construct.

This page could help you.

Semih Eker
  • 2,389
  • 1
  • 20
  • 29
  • I looked at this link but dunno how it could help me – Rag Dec 15 '14 at 23:32
  • @Michal, for example they called remotely the bean in this question with mappedNmame = http://stackoverflow.com/questions/12209774/hello-world-with-remote-stateless-session-bean – Semih Eker Dec 15 '14 at 23:47
0

Thx for hel i guess u have right but in this case answer to my question was easy. It should be:

@Stateless
public class StatelessBean1 implements IStatelessBean1{
@EJB
    private packagename.StatelessBeanwInterface pr;

I should give name of interface for my StatelessBeanw file not to StatelessBeanw. Case closed.

Rag
  • 65
  • 9