[jboss-user] [JBoss jBPM] - Re: Help in Excecuting Hello World BPEL Example
yogesharora
do-not-reply at jboss.com
Thu Feb 21 05:36:04 EST 2008
Hi,
I have written a standalone java client to access the HelloWorld Sample example of JBPEL 1.1 GA.
Environment Details
=============
JDK - version 1.5
JBPM - version 3.1.4
JBPEL - version 1.1GA
JBoss - version 4.2.2 GA
I am getting the following error:
<<
at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:595)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at org.jboss.naming.client.java.javaURLContextFactory$EncContextProxy.invoke(javaURLContextFactory.java:129)
at $Proxy0.lookup(Unknown Source)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at org.jbpm.bpel.tutorial.hello.MyClient.doJNDILookup(MyClient.java:76)
at org.jbpm.bpel.tutorial.hello.MyClient.test(MyClient.java:35)
at org.jbpm.bpel.tutorial.hello.MyClient.main(MyClient.java:30)
>>
MyClient.java
=========
package org.jbpm.bpel.tutorial.hello;
import java.io.IOException;
import java.util.Hashtable;
import javax.naming.InitialContext;
import javax.xml.rpc.ServiceException;
import org.tempuri.hello.Greeter;
import org.tempuri.hello.HelloWorldService;
public class MyClient {
private HelloWorldService helloService;
public static final String JNDI_NAME = "java:comp/env/service/Hello";
/**
* To handle the get requests.
*
* @param HttpServletRequest -
* theRequest
* @param HttpServletResponse -
* theResponse
* @throws IOException
*/
public static void main(String[] args){
MyClient client = new MyClient();
client.test();
}
public void test(){
helloService = (HelloWorldService) doJNDILookup(JNDI_NAME);
if(helloService == null){
System.out.println("Service not found. Exiting.....");
return;
}
try {
Greeter greeter = helloService.getGreeterPort();
String greeting = greeter.sayHello("Yogesh");
System.out.println("<<<<< greeting >>>> " + greeting);
} catch (ServiceException se) {
System.out.println("ServiceException Thrown >>>" + se.getMessage());
se.printStackTrace();
}
catch(Exception e){
System.out.println("Exception Thrown >>>" + e.getMessage());
e.printStackTrace();
}
}
/**
*
* @param jndiName
* @return the Object
*/
public static Object doJNDILookup(String jndiName) {
Object object = null;
try {
Hashtable env = new Hashtable();
env.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
env.put("java.naming.factory.url.pkgs", "org.jboss.naming.client");
//env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
env.put("java.naming.provider.url", "jnp://localhost:1099");
env.put("j2ee.clientName","jbpmbpel-client");
InitialContext ctx = new InitialContext(env);
System.out.println(ctx.getEnvironment());
object = ctx.lookup(jndiName);
} catch (Exception e) {
e.printStackTrace();
}
return object;
}
}
Please help in finding the solution.
Thanks in advance.
Best Regards,
Yogesh
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4131022#4131022
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4131022
More information about the jboss-user
mailing list