• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem in calling the mapped JNDI name

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear all,
Can anyone help me to solve the following problem:
I deployed the "converter" ejb but when I start the weblogic 6.1 server, it gave me the following error message:
...
<22/08/2001 16:01:57> <Error> <J2EE> <Error deploying application build:
Unable to deploy EJB: lab1converter from build:
Unable to bind a cluster-aware stateless session EJBObject to the name: lab1converter2call_EO. Please ensure that the jndi-name in the weblogic-ejb-jar.xml is correct. The error was:
javax.naming.NameAlreadyBoundException: Can't rebind anything but a replica-aware stub to a name that is currently bound to a replica-aware stub; remaining name ''
<<no stack trace available>>
...
Please note that my "weblogic-ejb-jar.xml" is like:
...
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>lab1converter</ejb-name>
<jndi-name>lab1converter2call</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
...
Thanks a lot for the help in advanced!!!
Victor
------------------
Victor
 
Ranch Hand
Posts: 1871
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried by changing the name
<jndi-name>lab1converter2call</jndi-name>
to something else and trying it.
 
Victor Su
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Rahul,
Thanks for the suggestion and I finally get it running-- the same complaint is still there(when I started up the server), I think it's probably the server found that I made the second attempt of the deployment and complaints I try to "reuse" the JNDI mapping(you know, I have to run my build script everytime I update my source code.). The whole movie is like this:
1. I edited the sample build.xml from the weblogic 6.1 and make it suitable for the sample "converter" ejb downloaded from the Sun J2EE website.
2. And then I run the "ant" on my "build.xml" to build and deploy my EJB (no complaint at all!!)
After the deployment, I ran the "setEnv"(modified to suit my current directory structure) and then start the weblogic server.
And it gave me the name duplicate exception as on my last post message("...javax.naming.NameAlreadyBoundException: Can't rebind anything but a replica-aware stub to a name that is currently bound to a replica-aware stub; remaining name.."). However the server is running.
And then, I modified the "ConverterClient.java" file(combining the strutural features from the traderclient file from the weblogic example), like this:

import java.rmi.RemoteException;
import java.util.Properties;
import javax.ejb.CreateException;
import javax.ejb.RemoveException;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;
/**
* This class illustrates calling a stateless Session Bean and performing
* the following exercises:
* <ul>
* <li> Create a Trader
* <li> Buy some shares using the Trader
* <li> Sell some shares using the Trader
* <li> Remove the Trader
* </ul>
*
* @author Copyright (c) 1998 by WebLogic, Inc. All Rights Reserved.
* @author Copyright (c) 1998-2001 by BEA Systems, Inc. All Rights Reserved.
*/
public class ConverterClient {
private static final String JNDI_NAME = "lab1converter2call";
private String url;
private ConverterHome home;
public ConverterClient(String url)
throws NamingException
{
this.url = url;

home = lookupHome();
}
/**
* Runs this example from the command line. Example:
* <p>
* <tt>java examples.ejb.basic.statelessSession.Client "t3://localhost:7001"</tt>
* <p>
* The parameters are optional, but if any are supplied,
* they are interpreted in this order:
* <p>
* @param url URL such as "t3://localhost:7001" of Server
*/
public static void main(String[] args) throws Exception {
log("\nBeginning statelessSession.Client...\n");
String url = "t3://localhost:8001";//for client application call, if for servlet or asp call then can use http.

// Parse the argument list
if (args.length != 1) {
System.out.println("Usage: java examples.ejb.basic.statelessSession.Client t3://hostname ort");
return;
} else {
url = args[0];
}
ConverterClient client = null;
try {
client = new ConverterClient(url);
} catch (NamingException ne) {
System.exit(1);
}
try {
client.example();
} catch (Exception e) {
log("There was an exception while creating and using the Trader.");
log("This indicates that there was a problem communicating with the server: "+e);
}
log("\nEnd statelessSession.Client...\n");
}
/**
* Runs this example.
*/
public void example()
throws CreateException, RemoteException, RemoveException
{

// create a RemoteInterface object Converter
log("Creating a trader");
Converter currencyConverter = (Converter) narrow(home.create(), Converter.class);
try {
//Context initial = new InitialContext();
//Context initial = getInitialContext(args[0]);
//Object objref = initial.lookup("lab1converter2call");
//ConverterHome home = (ConverterHome)PortableRemoteObject.narrow(objref, ConverterHome.class);
//Converter currencyConverter = home.create();

double amount = currencyConverter.dollarToYen(100.00);
System.out.println(String.valueOf(amount));
amount = currencyConverter.yenToEuro(100.00);
System.out.println(String.valueOf(amount));
currencyConverter.remove();
} catch (Exception ex) {
System.err.println("Caught an unexpected exception!");
ex.printStackTrace();
}
}
/**
* RMI/IIOP clients should use this narrow function
*/
private Object narrow(Object ref, Class c) {
return PortableRemoteObject.narrow(ref, c);
}
/**
* Lookup the EJBs home in the JNDI tree
*/
private ConverterHome lookupHome()
throws NamingException
{
// Lookup the beans home using JNDI
Context ctx = getInitialContext();

try {
Object home = ctx.lookup(JNDI_NAME);
return (ConverterHome) narrow(home, ConverterHome.class);
} catch (NamingException ne) {
log("The client was unable to lookup the EJBHome. Please make sure ");
log("that you have deployed the ejb with the JNDI name "+JNDI_NAME+" on the WebLogic server at "+url);
throw ne;
}
}
/**
* Using a Properties object will work on JDK 1.1.x and Java2
* clients
*/
private Context getInitialContext() throws NamingException {

try {
// Get an InitialContext
Properties h = new Properties();
h.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
h.put(Context.PROVIDER_URL, url);
return new InitialContext(h);
} catch (NamingException ne) {
log("We were unable to get a connection to the WebLogic server at "+url);
log("Please make sure that the server is running.");
throw ne;
}
}
/**
* This is the Java2 version to get an InitialContext.
* This version relies on the existence of a jndi.properties file in
* the application's classpath.
*
*/
// private static Context getInitialContext()
// throws NamingException
// {
// return new InitialContext();
// }
private static void log(String s) {
System.out.println(s);
}

}
After that, I re-run the client as:
java ConverterClient t3://localhost:8001
And it works !!!
But still, if anyone can tell me how to get rid of the complaining message from the server like the following would be of much appreciated!!
"....
####<22/08/2001 16:51:39> <Error> <J2EE> <n00303wes001> <myserver> <main> <system> <> <160001> <Error deploying application build:
Unable to deploy EJB: lab1converter from build:
Unable to bind a cluster-aware stateless session EJBObject to the name: lab1converter2call_EO. Please ensure that the jndi-name in the weblogic-ejb-jar.xml is correct. The error was:
javax.naming.NameAlreadyBoundException: Can't rebind anything but a replica-aware stub to a name that is currently bound to a replica-aware stub; remaining name ''
..."
Thanks very much.

------------------
Victor
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic