Hello Vivek...

--On Monday, October 16, 2000 10:20 PM -0500 Vivek Iyer 
<[EMAIL PROTECTED]> wrote:

> The error I get is (ultimately):
>
> D:\vivek\pricing\ejb\product>java ProductClient
> Communication error: Error reading application-client descriptor: No
> location specified and no suitable instance of the type 'Product' found
> for the ejb-ref MyProduct

I have found that the cause of this error is a mistake in the ejb-jar.xml 
file or in your web.xml file. In order for your app to use the nameing 
context like this:

    Object obj = context.lookup("java:comp/env/ejb/CreateNewUarHomeSlsb");

You need an entry in the proper deployment descriptor like this:

    <ejb-ref>
      <ejb-ref-name>ejb/CreateNewUarHomeSlsb</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      <home>com.regtek.slsb.CreateNewUARHome</home>
      <remote>com.regtek.slsb.CreateNewUAR</remote>
    </ejb-ref>


I have these entries in my web.xml file for my servlets that want to access 
EJBs and also in my ejb-jar.xml file for EJBs that want to access other 
EJBs. Often, I mistype some part of this entry to point to a bean that does 
not exist and occasionally I forget this entry entirely. Every time, I get 
the error you described.

Remember, in the ejb-jar.xml file, these references are scopped for a 
particular bean, so that different beans can have the same reference name 
but have it point to somewhere different. Be sure to set these entries in 
that deployment descriptor for each bean, within the EJBs definition. Here 
is an example of a session bean I use:

<session>
   <description>Create a UAR</description>
   <display-name>com.regtek.slsb.CreateNewUAR</display-name>
   <ejb-name>com.regtek.slsb.CreateNewUAR</ejb-name>
   <home>com.regtek.slsb.CreateNewUARHome</home>
   <remote>com.regtek.slsb.CreateNewUAR</remote>
   <ejb-class>com.regtek.slsb.CreateNewUARBean</ejb-class>
   <session-type>Stateless</session-type>
   <transaction-type>Container</transaction-type>
   <ejb-ref>
      <ejb-ref-name>ejb/UarHomeEb</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      <home>com.regtek.eb20.UarHome</home>
      <remote>com.regtek.eb20.Uar</remote>
   </ejb-ref>
   <ejb-ref>
      <ejb-ref-name>ejb/CrHomeEb</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      <home>com.regtek.eb20.CrHome</home>
      <remote>com.regtek.eb20.Cr</remote>
   </ejb-ref>
</session>

This example allows my EJB session bean called CreateNewUAR to access two 
other entity beans using the references ejb/UarHomeEb and ejb/CrHomeEb.

I hope this helps. Good luck.

Jim




>
> Is this an obvious problem? I can't believe this is just happening
> because I change the location of the class files and meta-inf files. I
> noticed someone else got this error some time ago, but no solution was
> posted.  Here's the gory story, steps 1 through 7:
>
> System: WinNT4 SP6
> JDK: 1.2.2
> CLASSPATH: .;
> d:\orion\orion.jar;d:\orion\jndi.jar;d:\orion\servlet.jar;d:\orion\ejb.jar
>
> 1. INITIALIZED ORION, deployed the ejbsamples, and the "ProductClient"
> successfully ran, out-of-the-box. All classes are located in
> d:\orion\demo\ejb\product\
>
> 2. COPIED the jndi.properties, ProductEJB, ProductHome and Product (remote
> interface) and ProductClient to d:\vivek\pricing\ejb\product\ and all the
> meta-inf files (application-client.xml, ejb-jar.xml,
> orion-application-client.xml) _without change_, recompiled all the files.
> Added an application.xml file into
> d:\vivek\pricing\ejb\meta-inf\application.xml with the following lines -
>
> <application>
>      <display-name>Pricing</display-name>
>      <module>
>           <ejb>product</ejb>
>      </module>
> </application>
>
> 3. COMMENTED out the "ejbsamples" part of orion's server.xml. Deleted that
> application's deployment files. Added the following application to
> server.xml:
>
> <application name="pricing" path="d:\\vivek\\pricing\\ejb" />
>
> 4. RESTARTED Orion. Observed that
>
> Auto-deploying pricing (New server version detected)...
> Auto-deploying product (No previous deployment found)... done.
> Orion/1.4.0 initialized
>
> 5. RAN ProductClient, and got this message -
>
> D:\vivek\pricing\ejb\product>java ProductClient
> Exception in thread "main" java.lang.SecurityException: No such
> domain/applicati on: ejbsamples
>         at com.evermind.server.rmi.bd.gk(JAX)
>         at com.evermind.server.rmi.bd.gk(JAX)
>         at com.evermind.server.rmi.bd.f3(JAX)
>         at com.evermind.server.rmi.RMIServer.f3(JAX, Compiled Code)
>         at com.evermind.server.rmi.RMIContext.lookup(JAX)
>         at com.evermind.server.administration.LazyResourceFinder.f3(JAX)
>         at
>         com.evermind.server.administration.LazyResourceFinder.getEJBHome(
>         JAX)
>
>         at com.evermind.server.Application.aqo(JAX, Compiled Code)
>         at
>         com.evermind.server.ApplicationClientInitialContextFactory.getIni
>         tial Context(JAX, Compiled Code)
>         at
>         javax.naming.spi.NamingManager.getInitialContext(NamingManager.ja
>         va:6 72)
>         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 ProductClient.main(ProductClient.java:18)
>
> 6. ALTERED the second line of jndi.properies:
> OLD: java.naming.provider.url=ormi://localhost/ejbsamples
> NEW: java.naming.provider.url=ormi://localhost/
> (What's up with this, anyway??)
>
> 7. RE-RAN ProductClient, and now get the final message -
>
> D:\vivek\pricing\ejb\product>java ProductClient
> Communication error: Error reading application-client descriptor: No
> location sp ecified and no suitable instance of the type 'Product' found
> for the ejb-ref MyP roduct
>
> Any assistance would be appreciated. I'm sure I had this working in a
> much older version
> of Orion, and it seems to have broken, dont know why.
>
> Thanks,
>
> Vivek
>
>





Reply via email to