Run standalone client

Hello,
I'm new to Weblogic. I wrote a client code used to test the session bean. May I ask how to run a standalone client code in Weblogic workshop?
Thanks in advance.

Hello,
You will be able to do it in WebLogic Workshop. You will need to place the EJB client jar in the server lib folder and create a java project which will contain your client code.
Please post all WebLogic Workshop related issue to the weblogic.developer.interest.workshop newsgroup at http://newsgroups.bea.com/bea/forum.jspa?forumID=2041
Cheers
Raj

Similar Messages

  • Issue when a standalone client invoke a method on an EJB

    I do a simple ejb (like SayHello sample) and i create a standalone client that call one method of this EJB.
    When i run the client i have the following error from the eclipse IDE (Error is thrown at lookup):
    Exception in thread "main" java.lang.AssertionError: java.lang.ClassNotFoundException: test.IHelloWorld
         at weblogic.ejb.container.internal.RemoteBusinessIntfGenerator.generateRemoteInterface(RemoteBusinessIntfGenerator.java:57)
         at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.readObject(RemoteBusinessIntfProxy.java:205)
         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:597)
         at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
         at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1849)
         at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
         at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
         at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
         at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
         at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:197)
         at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:564)
         at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:193)
         at weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:62)
         at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:240)
         at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:348)
         at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
         at weblogic.jndi.internal.ServerNamingNode_1030_WLStub.lookup(Unknown Source)
         at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:392)
         at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:380)
         at javax.naming.InitialContext.lookup(InitialContext.java:392)
         at client.MainHello.main(MainHello.java:21)
    Caused by: java.lang.ClassNotFoundException: test.IHelloWorld
         at weblogic.ejb.container.deployer.RemoteBizIntfClassLoader.getClassBytes(RemoteBizIntfClassLoader.java:151)
         at weblogic.ejb.container.deployer.RemoteBizIntfClassLoader.loadClass(RemoteBizIntfClassLoader.java:96)
         at weblogic.ejb.container.internal.RemoteBusinessIntfGenerator.generateRemoteInterface(RemoteBusinessIntfGenerator.java:54)
         ... 26 more
    The eclipse IDE is runwith the option -vm D:\bea\jdk160_05\bin\java
    In eclipse, i configure to use the same jdk.
    When i execute the client outside eclipse, all is ok....
    Do you have an idée ?
    This is the ejb code :
    package test;
    public interface IHelloWorld {
    public static final String JNDI_NAME = "HelloWorld";
    public String sayHello( String name);
    package test;
    import javax.ejb.Remote;
    import javax.ejb.Stateless;
    import javax.ejb.TransactionAttribute;
    import javax.ejb.TransactionAttributeType;
    import javax.ejb.TransactionManagement;
    import javax.ejb.TransactionManagementType;
    @TransactionManagement(TransactionManagementType.CONTAINER)
    @TransactionAttribute(TransactionAttributeType.REQUIRED)
    @Stateless( name="HelloWorld", mappedName= IHelloWorld.JNDI_NAME)
    @Remote( IHelloWorld.class)
    public class HelloWorld implements IHelloWorld
    public String sayHello (String name) {
    final String msg = "Hello " + name + ". The world is wonderfull...";
    System.out.println ( msg);
    return msg;
    This is the client code :
    package client;
    import java.util.Hashtable;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import test.IHelloWorld;
    public class MainHello {
    public static void main (String[] args) throws Exception
    Hashtable<String, String> properties = new Hashtable<String, String> ();
    properties.put (Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    properties.put (Context.PROVIDER_URL, "t3://localhost:7001");
    InitialContext ctx = new InitialContext( properties);
    IHelloWorld hello = (IHelloWorld)ctx.lookup ( "HelloWorld#test.IHelloWorld");
    String result = hello.sayHello ( "franck");
    System.out.println ( result);
    ctx.close ();
    As you can see it is very simple but doesn't work inside eclipse IDE...
    Edited by: user11281761 on 30 juin 2009 07:13

    Oracle software purchases come with a CSI number that allows customers to have people contact support for products they own. If you or the organization you are working with has not purchased the product or have other support arrangements with Oracle (some partners have this), then you probably will not be able to obtain the patch from Oracle.
    You might be able to try a newer release of the product with an OTN evaluation license, WebLogic Server is currently on version 10.3.3, so you are at least 3 releases behind at this point if you are using 10.3.0.

  • Getting error while running standalone Java application related to Workflow

    Hi,
    I am using the following code
    import oracle.bpel.services.workflow.client.IWorkflowServiceClient;
    import oracle.bpel.services.workflow.task.model.Task;
    import oracle.bpel.services.workflow.client.WorkflowServiceClientFactory;
    import oracle.bpel.services.workflow.verification.IWorkflowContext;
    import java.util.List;
    public class CompleteUserTask {
         public static void main(String[] args) throws Exception{
         System.out.println("Classpath: "+System.getProperty("java.class.path","."));
         String userId = "jcooper";
         String password = "welcome1";
         String taskId = "";
         IWorkflowServiceClient wfSvcClient = WorkflowServiceClientFactory.getWorkflowServiceClient(WorkflowServiceClientFactory.JAVA_CLIENT);
         IWorkflowContext wfCtx = wfSvcClient.getTaskQueryService().authenticate(userId,password,oracle.tip.pc.services.identity.config.ISConfiguration.getDefaultRealmName(),null);
         Task task = wfSvcClient.getTaskQueryService().getTaskDetailsById(wfCtx,taskId);
         List assigneeUsers = task.getSystemAttributes().getAssigneeUsers();
         List assigneeGroups = task.getSystemAttributes().getAssigneeGroups();
    if ((assigneeUsers != null && assigneeUsers.size() > 1)
    || (assigneeGroups != null && assigneeGroups.size() > 0))
         task = wfSvcClient.getTaskService().acquireTask(wfCtx, taskId);
         task = wfSvcClient.getTaskService().updateTaskOutcome(wfCtx, task, "Approve");
    I have added wf_client_config.xml, wf_config.xml,is_config.xml to the classpath. While executing this java code, i am getting the following error
    <XMLAuthenticationService::authenticateUser> XMLAuthenticationService:: call authenticate
    <PCException::<init>> User is not found.
    <PCException::<init>> User "jcooper" is not found in realm "jazn.com"
    <PCException::<init>> Check the error stack and fix the cause of the error. Contact oracle support if error is not fixable.
    <PCException::<init>> ORABPEL-10509
    <PCException::<init>>
    <PCException::<init>> User is not found.
    <PCException::<init>> User "jcooper" is not found in realm "jazn.com"
    <PCException::<init>> Check the error stack and fix the cause of the error. Contact oracle support if error is not fixable.
    Kindly help me out.
    Thanks,
    Gomathi

    Hi,
    I am not using OID. I am using only JAZN. I copied is_config.xml and wf_config.xml to classes folder where i am running standalone application and also i referred this to the classpath. Kindly do the needful.. I am struggling with this issue for past 3 days.
    Another thing is if i am giving the user name as "jcooper" it is throwing the error. If i give "oc4jadmin", then the issue resolved.
    kindly tell me what should i do inorder to login as jcooper instead of oc4jadmin
    Thanks,
    Gomathi
    Edited by: user647559 on Sep 15, 2008 4:37 AM

  • Jax-ws deployed in standalone client fails with nullpointerexception

    I have a project which has deployed successfully as a standalone client with deployed jar files wlfullclient.jar, etc. When I add the jax-ws functions that I require, the deployed client fails with a nullpointerexception that is generated from the constructor of the Service class. The project runs successfully within the JDeveloper 11.1.1.5 environment and on a weblogic 10.3 server platform, but fails when I deploy as a standalone client with the wlfullclient.jar. I'm using JDK 1.6.0_24. In testing, the error occurs when I replace the {WLHome}\server\lib\weblogic.jar entry in the classpath with the wlfullclient.jar.
    I tested from another angle by creating my jax-ws functions in a standalone deployment, and it works successfully communicates with the webservices. No additional entries on the classpath besides my deployed jar. I then added to my deployment a simple JMS context lookup:
    Hashtable ht = new Hashtable();
    ht.put(Context.INITIAL_CONTEXT_FACTORY, contextFactoryProvider);
    ht.put(Context.PROVIDER_URL, urlString);
    Context context = new InitialContext(ht);
    This test runs without error in the JDeveloper environment. As soon as I add the wlfullclient.jar in the standalone environment, I get the following exception:
    Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/xml/ws/spi/ProviderImpl
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:630)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:614)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:305)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:246)
    at javax.xml.ws.spi.FactoryFinder.safeLoadClass(FactoryFinder.java:150)
    at javax.xml.ws.spi.FactoryFinder.newInstance(FactoryFinder.java:30)
    at javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:90)
    at javax.xml.ws.spi.Provider.provider(Provider.java:83)
    at javax.xml.ws.Service.<init>(Service.java:56)
    Interestingly, there is a class com/sun/xml/internal/ws.spi/ProviderImpl in the {JAVA_HOME}/jre/lib/rt.jar file, and I suppose this is what is used by the jax-ws classes when the wlfullclient.jar is not present on the classpath.
    So, what is it that I am missing in how to get the jax-ws classes and the jms classes to work in the standalone deployment environment (outside of the JDeveloper environment).
    Edited by: user3653687 on Jan 9, 2012 1:38 PM
    Edited by: user3653687 on Jan 9, 2012 2:49 PM

    Here is how I solved this problem to execute the application from a jar file (using Oracle Fusion Middleware 11.1.1.5.0 distribution). The key seems to be to extract the contents of the wseeclient.zip file into the same directory as the wlfullclient.jar and ws.api_1.1.0.0.jar files and then ensure that these 2 jars are on the classpath.
    In JDeveloper, create a project that has the jms/jax-ws classes.
    Put the following text entries to form the classpath (along with other dependent jars, e.g. org.eclipse.persistence...) into a file which will be included in the manifest for the client jar. Be sure to separate entries with a space.
    lib/wlfullclient.jar lib/wseeclient.jar lib\ws.api_1.1.0.0.jar lib\org.eclipse.persistence_1.1.0.0_2-1.jar
    In the Edit Deployment Profile Properties, select Include Manifest File, specify the main class to execute, and Add the classpath file to be included in the manifest.
    Deploy the jar file.
    In a deployment area, create the directory that will contain all the classpath jars (e.g. ./lib).
    Within the directory ./lib, extract all files from wseeclient.zip (found in {weblogic home}/server/lib)
    Copy wlfullclient.jar into the directory ./lib from the {weblogic home}/server/lib
    Copy ws.api_1.1.0.0.jar into the directory ./lib from {oracle middleware home}modules
    Copy org.eclipse.persistence_1.1.0.0_2-1.jar (for jaxb support) itno the directory ./lib from {oracle middleware home}/modules
    Copy the deployed client jar to the deployment area and execute, e.g.:
    java -jar ClientTest.jar myArguments

  • How to create a JMS standalone client with SAS PE8.2 ?

    HI everyone,
    I use Creator2.1 and I want to write a JMS standalone client that communicate through JMS with a webapp built with Creator.
    My pb is that I dont know how to set up initialContext.
    Hashtable env=new Hashtable();
    env.put(Context.PROVIDER_URL, "mq://localhost:28676/jms");
    env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.enterprise.naming.SerialInitContextFactory");
    context = new InitialContext(env);
    factory = (TopicConnectionFactory) context.lookup(factoryName);
    For example this code doesnt work and I have the following exception when I try to run my client.
    29 sept. 2006 10:31:03 com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl <init>
    ATTENTION: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: localhost; port: 3700"
    org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
    at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2257)
    at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2278)
    at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:208)
    at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:221)
    at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:104)
    at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:152)
    at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:146)
    at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:286)
    at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
    at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69)
    at com.sun.enterprise.naming.SerialContext.narrowProvider(SerialContext.java:89)
    at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:128)
    at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:288)
    at javax.naming.InitialContext.lookup(InitialContext.java:351)
    at com.orange.clara.Main.main(Main.java:59)
    Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused: connect
    at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:336)
    at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:191)
    ... 12 more
    Caused by: java.net.ConnectException: Connection refused: connect
    at sun.nio.ch.Net.connect(Native Method)
    at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:464)
    at java.nio.channels.SocketChannel.open(SocketChannel.java:146)
    at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:320)
    ... 13 more
    Does anyone had already met this pb ?
    Regards
    R�gis

    Please refer to http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6377822, particularly the evaluation. Could your situation be the same too (i.e server ip address changing dynamically)? Also, which OS are you using and do you have any firewalls setup that prevents access to port 3700?

  • Classpath for JMS standalone client

    Hi,
    I observed some problem, when I try to start my JMS client application. If in classpath is oc4j.jar it works, but when I replace oc4j.jar with oc4jclient.jar doesn't
    I notice the message:
    Exception in thread "main" java.lang.NoClassDefFoundError: com/evermind/server/jms/EvermindXAConnectionFactory
    at com.evermind.server.jms.ConnectInfo.getPass(ConnectInfo.java:98)
    at com.evermind.server.jms.EvermindTopicConnectionFactory.createTopicCon
    nection(EvermindTopicConnectionFactory.java:83)
    at sapconnector.MaterialMoverClient.main(MaterialMoverClient.java:52)
    the line no. 52 exactly means:
    TopicConnection connection = factory.createTopicConnection();
    What the OC4J client jar (oc4jclient.jar) is not enough for starting JMS standalone client?
    regards
    Krzysztof

    Hi, thanks for the reply.
    Well, I figured out that problem. It was my jar file. One of the jar file, which is imqjmsra.jar wasn't really the right one and that was giving me the problem. Well, at least that is working not, but I am having new problems.
    Right, I have been trying to make this work for about three days now. The truth is that my standalone JMS does work, when it is running on the same machine where the J2EE Server is located, but I am trying to make my JMS standalone client to connect to J2EE server from different location. Now I am getting connection refused error. Well, I guess I will be keep trying util I get this working.

  • Getting Sun ONE Initial Context from standalone client

    Hi,
    I'm having problems connecting to Sun One's JNDI from a standalone client ... I've seen other topics raised with similar problems but with no real answers.
    I can connect to what i think is a different JNDI resource with:
    Hashtable env = new Hashtable();
    env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,           "com.sun.jndi.cosnaming.CNCtxFactory");
    env.put("java.naming.provider.url", "iiop://localhost:3700");
    jndiContext = new InitialContext(env);
    But this JNDI does not hold my JMS resources (connection factories, queues, etc) ??? Am i connecting to the wrong port??
    I've tried to look at the documentation but with no success.
    Any ideas?
    cheers,
    Chico.

    Where did you get port 58058 from?
    When trying to run:
    java -Dorg.omg.CORBA.ORBInitialHost=localhost -Dorg.omg.CORBA.ORBInitialPort=58058 SimpleJNDITest
    I got this exception:
    Exception in thread "main" javax.naming.CommunicationException: Cannot connect to ORB.
    Root exception is org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
    This is my JNDI Test source:
    import javax.jms.*;
    import javax.naming.*;
    import java.util.*;
    import org.omg.CORBA.ORB;
    public class SimpleJNDITest {
    public static void main(String[] args) throws Exception {
              SimpleJNDITest t = new SimpleJNDITest();
              t.runTest();
         public void runTest() throws Exception {
              //Invoking -> java -Dorg.omg.CORBA.ORBInitialHost=localhost -Dorg.omg.CORBA.ORBInitialPort=58058 SimpleJNDITest
              // Results in the exception
              // Exception in thread "main" javax.naming.CommunicationException: Cannot connect to ORB.
              // Root exception is org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
              Context jndiContext = new InitialContext();
    // -----> Alternative 1
              // This gets the JNDI Context, but the JNDI context does not hold JMS resources
              Hashtable env = new Hashtable();
         env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
         env.put("java.naming.provider.url", "iiop://localhost:3700");
              Context jndiContext = new InitialContext(env);
    // -----> Alternative 2
              // This gets the JNDI Context, but the JNDI context does not hold JMS resources
              String[] orbArgs = {"-ORBInitialPort", "3700", "-ORBInitialHost", "localhost"};
              ORB orb = ORB.init(orbArgs, null);
              Hashtable env = new Hashtable();
         env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
              env.put("java.naming.corba.orb", orb );
              Context jndiContext = new InitialContext(env);
    // -----> Alternative 3
              /* This gets the following exception:
              Exception in thread "main" javax.naming.CommunicationException: Cannot connect to ORB.
              Root exception is org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code:     201 completed: No
              String[] orbArgs = {"-ORBInitialPort", "58058", "-ORBInitialHost", "localhost"};
              ORB orb = ORB.init(orbArgs, null);
              Hashtable env = new Hashtable();
         env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
              env.put("java.naming.corba.orb", orb );
              Context jndiContext = new InitialContext(env);
              StringBuffer sb = new StringBuffer();
              list(jndiContext, sb);
              System.out.println(sb.toString());
         public void list(Context ctx,StringBuffer sb) {
              try {
                   NamingEnumeration enum = ctx.listBindings("");
                   while (enum.hasMore()) {
                        Binding binding = (Binding)enum.next();
                        Object obj = (Object)binding.getObject();
                        if (obj instanceof Context) {
                             sb.append("---> ");
                             sb.append(binding.getName());
                             sb.append(".");
                             list((Context)obj,sb);
                        } else {
                             sb.append(binding.getName()); sb.append("\n");
              } catch (NamingException e) {
                   System.out.println(e);
    Cheers,
    Chico

  • How can I deploy a simple stateless ssion EJB and call it from a standalone client

    Hi,
    I'm creating s simple staless session EJB that has a method that takes a name and prints "Hello" + name. This EJB is in a package called "com.demos.mydemo.ejbs.hello"
    How can I deploy this to OC4J?
    How can I call it from a standalone client(no JSP, no servlets)?
    In Sun's J2EE is very easy to deploy and I don't have to know any XML stuff.
    can I use the .ear file created by the Sun's "deploytool" to deploy my EJB to OC4J?
    This is the code at I'm using and it works on Sun's j2sdkee1.2.1:
    ///////// Remote /////////
    package com.demos.mydemo.ejbs.hello;
    import java.rmi.RemoteException;
    import javax.ejb.EJBObject;
    public interface Hello extends EJBObject {
    public String sayHello(String name) throws RemoteException;
    ///////// Home //////////
    package com.demos.mydemo.ejbs.hello;
    import java.rmi.RemoteException;
    import javax.ejb.EJBHome;
    import javax.ejb.CreateException;
    public interface HelloHome extends EJBHome {
    public Hello create() throws CreateException, RemoteException;
    /////////// Bean class ///////////
    package com.demos.mydemo.ejbs.hello;
    import java.rmi.RemoteException;
    import javax.ejb.SessionBean;
    import javax.ejb.SessionContext;
    import javax.ejb.CreateException;
    import javax.ejb.EJBException;
    import java.sql.Connection;
    import java.sql.SQLException;
    //import java.sql.PreparedStatement;
    import javax.sql.DataSource;
    import javax.naming.NamingException;
    import javax.naming.InitialContext;
    public class HelloEJB implements SessionBean {
    private SessionContext context;
    private Connection con;
    private String dbName =
    "java:comp/env/jdbc/Oracle";
    public HelloEJB() {}
    public void setSessionContext (SessionContext context) {
    this.context = context;
    public void ejbCreate() throws CreateException {
    try {
    makeConnection();
    catch (Exception e) {
    System.err.println("HelloEJB: exception in ejbCreate:" + e.getMessage());
    e.printStackTrace();
    throw new CreateException(e.getMessage());
    public void ejbActivate() {
    public void ejbPassivate() {
    public void ejbRemove() {
    try {
    con.close();
    catch (SQLException ex) {
    throw new EJBException("HelloEJB: exception in ejbRemove: " + ex.getMessage());
    public String sayHello(String name) {
    return "Hello " + name;;
    private void makeConnection() throws NamingException, SQLException {
    try {
    InitialContext ic = new InitialContext();
    DataSource ds = (DataSource) ic.lookup(dbName);
    con = ds.getConnection();
    catch (Exception e) {
    System.err.println("HelloEJB: exception in makeConnection:" + e.getMessage() );
    e.printStackTrace();
    //////////// EJB client that uses a stateless session bean
    package com.demos.mydemo.ejbs.hello;
    import java.io.*;
    import java.sql.*;
    import javax.sql.*;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.rmi.PortableRemoteObject;
    public class HelloClient {
    public static void main(String[] args) {
    try {
    Context initial = new InitialContext();
    Object objref = initial.lookup("HelloSession");
    HelloHome home = (HelloHome)PortableRemoteObject.narrow(objref,HelloHome.class);
    Hello h = home.create();
    String msg = h.sayHello("John Doe");
    System.out.println(msg);
    //h.remove();
    } catch (Exception ex) {
    System.err.println("Caught an exception." );
    ex.printStackTrace();
    Thanks
    Nabil
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Nabil Khalil ([email protected]):
    I deployed and .ear file created by Sun's J2EE deployment tool on the OC4J. It looks that it was deployed fine -- did not get a deployment error.
    When I run the client I'm getting the following error: Caught an exception.
    javax.naming.CommunicationException: Can't find SerialContextProvider
    at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:60)
    at com.sun.enterprise.naming.SerialContext.<init>(SerialContext.java:79)
    at com.sun.enterprise.naming.SerialInitContextFactory.getInitialContext(SerialInitContextFactory.java:54)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:668)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246)
    at javax.naming.InitialContext.init(InitialContext.java:222)
    at javax.naming.InitialContext.<init>(InitialContext.java:178)
    at com.equifax.fms.ejbs.hello.HelloClient.main(HelloClient.java:18)
    This makes me think that the client can't see the deployed EJB on the OC4J.
    How can I fix this problem?
    Thanks
    Nabil
    <HR></BLOCKQUOTE>
    Nabil -
    Your standalone client needs to obtain certain server-dependent properties. You can provide them in your code or grab them via a properties file.
    For Orion - you need essentially the following setup, filling in your own information...
    Define your standalone client class with "main" etc (this is orion specific - should work for 9i AS as well - perhaps there are some differences)
    public class SomeClass {
    try {
    Properties p = new Properties();
    p.setProperty("java.naming.factory.initial",
    "com.evermind.server.ApplicationClientInitialContextFactory");
    p.setProperty("java.naming.security.principal","server_admin_name");
    p.setProperty("java.naming.security.credentials","server_password");
    // THEN you can get your intitial context reference
    InitialContext initial = new InitialContext (p);...........
    Then go about your business.....
    A good book to get is called "Professional Java Server Programming J2EE Edition" - there happens to be a reasonable amount of Orion/OCJ4 centric information since one of the authors is Karl Avedal - one of the principals behind Orion. Go out to java.sun.com and look at some of the J2EE tutorials - unfortunately a lot of it is hidden behind the J2EE Deployer, but you will get a good sense of what goes into outside-the-container standalone clients.
    null

  • How can I set Response Queue for standalone client using JMS Jax-RPC ?

    Hi,
    I am developing a standalone client for a web service running on a Weblogic 10.3 server using JMS transport. The response seems to be placed in JMSServer!JMSServer.TemporaryQueue0 when I try to test the application.
    The request xml created:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <content>
        <entry type="1">
            <textMessage fromQueue="true" JMSTimestamp="1285343150328" JMSReplyToDomain="1" JMSReplyTo="JMSServer!JMSServer.TemporaryQueue1" JMSRedelivered="false" JMSPriority="4" JMSMessageID="ID:&lt;520181.1285343150328.0&gt;" JMSExpiration="0" JMSDestination="SystemModule!demoQueue" JMSDeliveryMode="2">
                <headerProperty type="java.lang.String" value="text/xml; charset=utf-8" name="_wls_mimehdrContent_Type"/>
                <headerProperty type="java.lang.String" value="&quot;http://oracle/communications/platform/demo/webservices/rpc/secure/gen/getPhoneList&quot;" name="_wls_mimehdrSOAPAction"/>
                <headerProperty type="java.lang.String" value="/DemoWebServices/DemoWebServicesJMS" name="URI"/>
                <text>&lt;env:Envelope xmlns:env=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;&lt;env:Header/&gt;&lt;env:Body&gt;&lt;gen:lastName xmlns:gen=&quot;http://oracle/communications/platform/demo/webservices/rpc/gen&quot;&gt;8&lt;/gen:lastName&gt;&lt;/env:Body&gt;&lt;/env:Envelope&gt;</text>
            </textMessage>
        </entry>
    </content>On the application server I have configured a Response Queue that I would like my application to use. The client stubs where generated using the ant Task: weblogic.wsee.tools.anttasks.ClientGenTask.
    Standalone client code snippet:
          DemoWebServices_Impl service = null;
          try {
              service = new DemoWebServices_Impl(wsdl);
          } catch (ServiceException e) {
              e.printStackTrace();
          DemoWebServicesPortType port = null;
          //create credential provider and set it to the Stub
          try {
              port = service.getDemoWebServicesJMSPort();
          } catch (ServiceException e) {
            e.printStackTrace();
          PhoneList response = null;
          try {
              response = port.getPhoneList("8");
          } catch (RemoteException e) {
              e.printStackTrace();
          if(response != null) {
            for(Phone aPhone : response.getPhone()) {
                System.out.println("aReturned Phone number is:  " + aPhone.getPhoneNumber());
          }Would you please help me with modifying the client code to define which Queue the web service response should be placed in? setQueue() of the JMSTransportInfo class did not do the trick. Please help....
    Thanks,
    Sajitha
    Edited by: Sajitha on Sep 24, 2010 12:29 PM
    Edited by: Sajitha on Sep 27, 2010 8:44 AM

    Hi,
    I am developing a standalone client for a web service running on a Weblogic 10.3 server using JMS transport. The response seems to be placed in JMSServer!JMSServer.TemporaryQueue0 when I try to test the application.
    The request xml created:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <content>
        <entry type="1">
            <textMessage fromQueue="true" JMSTimestamp="1285343150328" JMSReplyToDomain="1" JMSReplyTo="JMSServer!JMSServer.TemporaryQueue1" JMSRedelivered="false" JMSPriority="4" JMSMessageID="ID:&lt;520181.1285343150328.0&gt;" JMSExpiration="0" JMSDestination="SystemModule!demoQueue" JMSDeliveryMode="2">
                <headerProperty type="java.lang.String" value="text/xml; charset=utf-8" name="_wls_mimehdrContent_Type"/>
                <headerProperty type="java.lang.String" value="&quot;http://oracle/communications/platform/demo/webservices/rpc/secure/gen/getPhoneList&quot;" name="_wls_mimehdrSOAPAction"/>
                <headerProperty type="java.lang.String" value="/DemoWebServices/DemoWebServicesJMS" name="URI"/>
                <text>&lt;env:Envelope xmlns:env=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;&lt;env:Header/&gt;&lt;env:Body&gt;&lt;gen:lastName xmlns:gen=&quot;http://oracle/communications/platform/demo/webservices/rpc/gen&quot;&gt;8&lt;/gen:lastName&gt;&lt;/env:Body&gt;&lt;/env:Envelope&gt;</text>
            </textMessage>
        </entry>
    </content>On the application server I have configured a Response Queue that I would like my application to use. The client stubs where generated using the ant Task: weblogic.wsee.tools.anttasks.ClientGenTask.
    Standalone client code snippet:
          DemoWebServices_Impl service = null;
          try {
              service = new DemoWebServices_Impl(wsdl);
          } catch (ServiceException e) {
              e.printStackTrace();
          DemoWebServicesPortType port = null;
          //create credential provider and set it to the Stub
          try {
              port = service.getDemoWebServicesJMSPort();
          } catch (ServiceException e) {
            e.printStackTrace();
          PhoneList response = null;
          try {
              response = port.getPhoneList("8");
          } catch (RemoteException e) {
              e.printStackTrace();
          if(response != null) {
            for(Phone aPhone : response.getPhone()) {
                System.out.println("aReturned Phone number is:  " + aPhone.getPhoneNumber());
          }Would you please help me with modifying the client code to define which Queue the web service response should be placed in? setQueue() of the JMSTransportInfo class did not do the trick. Please help....
    Thanks,
    Sajitha
    Edited by: Sajitha on Sep 24, 2010 12:29 PM
    Edited by: Sajitha on Sep 27, 2010 8:44 AM

  • Running JMS client on multiple systems (using J2EE 1.4)

    Hello all,
    Can anyone tell me if it is possible to run a JMS client on a system that is not running a J2EE server on localhost? Is there any way to reference the server on another machine (using J2EE 1.4 server)??
    I found information in the J2EE 1.3.1 tutorial that tells of ways to
    - run the client program with both systems running the server
    - run the client program with only one system running the server (which isn't localhost)
    However, the corresponding portion of J2EE 1.4 tutorial only specifies running the client with App server running on both systems...... does this mean that we cannot run a standalone client program with no server on localhost in case of the 1.4 server?
    Also, most of the tutorials on JMS I have seen so far only explain the scenario with both the client and the server on a single machine. Is this how average JMS applications work?? What I mean to ask is, in a typical scenario where does a JMS client run....?? at the server, or at the client (which may or may not be running a server at localhost).
    Thanks for your time.

    The functionality has not changed in J2EE 1.4 outside of reving to JMS 1.1

  • How can I run EJB Client in other computer ?

    Hello,
    I'm trying to run converter examples.
    if ejb client pgm resides on a same machine with j2ee server , it works fine.
    But when I put client pgm on a different maching
    below message show.
    No application client descriptors defined for: ConverterClinet
    I put ConverterApp.ear, ConverterAppClient.jar and ConverterClient.class on the machine and
    set APPCPATH=ConverterAppClient.jar
    set VMARGS=-Dorg.omg.CORBA.ORBInitialHost=xxx.xxx.xx.xx
    What should I do to run ejb client on different machine?

    Hi SangHPark,
    I had the same problem but have solved it and it works.
    I ran the client remotely from a win98 box.
    Keep two things in mind
    1> Deploy the applications to an ip address and not to the local host using the deploy too. Use the deploy tool Gui to add a new server and then deploy the application to this ip address.
    2> I am running j2ee version 1.3 and jsdk 1.3
    Use the following code but instead of using "java:comp/env/ejb/SimpleConverter" use the jndi name of the object: "MyConverter" as specified in the tutorial.
    Properties prop = new Properties();
    prop.setProperty(Context.INITIAL_CONTEXT_FACTORY,"com.sun.enterprise.naming.SerialInitContextFactory");
    prop.setProperty(Context.PROVIDER_URL,"IIOP://xxx.xx.x.xxx:1050");
    System.out.println("Attempting to create context...");
    Context initial = new InitialContext(prop);
    // Instead of this use the below line of code
    //Object objref = initial.lookup("java:comp/env/ejb/SimpleConverter");
    Object objref = initial.lookup("MyConverter");
    // MyConverter is the Jndi name of the ConverterBean as per the tutorial
    You need to do the following things.
    1> After making changes to the code recompile using Ant and redeploy it.
    2> Copy the j2ee.jar, ConverterAppClient.jar and ConverterClient.class file to the machine that u want to run the client from.
    3> create a directory called "config" on the remote machine where you copied the files in step two.
    4> Copy to this directory the files ejb.properties and security.properties from your j2ee_home\config\ directory.
    For example you copied the files in step 2 on the remote machine in the c:\test directory. Create c:\test\config directory and copy the files from step 4 into this directory.
    5> Run the following command from the directory where u copied the client files
    java -Dorg.omg.CORBA.ORBInitialHost="host name" -classpath .\j2ee.jar;.;.\ConverterAppClient.jar ConverterClient
    Monal

  • How to run a client program in Session bean using weblogic 8.1

    Hi
    I am new to weblogic server 8.1. I sucessfully deployed session ejb Session Bean. I created sessionbean jar file and put it it classpath also.
    and also i created sessiobeanclient jar file, it included in class path.
    While running client program it throws exception like noclass def found exception
    plz tell me the right way to run the session ejb program.
    bye

    Hi,
    You have to follow the given steps before you are going to run the client program that invokes the session bean .
    1)set the Weblogic Environment using the tool setWLSEnv
    2)place the Session bean jar file in classpath
    3)run the client program
    Note:If the client has to execute on remote machine we need to copy client class,remote interface, home interface and other classes which are used as
    parameters and return types.
    Regards
    Anilkumar kari

  • Error in running worflow client

    Hi
    I have an java class which works as a workflow client. When i run the class i get the error as following:
    ORABPEL-10509
    User is not found.
    User "jcooper" is not found in realm "jazn.com"
    The java code i have is like below:
    IWorkflowServiceClient wfSvcClient = WorkflowServiceClientFactory.getWorkflowServiceClient(WorkflowServiceClientFactory.JAVA_CLIENT);
    System.out.println("Before getting the task query service");
    //Get the task query service
    ITaskQueryService querySvc = wfSvcClient.getTaskQueryService();
    System.out.println("Got the task query service -- "+querySvc);
    //Login as jstein
    IWorkflowContext ctx = querySvc.authenticate("jcooper",
    "welcome1",
    oracle.tip.pc.services.identity.config.ISConfiguration.getDefaultRealmName(), //Use default realm
    null);//Not logging in on behalf of another user
    //Set up list of columns to query
    List queryColumns = new ArrayList();
    queryColumns.add("TASKID");
    queryColumns.add("TASKNUMBER");
    queryColumns.add("TITLE");
    queryColumns.add("OUTCOME");
    //Create a predicate to query tasks that have a null outcome
    String outcome = null;
    Predicate predicate = new Predicate(TableConstants.WFTASK_OUTCOME_COLUMN,
    Predicate.OP_EQ,
    outcome);
    //Create an ordering to order tasks by task number
    Ordering ordering = new Ordering(TableConstants.WFTASK_TASKNUMBER_COLUMN
    ,true //Ascending order
    ,false //Nulls last
    //Query a list of tasks assigned to jstein
    List tasks = querySvc.queryTasks(ctx,
    queryColumns,
    null, //Do not query additional info
    ITaskQueryService.ASSIGNMENT_FILTER_MY,
    null, //No keywords
    null, //Only tasks with no outome set
    ordering, //Order by ascending task number
    0, //Do not page the query result
    0);
    //Get the task service
    ITaskService taskSvc = wfSvcClient.getTaskService();
    ArrayList retTasks = new ArrayList();
    //Loop over the tasks, outputting task information, and approving tasks
    for(int i = 0 ; i < tasks.size() ; i ++)
    Task task = (Task)tasks.get(i);
    int taskNumber = task.getSystemAttributes().getTaskNumber();
    String title = task.getTitle();
    String taskId = task.getSystemAttributes().getTaskId();
    retTasks.add(taskId);
    return retTasks;
    I have also added all the jars as per the following in the BPEL dev guide:
    http://iasdocs/iasdl/101310_final/integrate.1013/b28981/worklist.htm#CIHGEABG
    Could anyone tell me what the problem could be here?
    Thanks
    Deepika

    Are you running the client on the same server? i.e., the code is called from a JSP or a servlet on the same server?
    If not, you may use the REMOTE_CLIENT instead of the JAVA_CLIENT, in your call to WorkflowServiceClientFactory.getWorkflowServiceClient(). This forces the user information to be pickedup by the workflow service on the server.

  • Error while running EJB Client

    Hi All,
    I have just written a program in EJB for currency conversion. But while running the client , i am getting the following error:
    C:\Java Source Code\EJB>java CalculatorClient
    java.lang.NoSuchMethodError: loadClass0
    at com.sun.corba.ee.internal.util.JDKClassLoader.specialLoadClass(Native
    Method)
    at com.sun.corba.ee.internal.util.JDKClassLoader.loadClass(JDKClassLoade
    r.java:58)
    at com.sun.corba.ee.internal.util.JDKBridge.loadClassM(JDKBridge.java:18
    0)
    at com.sun.corba.ee.internal.util.JDKBridge.loadClass(JDKBridge.java:83)
    at com.sun.corba.ee.internal.javax.rmi.CORBA.Util.loadClass(Util.java:37
    8)
    at javax.rmi.CORBA.Util.loadClass(Unknown Source)
    at javax.rmi.PortableRemoteObject.createDelegateIfSpecified(Unknown Sour
    ce)
    at javax.rmi.PortableRemoteObject.<clinit>(Unknown Source)
    at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.jav
    a:57)
    etc........
    The files that have been created are in the same folder which are as follows:
    Calculator.java Calculator.class - Remote Interface
    CalculatorHome.java CalculatorHome.class - Home Interface
    CalculatorEJB.java CalculatorEJB.class - EJB class
    ejbClient.jar - Client Jar
    ejb.ear
    The version for J2EE is 1.2.1
    Version for Jdk is 1.4.2
    Operating System - WinXP
    Could somebody pls help?
    Cooljacks

    ... but you did deploy it to an application server, right?

  • Writing a Standalone Client for EJB 3.0 Bean For Weblogic 10

    Steps for Writing a Standalone Client
    Client Code
    package com.client;
    import java.util.Properties;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.rmi.PortableRemoteObject;
    import com.StatelessService;
    public class StatelessClient {
         public static void main(String [] args){
              Context ctx = null;
              try {
                   ctx = getInitialContext("t3://localhost:7001/protossbservice","weblogic","weblogic");
                   Object ref = ctx.lookup("StatelessService#"+StatelessService.class.getName());
                   StatelessService service = (StatelessService)PortableRemoteObject.narrow(ref,StatelessService.class);     
                   System.out.println("StatelessClient.getMessage() ++");
                   String  message = service.getMessage();
                   System.out.println("StatelessClient.getMessage --");
                        System.out.println("Message from Bean "+message);
         } catch (NamingException e) {
                   e.printStackTrace();
         private static Context getInitialContext(String url, String user, String password) throws NamingException {
            Properties h = new Properties();
            h.put(Context.INITIAL_CONTEXT_FACTORY,
                    "weblogic.jndi.WLInitialContextFactory");
            h.put(Context.PROVIDER_URL, url);
            h.put(Context.SECURITY_PRINCIPAL, user);
            h.put(Context.SECURITY_CREDENTIALS, password);
            return new InitialContext(h);
    Business Interface
    package com;
    public interface StatelessService {
         public String getMessage();
    Stateless Session Bean
    package com;
    import javax.annotation.PostConstruct;
    import javax.ejb.Remote;
    import javax.ejb.Stateless;
    * Test Stateless Session Bean
    @Stateless(mappedName="StatelessService")
    @Remote(StatelessService.class)
    public class StatelessServiceBean implements StatelessService {
         public String getMessage(){
              return "I am invoked";

    emekaco wrote:
    Hi,
    I am a trainee although with a good background in java.
    I'm urgently in need of a free ebook for EJB 3.0 with the latest version of Netbean. Pls, help me with one if you have. my email is [email protected]
    http://www.theserverside.com/tt/books/wiley/masteringEJB3/index.tss
    Here's a good free e-book but without Netbean. It covers everything you would need to know about EJBs.
    >
    Again, is container managed bean good for a big project?
    The question is too vague to be answered. It's a design decision that needs more details.

Maybe you are looking for

  • My icloud songs are no longer on my laptop and I do not see the icloud symbol anymore.Any thoughts?

    My icloud symbol is no longer on my laptop and my icloud songs are not on the laptop now.They are all on my desk computer however..Any thoughts?

  • Vision M 30GB stuck on recovery m

    My player is stuck on recovery mode. When I turn it on it comes up with "firmware problem" message for a second and went to recovery mode screen. It shows firmware v.6.0_0._.23 and clean up, format all and reload firmware. I tried all the selection a

  • Gradients and UIResource

    Can we put Gradient In UIResource (example: component background) when customizing L&F of Swing components or we're just limited on ColorUIResource for (r,g,b) colors?

  • Please Help "This accessory is not made to work with iPhone" iPod??

    Hiya i wondered if someone here can help me please. Today i went to play my ipod feature on my iPhone and it started playing on the iPhone speakers which i wanted, Then all of a sudden it stoped i checked it out and had an error message saying the fo

  • Body Background Not Showing in Browser

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns=" http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <titl