> Ray Madigan wrote:
>
> Either what i am trying to do is not possible or it is so trivial - and i lack an
>understanding.
> I hope u can tell me if this should work of if i should find another application
>server. Thanks
> in advance
>
> I have an application that i am building an EJB solution for. The crux of my
>difficulty stems
> from the fact that each instance of the application is deployed onto a different
>database. So i
> want to deploy the same bean technology for each database.
>
> Each Bean in developed with BMP. It is built with the standard set of files for
>example:
> Member.java
> MemberHome.java
> MemberBean.java
> MemberPK.java
>
> each deployment of the bean has a ejb-jar.xml deployment descriptors like:
> <entity>
> <description>This bean represents a member.</description>
> <ejb-name>KirklandMemberBean</ejb-name>
> <home>com.mbresearch.member.MemberHome</home>
> <remote>com.mbresearch.member.Member</remote>
> <ejb-class>com.mbresearch.member.MemberBean</ejb-class>
> <persistence-type>Bean</persistence-type>
> <prim-key-class>com.mbresearch.member.MemberPK</prim-key-class>
> <reentrant>False</reentrant>
> <env-entry>
>#describe the
> database to use for getConnection ( )
> <env-entry-name>partition</env-entry-name>
> <env-entry-type>java.lang.String</env-entry-type>
> <env-entry-value>kirkland</env-entry-value>
> </env-entry>
> <resource-ref>
> <description>DataSource for the xrm database</description>
> <res-ref-name>jdbc/kirkland</res-ref-name>
> <res-type>javax.sql.DataSource</res-type>
> <res-auth>Container</res-auth>
> </resource-ref>
> </entity>
>
> And the bean jonas deployment descriptor looks like:
> <jonas-entity>
> <ejb-name>KirklandMemberBean</ejb-name> # The unique name ginve the bean
><DB>MemberBean
> <jndi-name>member@kirkland</jndi-name> # The named used in lookup to find this
>bean
> <jonas-resource>
> <res-ref-name>jdbc/kirkland</res-ref-name>
> <jndi-name>kirkland</jndi-name>
> </jonas-resource>
> </jonas-entity>
>
> I look up the bean from another session bean with code like:
> public void showMembers ( String partition )
> throws RemoteException {
> try {
> MemberHome home = ( MemberHome) getHome ( "member@" + partition,
>MemberHome.class );
> // The code never makes it to here
> Enumeration enum = home.enumerate ( );
> while ( enum.hasMoreElements ( ) ) {
> Object ref = enum.nextElement ( );
> Member member = ( Member ) PortableRemoteObject.narrow ( ref, Member.class
>);
> System.out.println ( " Member: " + member.getName ( ) );
> }
> }
> catch ( FinderException fe ) { throw new EJBException ( fe ); }
> }
>
> getHome from the calling session bean looks like:
> protected Object getHome ( String name, Class type )
> throws RemoteException {
> try {
> Object ref = jndiContext.lookup ( name );
> return PortableRemoteObject.narrow ( ref, type );
> }
> catch ( NamingException ne ) { throw new EJBException ( ne ); }
> }
Maybe I'm missing something, but I can't see what NamingException you got ?
Moreover, I don't think it's a good idea to raise EJBException here.
Use RemoteException instead.
>
> The server error is:
> Exception: javax.ejb.EJBException
> System exc. => Rollback the transaction.
> System Exception in business method:javax.ejb.EJBException
>
> And the client side error is:
> java.rmi.ServerException: RemoteException occurred in server thread; nested
>exception is:
> java.rmi.RemoteException: RuntimeException thrown by an enterprise Bean; nested
>exception is:
> javax.ejb.EJBException
> java.rmi.RemoteException: RuntimeException thrown by an enterprise Bean; nested
>exception is:
> javax.ejb.EJBException
> javax.ejb.EJBException
> at
>sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)
> at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
> at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:354)
> at org.objectweb.jonas.rmifilters.RemoteStub.invoke(RemoteStub.java:87)
> at
> com.mbresearch.registrar.JOnASRegistrarBeanRemote_Stub.showPartitions
>(JOnASRegistrarBeanRemote_Stub.java
> :196)
> at getMember.main(getMember.java:26)
--
Philippe Durieux ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Bull - 1 rue de Provence - 38432 Echirolles Cedex France
[EMAIL PROTECTED]
-> Download our EJBServer at http://www.evidian.com/ejb <-
----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".