Hello all Orion Users,
I have been going through the tutorial on the java.sun.com web site and
I was able to successfully deploy an EJB but I got stumped at the last
stage. The following code segment is for WebLogic. Does anyone know the
changes I need to make to this segment of code to be Orion specific.
package ejb.demo;
import javax.ejb.*;
import javax.naming.*;
import java.rmi.*;
import java.util.Properties;
/**
* DemoClient demonstrates using a minimal
stateless
* session bean.
* Remember view session beans as an extension
of your
* client running in the server.
*/
public class DemoClient {
public static void main(String[] args) {
System.out.println("\nBegin
DemoClient...\n");
parseArgs(args);
try {
// Create A DemoBean object, in the server
// Note: the name of the class corresponds to
the
// JNDI property declared in the
// DeploymentDescriptor
// From DeploymentDescriptor ...
// beanHomeName demo.DemoHome
Context ctx = getInitialContext();
DemoHome dhome = (DemoHome)
ctx.lookup("demo.DemoHome");
// Now you have a reference to the DemoHome
object
// factory use it to ask the container to
creat an
// instance of the Demo bean
System.out.println("Creating Demo\n");
Demo demo = dhome.create();
// Here is the call that executes the method
on the
// server side object
System.out.println("The result is "
+ demo.demoSelect());
}
catch (Exception e) {
System.out.println(" => Error <=");
e.printStackTrace();
}
System.out.println("\nEnd DemoClient...\n");
}
static void parseArgs(String args[]) {
if ((args == null) || (args.length == 0))
return;
for (int i = 0; i < args.length; i++) {
if (args[i].equals("-url"))
url = args[++i];
else if (args[i].equals("-user"))
user = args[++i];
else if (args[i].equals("-password"))
password = args[++i];
}
}
static String user = null;
static String password = null;
static String url = "t3://localhost:7001";
/**
* Gets an initial context.
*
* @return Context
* @exception java.lang.Exception if there is
* an error in getting a Context
*/
static public Context getInitialContext()
throws Exception {
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.T3InitialContextFactory");
p.put(Context.PROVIDER_URL, url);
if (user != null) {
System.out.println ("user: " + user);
p.put(Context.SECURITY_PRINCIPAL, user);
if (password == null)
password = "";
p.put(Context.SECURITY_CREDENTIALS,
password);
}
return new InitialContext(p);
}
}
The last section of code where the initial context is being looked up
seems to be where my problem lies. I have
replaced the string that says "weblogic.jndi...." with
"com.evermind.server.ApplicationClientInitialContextFactory".
Is this correct? What should the URL be? I have not been able to find
any doco on this (I am probably looking in the
wrong place.
The error I get when running this is,
javax.naming.NamingException: META-INF/application-client.xml resource
not found
Does anyone know how I should fix this. The purpose of me asking this is
because I want an application server such as Orion hosting all my ejb's
and
looking after them. I then want an application to use those beans (not
running
within Orion) to access them with the appropriate access. I believe it
has
something to do with RMI but not exactly sure how I should be accessing
Orion's JVM other than this way.
Your help is much appreciated.
Regards,
Mark
[EMAIL PROTECTED]
begin:vcard
n:Bernardinis;Mark
x-mozilla-html:FALSE
org:Westfield;eCommerce Development
adr:;;;;;;
version:2.1
email;internet:[EMAIL PROTECTED]
x-mozilla-cpt:;0
fn:Mark Bernardinis
end:vcard