Re: Re: Re: Re: Re: How to change remote JNDI-name in Jonas

Stefaan Somers <[email protected]> Tue, 9 Aug 2011 12:13:44 +0200
Newsgroups gmane.comp.java.objectweb.jonas
Message-ID <CA+N_TpXaMyYHXKMaraPi4srS2Kv1Eop6oCTYWd-WUaD4SRJvPQ@mail.gmail.com>
But,

our applications are generated, so we can have for example 2
account-beans in 2 different applications. Therefore we must be able
to uniquely identify the 2 remote JNDI interfaces to the 2 different
applications. That's why we are using "mappedName"

Greetings,

Stefaan Somers

On 9 August 2011 11:55, Guillaume Sauthier (OW2)
<[email protected]> wrote:
> You should also remove your mapped names (don't needed anymore because yo=
u
> rely on the container to find the right interface for you).
>
> --G
>
> 2011/8/9 Stefaan Somers <[email protected]>
>>
>> Hello,
>>
>> I'v tried that too, but it also injects the remote-bean then instead
>> of the local-bean.
>>
>> Greetings,
>>
>> Stefaan Somers
>>
>> On 9 August 2011 11:04, Guillaume Sauthier (OW2)
>> <[email protected]> wrote:
>> > Can't you change your Calculator.java to something like this:
>> >
>> > It's much more easier to read :)
>> >
>> > /**
>> > =A0* Session Bean implementation class Calculator
>> > =A0*/
>> > @Stateless
>> > public class Calculator implements CalculatorRemote, CalculatorLocal {
>> >
>> > =A0 @EJB
>> > =A0 private ParametersLocal params;
>> >
>> >
>> > =A0=A0=A0 /**
>> > =A0=A0=A0=A0 * Default constructor.
>> > =A0=A0=A0=A0 */
>> > =A0=A0=A0 public Calculator() {
>> >
>> > =A0=A0=A0 }
>> >
>> > =A0=A0=A0 @Override
>> > =A0=A0=A0 public String returnMessage() {
>> > =A0=A0=A0 =A0=A0=A0 result =3D parameters.getParameter();
>> > =A0=A0=A0 =A0=A0=A0 return "It's all being calculated :" + result;
>> > =A0=A0=A0 }
>> >
>> > }
>> >
>> > 2011/8/9 Stefaan Somers <[email protected]>
>> >>
>> >> Hi Guillaume,
>> >> Thnks for responding. I'm already banging my head for a few days with
>> >> this problem. So any help would be most welcome.
>> >>
>> >> I've included a sample project. For the Parameters-bean I use the
>> >> mappedName parameter, since I need to give it a unique-name.
>> >>
>> >> If I try to get the Local Parameters-bean with the Calculator-bean, i=
t
>> >> gives me the following exception :
>> >>
>> >> java.lang.ClassCastException: $Proxy63 cannot be cast to
>> >> be.sso.test.ParametersLocal
>> >> =A0 =A0 =A0 =A0at
>> >>
>> >> be.sso.test.Calculator.original$EasyBeans$returnMessage(Calculator.ja=
va:34)
>> >> =A0 =A0 =A0 =A0at
>> >>
>> >> org.ow2.easybeans.gen.invocationcontext.be.sso.test.Calculator.EasyBe=
ansInvocationContextImplreturnMessageAROUNDINVOKE1942950347.proceed(Unknown
>> >> Source)
>> >> =A0 =A0 =A0 =A0at
>> >>
>> >> org.ow2.easybeans.transaction.interceptors.CMTRequiredTransactionInte=
rceptor.intercept(CMTRequiredTransactionInterceptor.java:110)
>> >> =A0 =A0 =A0 =A0at
>> >>
>> >> org.ow2.easybeans.gen.invocationcontext.be.sso.test.Calculator.EasyBe=
ansInvocationContextImplreturnMessageAROUNDINVOKE1942950347.proceed(Unknown
>> >> Source)
>> >> =A0 =A0 =A0 =A0at
>> >>
>> >> org.ow2.jonas.jndi.interceptors.impl.easybeans.ResourceCheckerInterce=
ptor.intercept(ResourceCheckerInterceptor.java:103)
>> >> =A0 =A0 =A0 =A0at
>> >>
>> >> org.ow2.easybeans.gen.invocationcontext.be.sso.test.Calculator.EasyBe=
ansInvocationContextImplreturnMessageAROUNDINVOKE1942950347.proceed(Unknown
>> >> Source)
>> >> =A0 =A0 =A0 =A0at
>> >>
>> >> org.ow2.jonas.ejb.easybeans.JOnASENCInterceptor.intercept(JOnASENCInt=
erceptor.java:67)
>> >> =A0 =A0 =A0 =A0at
>> >>
>> >> org.ow2.easybeans.gen.invocationcontext.be.sso.test.Calculator.EasyBe=
ansInvocationContextImplreturnMessageAROUNDINVOKE1942950347.proceed(Unknown
>> >> Source)
>> >> =A0 =A0 =A0 =A0at be.sso.test.Calculator.returnMessage(Calculator.jav=
a)
>> >> =A0 =A0 =A0 =A0at sun.reflect.NativeMethodAccessorImpl.invoke0(Native=
 Method)
>> >> =A0 =A0 =A0 =A0at
>> >>
>> >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.=
java:39)
>> >> =A0 =A0 =A0 =A0at
>> >>
>> >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces=
sorImpl.java:25)
>> >> =A0 =A0 =A0 =A0at java.lang.reflect.Method.invoke(Method.java:597)
>> >> =A0 =A0 =A0 =A0at
>> >>
>> >> org.ow2.easybeans.container.session.stateless.StatelessSessionFactory=
.localCall(StatelessSessionFactory.java:161)
>> >> =A0 =A0 =A0 =A0at
>> >>
>> >> org.ow2.easybeans.container.session.SessionFactory.rpcInvoke(SessionF=
actory.java:237)
>> >> =A0 =A0 =A0 =A0at
>> >>
>> >> org.ow2.easybeans.rpc.rmi.server.RMIServerRPCImpl.getEJBResponse(RMIS=
erverRPCImpl.java:106)
>> >> =A0 =A0 =A0 =A0at
>> >>
>> >> org.ow2.easybeans.rpc.rmi.client.RMIClientRPC.sendEJBRequest(RMIClien=
tRPC.java:105)
>> >> =A0 =A0 =A0 =A0at
>> >>
>> >> org.ow2.easybeans.proxy.client.ClientRPCInvocationHandler.invoke(Clie=
ntRPCInvocationHandler.java:195)
>> >> =A0 =A0 =A0 =A0at
>> >>
>> >> org.ow2.easybeans.proxy.client.ClientRPCInvocationHandler.invoke(Clie=
ntRPCInvocationHandler.java:111)
>> >> =A0 =A0 =A0 =A0at $Proxy62.returnMessage(Unknown Source)
>> >> =A0 =A0 =A0 =A0at
>> >> be.sso.servlet.CalculateServlet.doGet(CalculateServlet.java:40)
>> >> =A0 =A0 =A0 =A0at javax.servlet.http.HttpServlet.service(HttpServlet.=
java:617)
>> >> =A0 =A0 =A0 =A0at javax.servlet.http.HttpServlet.service(HttpServlet.=
java:717)
>> >> =A0 =A0 =A0 =A0at
>> >>
>> >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl=
icationFilterChain.java:290)
>> >> =A0 =A0 =A0 =A0at
>> >>
>> >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF=
ilterChain.java:206)
>> >> =A0 =A0 =A0 =A0at
>> >>
>> >> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV=
alve.java:233)
>> >> =A0 =A0 =A0 =A0at
>> >>
>> >> org.apache.catalina.core.StandardContextValve.invoke(StandardContextV=
alve.java:191)
>> >> =A0 =A0 =A0 =A0at
>> >>
>> >> org.ow2.jonas.web.tomcat6.CheckOpenResourcesValve.invoke(CheckOpenRes=
ourcesValve.java:73)
>> >> =A0 =A0 =A0 =A0at
>> >>
>> >> org.ow2.jonas.web.tomcat6.tx.TransactionValve.invoke(TransactionValve=
.java:90)
>> >> =A0 =A0 =A0 =A0at
>> >>
>> >> org.ow2.jonas.web.tomcat6.ResetAuthenticationValve.invoke(ResetAuthen=
ticationValve.java:95)
>> >> =A0 =A0 =A0 =A0at
>> >>
>> >> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j=
ava:127)
>> >> =A0 =A0 =A0 =A0at
>> >>
>> >> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j=
ava:102)
>> >> =A0 =A0 =A0 =A0at
>> >>
>> >> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal=
ve.java:109)
>> >> =A0 =A0 =A0 =A0at
>> >>
>> >> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav=
a:340)
>> >> =A0 =A0 =A0 =A0at
>> >>
>> >> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java=
:857)
>> >> =A0 =A0 =A0 =A0at
>> >>
>> >> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce=
ss(Http11Protocol.java:588)
>> >> =A0 =A0 =A0 =A0at
>> >> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:48=
9)
>> >> =A0 =A0 =A0 =A0at java.lang.Thread.run(Thread.java:619)
>> >>
>> >>
>> >>
>> >> On 9 August 2011 10:45, Guillaume Sauthier (OW2)
>> >> <[email protected]> wrote:
>> >> > Can't you rely on container's injection (@EJB) ?
>> >> > --G
>> >> >
>> >> > 2011/8/9 Stefaan Somers <[email protected]>
>> >> >>
>> >> >> Hi all,
>> >> >>
>> >> >> I need to change the remote jndi-name of a Stateless Session Bean =
.
>> >> >> Default the naming for jonas is :
>> >> >>
>> >> >> SessionBean.class.getName()
>> >> >> + "_" + SessionBeanInterface.class.getName() + "@Remote"
>> >> >>
>> >> >> How can I change this. If I add the attribute mappedName in the
>> >> >> @Stateless-annotation, I cannot get to the Local Interface anymore=
.
>> >> >> And I need to be able to get to both.
>> >> >>
>> >> >> Greetings,
>> >> >>
>> >> >> Stefaan Somers
>> >> >
>> >> >
>> >
>> >
>
>