RE: Client application Please Help

2000-10-06 Thread Pantelis, Thomas
Title: RE: Client application Please Help





The correct lookup is java:comp/env/TeamBean. I assume you're running you're client
outside of Orion? Make sure your provider_url JNDI prop points to
ormi://localhost/app name where app name is the name of the TeamBean app in
server.xml.


-Original Message-
From: Frank Eggink [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 06, 2000 8:05 AM
To: Orion-Interest
Subject: RE: Client application Please Help



I bet you'll have to change ic.lookup(TeamBean) in to 
ic.lookup(comp:/java/env/TeamBean), a bit depending on what's defined in 
your *.xml files.


These files define the name under which the bean gets registered. 
comp:/java/env/ is a fixed? prefix.


Frank


On Thursday, October 05, 2000 7:18 PM, Daniel C. DiCesare 
[SMTP:[EMAIL PROTECTED]] wrote:
 Frank,
 I checked out your example but I am continuing to experience problems. 
Here
 is what I have. I have included the script for my xml files below.

 I have deployed an EJB called Team onto Orion. It sits in a EAR file 
which
 within it has a Team.jar file. The JAR file contains the following:
 Team.class - ( remote interface )
 TeamHome.class - ( home interface )
 TeamEJB - ( EJB )
 ejb-jar.xml - ( deployment descriptor )

 I then created a team-client.jar which consists of the following:
 TeamClient.class - ( client )
 application-client.xml - ( client xml )

 In my TeamClient I attempt to connect to the TeamEJB as follows:
 Context ic = new InitialContext();
 Object obj = ic.lookup( TeamBean );
 _TeamHome = ( TeamHome )PortableRemoteObject.narrow( obj,
 TeamHome.class );





 When I try to run the client I get the following message:
 javax.naming.NamingException: Error reading application-client 
descriptor:
 No location specified and no suitable instance of the type 'Team' found 
for
 the ejb-ref TeamBean
 at
 
com.evermind.server.ApplicationClientInitialContextFactory.getInitialCon 
text
 (JAX, Compiled Code)
 at
 javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:672)
 at
 javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:250)
 at javax.naming.InitialContext.init(InitialContext.java:226)
 at javax.naming.InitialContext.init(InitialContext.java:182)
 at TeamRandomTrade.main(TeamRandomTrade.java, Compiled Code)


 Can you or anyone please advise as to what I am doing wrong?

 Thanks in advance.
 -Danno



 The ejb-jar.xml looks as follows:

 ?xml version=1.0 encoding=UTF-8?
 !DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise
 JavaBeans 1.1//EN' 'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'

 ejb-jar
 descriptionno description/description
 display-nameTeamEJB/display-name
 enterprise-beans
 entity
 descriptionno description/description
 display-nameTeamBean/display-name
 ejb-nameTeamBean/ejb-name
 homeTeamHome/home
 remoteTeam/remote
 ejb-classTeamEJB/ejb-class
 persistence-typeBean/persistence-type
 prim-key-classjava.lang.Integer/prim-key-class
 reentrantFalse/reentrant
 resource-ref
 descriptionA description for ResourceRefName/description
 res-ref-namejdbc/SF/res-ref-name
 res-typejavax.sql.DataSource/res-type
 res-authContainer/res-auth
 /resource-ref
 /entity
 /enterprise-beans
 /ejb-jar



 My application-client.xml file looks as follows:
 ?xml version=1.0?
 !DOCTYPE application-client PUBLIC -//Sun Microsystems, Inc.//DTD J2EE
 Application Client 1.2//EN
 http://java.sun.com/j2ee/dtds/application-client_1_2.dtd
 application-client
 display-nameSportsFund/display-name
 description/description
 ejb-ref
 ejb-ref-nameTeamBean/ejb-ref-name
 ejb-ref-typeSession/ejb-ref-type
 homeTeamHome/home
 remoteTeam/remote
 /ejb-ref
 /application-client
 





RE: Client application

2000-10-06 Thread Pantelis, Thomas
Title: RE: Client application





Shouldn't it be orion-primer-client.jar?


-Original Message-
From: Daniel C. DiCesare [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 06, 2000 4:48 AM
To: Orion-Interest
Subject: Re: Client application



Frank,
I followed your example and deployed the orion-primer application. I copied
the necessary JAR's into my directory along with the jndi.properties file. I
also copied the orion-primer-client.jar into my directory. I then ran the
following


java -classpath .:orion.jar:ejb.jar:jndi.jar:orion-primer-clinet.jar
hello.client.HelloClient


I got the following error:
Exception in thread main java.lang.NoClassDefFoundError:
hello/client/HelloClient


Any idea?


-Danno





RE: Interesting ejb Error!!!

2000-10-04 Thread Pantelis, Thomas
Title: RE: Interesting ejb Error!!!





I have seen ClassCastExceptions when narrowing an object obtained from another application.
I believe it's due to different class loaders for each app. If you're servlet is in another
app, then you have to set it's parent attribute (i.e. parent=ejbsamples ) in the sever.xml.
Also I think you should be using ApplicationInitialContextFactory. ApplicationClientInitialContextFactory
is explicitly for external clients. But if you set the parent attribute then you shouldn't have to set 
the JNDI properties. Just do Context context = new InitialContext();


If you're servlet is in the same app, then again you shouldn't have to set the JNDI props - the
container does that for you.


Either way ApplicationClientInitialContextFactory is not correct for a servlet.


-Original Message-
From: Andiappan Jeyamurugan
[mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 04, 2000 1:50 AM
To: Orion-Interest
Subject: Interesting ejb Error!!!



Hello there,
I am trying to access the orion's demo/ejb/cart ejbeans via servlet or jsp
file. The code is
  try
  {
 Hashtable env = new Hashtable();

env.put(Context.INITIAL_CONTEXT_FACTORY,com.evermind.server.ApplicationClie
ntInitialContextFactory);

env.put(Context.PROVIDER_URL,ormi://10.1.1.59/ejbsamples);
 env.put(Context.SECURITY_PRINCIPAL,admin);
 env.put(Context.SECURITY_CREDENTIALS,123); 
  Context context = new InitialContext(env);
  Object homeObject = context.lookup(java:comp/env/MyCart);
 CartHome home =
(CartHome)PortableRemoteObject.narrow(homeObject, CartHome.class);
 }
  //Cart cart =
(Cart)PortableRemoteObject.narrow(home.create(), Cart.class);
 }
 catch(Exception ee){
 return Error Becomes ...+ee;
 } 
I am getting error as,
 java.lang.ClassCastException: CartHome_StatefulSessionHomeWrapper2 


If I access the ejbeans from an application on command prompt, it is working
fine.
I really wonder why the same code is not working in servlet/beans/jsp.
Can anyone help me?


Thanks in advance
Jeya([EMAIL PROTECTED])
=
WARNING -This e-mail, including any attachments, is for the 
personal use of the recipient(s) only.
Republication and re-dissemination, including posting to news 
groups or web pages, is strictly prohibited without the express
prior consent of
Thomson Legal  Regulatory Group Asia Pacific Ltd 
ACN 058 914 668
=





RE: EJB ClassCastException problem

2000-10-02 Thread Pantelis, Thomas
Title: RE: EJB ClassCastException problem





Thanks Karl. I missed the parent attribute because I've been looking at older docs in my
1.2.9 install area which don't have it. Maybe it was put in since 1.2.9. The udated docs
on orionserver.com contain the parent attribute.


I probably should've been more clear in my response. I really wasn't trying to say the concept
of application namespace domains was a limitation in of itself. It does make sense. I was really trying
to say that if you can't access or share components across apps, then that would be a limitation. The
parent attribute looks like that will do what we want. I'll try it out. Hopefully my ejb-refs
will work as well.



-Original Message-
From: Karl Avedal [mailto:[EMAIL PROTECTED]]
Sent: Saturday, September 30, 2000 7:04 AM
To: Orion-Interest
Subject: Re: EJB ClassCastException problem



Hello Erin,


Look at
http://www.orionserver.com/docs/auto/attributes/parent_(server.xml_-_application).html


The parent attribute is used for exactly what you want, a child application sees
the objects of its parents, so you can have an application hierarchy where you
have shared EJBs in the root node and more specialized in the children. By
default every application has the global application as their parent (just like
all Java classes inherit java.lang.Object).


Example:


application name=utils path=../applications/utils.ear auto-start=true/
application name=webshop path=../applications/webshop.ear auto-start=true
parent=utils/


(This is in server.xml btw)


The rationale behind having a domain/application based JNDI tree is the same as
the rationale behind OO. You want to hide the different applications from
eachother, so that they don't interfere with eachother.


This is especially useful when you deploy 3rd party applications or in hosting
environments when an Orion instance is possibly shared between more than one
user.


Regards,
Karl Avedal


Erin Hill wrote:


 I have had that same problem. Like you, I have been pulling my hair out
 trying to figure out
 how to access a component in one application from a component in another. I
 too stumbled
 upon the RMIInitialContextFactory as well but I cannot cast/narrow objects
 obtained via JNDI.
 I always get a ClassCastException. I have temporarily gotten around the
 problem by using
 reflection to call methods but it's not a solution. I think it's a bug in
 Orion. I believe it's a class loader
 issue. The object returned from JNDI and the class object you pass to narrow
 have different
 class loaders - it appears to me each application has its own class loader.

 I am frustrated by the fact that I cannot access beans across application
 domains without resorting
 to proprietary incantations. ejb-refs do not work either across domains -
 deployment fails.. I think this
 feature is a non-comformance of the J2EE/EJB specs. The spec says nothing
 about partitioning the
 namespace. The container should resolve the ejb-ref no matter where the
 referenced bean resides. Other application servers I have tried employ a
 flat namespace and do not have these issues.

 Overall I think Orion is a good product but I see application namespace
 domains as a limitation.
 I really don't see the rationale behind the design. You cannot see another
 apps namespace with
 the JNDI context provided by the container but you CAN using another context
 (RMIInitialContextFactory).
 Seems inconsistent to me.

 Ill be interested to see how they handle domains when they implement
 IIOP/CosNaming for EJB 2.0.
 Will C++ CORBA clients see a flat namespace?