Unable to compile EJB client program

Hi, I developed a simple client program to an entity bean and I am not able to compile. Following are the few lines picked up from the code: (all my ejb,home and remote classes are under "test" package)
import test.*;
import java.util.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
public class TestClient {
public static void main(String[] args) {
try {
Context initial = new InitialContext();
Object objRef = initial.lookup("MyTestBean");
TestHome home = (TestHome) PortableRemoteObject.narrow(objRef, TestHome.class);
... etc.
I am getting the following compilation error
TestClient.java:13: inconvertible types found : java.lang.Object required: TestHome
TestHome home = (TestHome) PortableRemoteObject.narrow(objRef, TestHome.cl
ass);
The classpath is set to j2ee.jar and the local working directory in which the package "test" resides.
Any help in this matter is greatly appreciated.
Thanks.

Greetings,
Hi there,
Did pengjuc's answer help you to solve this problem?
I'd be really interested to know if it did.Unlikely, since the error reported is not with the object reference but with the specified class type. Additionally, this approach is not recommended since it assumes the underlying protocol is always (RMI-)IIOP and not vendor specific - portability is lost.
Thanks
Amanda
Developer Technical Support
Sun Microsystems
http://www.sun.com/developers
Regards,
Tony "Vee Schade" Cook

Similar Messages

  • Error in Executing EJB Client Program

    Hai
    I am Kranthi kumar,encountered an error message when trying to compile the client program.It said NO NAMING.CONTEXT IN NAMING DIRECTORY. But when i was looking up for that naming directory i could not find that.Please let me know where i can find the Context and Initial Context class files in the weblogic.I am working on Weblogic 5.1.Please solve my problem.
    Thanking you
    S.kranthi kumar

    Use this method,
      public Context getInitialContext() throws Exception {
        Properties p = new Properties();
        String url = "t3://206.251.112.49:7001"
        p.put(Context.INITIAL_CONTEXT_FACTORY,
              "weblogic.jndi.WLInitialContextFactory");
        p.put(Context.PROVIDER_URL, url);
        return new InitialContext(p);
    }and
    try {
         Context ctx = getInitialContext();
        Your_Ejb_Home home = (Your_Ejb_Home) ctx.lookup("your_ejb_home_binding_name");
    } catch(Exception e){
         //Handle exception
    }Hope this helps.
    Sudha

  • The server deploy EJB but I run EJB Client program,The error msg is can't find JNDI

    Hi all:
    I am using Weblogic 6.1/SP2. I use the console to start
    server and deploy EJB jar,from the msg I see my EJB jar
    been deployed. When I run EJB Client program, the error
    msg is can't find JNDI name t3://URL:11003.....
    I check my ejb-jar.xml amd weblogic-ejb-jar.xml are fine.
    Last week I did deploy EJB and ran the client both
    suceessful. Any ideas, Thank you.

    Sabha:
    Thank you for your help info, I soloved the problem.
    The problem is the ejb jar was deleted(I don't why)
    then System Admin to deploy EJB jar from Admin console.
    After that everything is fine.
    "Sabha" <[email protected]> wrote:
    Run weblogic.Admin -url ... LIST to see whether the JNDI name is there
    . or
    you can view the jndi tree of the server from the console (right click
    on
    server name) and check whether the ejb home is bound to the correct jndi
    name.
    -Sabha
    "Matthew Shinn" <[email protected]> wrote in message
    news:[email protected]..
    Hi Albert,
    I would double check to make sure the EJB was indeed deployed (check
    server log). What message did you see that leads you to believe itwas
    successfully deployed? Also, verify the JNDI name you are lookingup in
    your client matches the JNDI name for the EJB. If this doesn't solve
    the problem, please post the error message and stack trace you are
    seeing on the client.
    - Matt
    Albert Pi wrote:
    Hi all:
    I am using Weblogic 6.1/SP2. I use the console to start
    server and deploy EJB jar,from the msg I see my EJB jar
    been deployed. When I run EJB Client program, the error
    msg is can't find JNDI name t3://URL:11003.....
    I check my ejb-jar.xml amd weblogic-ejb-jar.xml are fine.
    Last week I did deploy EJB and ran the client both
    suceessful. Any ideas, Thank you.

  • Error in EJB client program (javax.naming.NoInitialContextException)

    Hi folks ,
    I'm new to j2ee programming and using Netbeans 5.5 , i created a session bean program and deployed successfully in JOnAS application server but i'm not able to run the client program which invokes session bean (EJB module ).
    when i run client program i'm getting the following error .
    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
            at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
            at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
            at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:284)
            at javax.naming.InitialContext.lookup(InitialContext.java:351)
            at SimpleSessionClient.Main.main(Main.java:33)
    BUILD SUCCESSFUL (total time: 21 seconds)
    but the same program runnig perfectly when i deploy in Java System Application Server(8.2(JSAS))
    I included j2ee.jar and appserv-rt jar in classpath of client program for JSAS i don't know what are the jar files (which does the same function as j2ee.ar,appserv-rt.jar ) which is to be included for JOnAS .
    i'm struggling with this for the past two weeks . please tell me the solution .
    Thanks in advance

    Thanks for the suggestion artntek.
    I located the jndi.properties file in the %J2EE_HOME%\lib\classes folder, and I copied it to the %J2EE_HOME%\bin directory, but nothing seems to have changed.
    does anyone know what value should be associated with Context.INITIAL_CONTEXT_FACTORY in the properties for the InitialContext object? More specifically, what value should be used for the reference install of the 1.3 j2ee release from sun?
    This error suggests to me that a class name must be specified for the initial naming context factory - but I don't know what to use.

  • How to run Session ejb client program?

    Hi
    I am using weblogic server8.1 . I was running an ejb session client program it throws exception like below. Can any one tell me how to run a client in weblogic server. give the syntax for running ejb client.
    D:\Weblogicserver\user_projects\domains\mydomain\applications\MyEJB\stateful>jav
    a -cp .;c:\j2ee\j2ee.jar;c:\weblogic\classes;D:\Weblogicserver\weblogic81\server
    \lib\weblogic.jar PortfolioClient
    Exception in thread "main" java.lang.NoClassDefFoundError: PortfolioClient (wron
    g name: stateful/PortfolioClient)
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
    3)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
    bye

    If stateful is the package for the client application, you should be executing from
    D:\Weblogicserver\user_projects\domains\mydomain\applications\MyEJB
    on the command line. The command should look like -
    java -classpath <whatever should be here> stateful.MyClient

  • Unable to Compile EJB Sample

    Environment: Windows NT4, sp5, WLS 5.1/sp 2, Sun JDK1.2.2
    As illustrated in 'Introduction to BEA Weblogic Server', pp 101-102, I'm
    compiling the Emp EJB sample. I successfully compiled the java programs,
    moved the XML files, and created the initial JAR file. Next the sample says
    to run ejbc on the JAR file. When I do I get the following error:
    G:\weblogic\examples\intro\ejbtemp>java -Dweblogic.home=%WL_HOME%
    weblogic.ejbc Emp.jar -d %WL_HOME%\myserver\Emp.jar
    java.lang.ClassCastException
    at
    weblogic.xml.dom.DOMUtils.getOptionalElementsByTagName(DOMUtils.java,
    Compiled Code)
    at
    weblogic.xml.dom.DOMUtils.getOptionalElementByTagName(DOMUtils.java:170)
    at
    weblogic.xml.dom.DOMUtils.getOptionalValueByTagName(DOMUtils.java:97)
    at
    weblogic.ejb.deployment.dd.EJBReadDOM.getDescriptionValue(EJBReadDOM.java:40
    4)
    at
    weblogic.ejb.deployment.dd.DescriptorLoader.createDeploymentUnit(DescriptorL
    oader.java:200)
    at weblogic.ejbc.runBody(ejbc.java, Compiled Code)
    at weblogic.utils.compiler.Tool.run(Tool.java:80)
    at weblogic.ejbc.main(ejbc.java:353)
    ERROR: java.lang.ClassCastException
    Any idea what may be causing this?

    try to use the build script in the examples directory..
    It is available for all examples.
    so after running setenv
    go the example u want and run the build.cmd
    it should work
    Steve Vago wrote:
    Environment: Windows NT4, sp5, WLS 5.1/sp 2, Sun JDK1.2.2
    As illustrated in 'Introduction to BEA Weblogic Server', pp 101-102, I'm
    compiling the Emp EJB sample. I successfully compiled the java programs,
    moved the XML files, and created the initial JAR file. Next the sample says
    to run ejbc on the JAR file. When I do I get the following error:
    G:\weblogic\examples\intro\ejbtemp>java -Dweblogic.home=%WL_HOME%
    weblogic.ejbc Emp.jar -d %WL_HOME%\myserver\Emp.jar
    java.lang.ClassCastException
    at
    weblogic.xml.dom.DOMUtils.getOptionalElementsByTagName(DOMUtils.java,
    Compiled Code)
    at
    weblogic.xml.dom.DOMUtils.getOptionalElementByTagName(DOMUtils.java:170)
    at
    weblogic.xml.dom.DOMUtils.getOptionalValueByTagName(DOMUtils.java:97)
    at
    weblogic.ejb.deployment.dd.EJBReadDOM.getDescriptionValue(EJBReadDOM.java:40
    4)
    at
    weblogic.ejb.deployment.dd.DescriptorLoader.createDeploymentUnit(DescriptorL
    oader.java:200)
    at weblogic.ejbc.runBody(ejbc.java, Compiled Code)
    at weblogic.utils.compiler.Tool.run(Tool.java:80)
    at weblogic.ejbc.main(ejbc.java:353)
    ERROR: java.lang.ClassCastException
    Any idea what may be causing this?

  • To Create a EJB Client program to access the Bean deployed in the Sun app

    Hi
    I am new to the EJB.I need to write a Client ,to access the bean deployed in the Sun application Server 9.0. The Client Program will be running in a Different machine on the Network.
    1)What all things i need to consider along with writing the client program?
    2)Is there any link which provides the Sample client programs/Documents for the Sun Application Server.
    Please help me
    Regards
    Raju

    Probably the simplest way is to replace the MessageServerThread with a synchronized method. The method should be in the MessageServer class.

  • Prob  in running ejb client program...pls help ...i am struggling with this

    I tried run the sample program in Headfirst - (Advice). I was able to generate the class file after the successful compilation, but failed in running the AdviceClient.
    The command given is
    java -classpath %CLASSPATH%;AdviceAppClient.jar AdviceClient
    I am getting NoClassFound Exception. Below is the full error message:
    C:\EJBDEMO\projects\advice>java -classpath %CLASSPATH%;AdviceAppClient.jar AdviceClient
    Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/corba/se/internal/util/JDKBridge at com.sun.corba.ee.internal.core.IOR$LocalCodeBaseSingletonHolder.<clinit>(IOR.java:90)
    at com.sun.corba.ee.internal.core.IOR.<init>(IOR.java:238) at com.sun.corba.ee.internal.iiop.messages.LocateReplyMessage_1_2.read(LocateReplyMessage_1_2.java:137)
    at com.sun.corba.ee.internal.iiop.IIOPInputStream.unmarshalHeader(IIOPInputStream.java:126)
    at com.sun.corba.ee.internal.iiop.IIOPConnection.getResponse(IIOPConnection.java:671)
    at com.sun.corba.ee.internal.iiop.IIOPConnection.send(IIOPConnection.java:778)
    at com.sun.corba.ee.internal.corba.InitialNamingClient.locateObject(Init
    ialNamingClient.java:786)
    at com.sun.corba.ee.internal.corba.InitialNamingClient.getIORUsingHostIn
    fo(InitialNamingClient.java:597)
    at com.sun.corba.ee.internal.corba.InitialNamingClient.resolveCorbaloc(InitialNamingClient.java:573)
    at com.sun.corba.ee.internal.corba.InitialNamingClient.resolveUsingORBInitRef(InitialNamingClient.java:544)
    at com.sun.corba.ee.internal.corba.InitialNamingClient.cachedInitialReferences(InitialNamingClient.java:1080)
    at com.sun.corba.ee.internal.corba.InitialNamingClient.resolve_initial_references(InitialNamingClient.java:981)
    at com.sun.corba.ee.internal.corba.ORB.resolve_initial_references(ORB.java:2425)
    at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:52)
    at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:120)
    at javax.naming.InitialContext.lookup(InitialContext.java:351)
    at AdviceClient.go(adviceclient.java:18)
    at AdviceClient.main(adviceclient.java:11)
    I tried all the solutions given for similar problems in the following sites:
    http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=70&t=003865
    http://saloon.javarhttp://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=70&t=004116anch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=70&t=001032
    http://wickedlysmart.com/HeadFirst/HeadFirstEJB/HeadFirstEJBNotes.html
    Still I couldn't solve the problem. My settings are
    Classpath-C:\jdk1.3.1\bin;C:\jdk1.3.1\lib;c:\j2sdkee1.3.1\lib\j2ee.jar;.;C:\j2sdkee1.3.1\lib;C:\j2sdkee1.3.1\lib\system;C:\j2sdkee1.3.1\lib\cloudscape
    J2EE_HOME-C:\j2sdkee1.3.1
    Java_Home-C:\jdk1.3.1
    PATH-C:\j2sdkee1.3.1\bin
    Please help me to resolve this problem. Its killing my sleep for long days....
    Thanks
    Priya

    See Priya, instead of running simple program of EJB, u can run the programs of J2EE 1.4 that is already given with the software. And help is also given in the documentation. It is easier. Just run one program and then implement ur ideas for any program in any server.
    Deployment and all help is given yaar there. u just see it.
    Thanks.

  • Unable to compile my java program in TextPad or Eclipse

    Hello - Finals are next week and I have one last assignment due....and my harddrive crashed last week. I reinstalled everything and set environment variables. When I open my program in TextPad and press ctrl-1 to compile nothing happens. Nothing happens with ctrl-2 (to run) either.
    In eclipse, I open the files and try to run the java file with the main method but I get "Selection does not contain a main type" error! I don't know what to do and I am at a standstill and I failed finding helpful information on my own.
    Please help!
    import java.util.Scanner;
    import java.io.*;
    import java.util.ArrayList;
    public class BookPrinter {
         public static void main(String args)
              try
                   FileReader reader = new FileReader("input.txt");
                   Scanner in = new Scanner(reader);
                   String inputFile = "";
                   while(in.hasNext())
                        inputFile.concat(in.nextLine());
                   Book b = new Book(inputFile);
                   System.out.println("The book's size is: " + b.bookSize());
                   System.out.println("\nThe number of times \"the\" occurs in the book: " + b.count("the"));
                   System.out.println("\nThe longest word in the book: " + b.longest());
                   ArrayList<String> longList = b.allLongest();
                   System.out.println("\nThe words that are all the longest length: ");
                   while(longList.size() > 0)
                        for(String e: longList)
                             System.out.println(e);
              catch(FileNotFoundException exception)
                   System.out.println("Error processing file: " + exception);
    }

    This:
    public static void main(String args)is wrong.
    You want this:
    public static void main(String[] args)Understand the difference?

  • Solaris Studio 12.4 Beta unable to compile simple C++ program

    The commands and output are shown below
    cat test.cpp; /opt/oracle/solaris_studio/bin/CC  -std=c++11 -o test test.cpp
    #include <random>
    int main () {}
    "/opt/oracle/solaris_studio/lib/compilers/CC-gcc/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include//ia32intrin.h", line 41: Error: The function "__builtin_ia32_bsrsi" must have a prototype.
    "/opt/oracle/solaris_studio/lib/compilers/CC-gcc/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include//ia32intrin.h", line 49: Error: The function "__builtin_bswap32" must have a prototype.
    "/opt/oracle/solaris_studio/lib/compilers/CC-gcc/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include//ia32intrin.h", line 89: Error: The function "__builtin_ia32_rdpmc" must have a prototype.
    "/opt/oracle/solaris_studio/lib/compilers/CC-gcc/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include//ia32intrin.h", line 97: Error: The function "__builtin_ia32_rdtsc" must have a prototype.
    "/opt/oracle/solaris_studio/lib/compilers/CC-gcc/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include//ia32intrin.h", line 105: Error: The function "__builtin_ia32_rdtscp" must have a prototype.
    "/opt/oracle/solaris_studio/lib/compilers/CC-gcc/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include//ia32intrin.h", line 113: Error: The function "__builtin_ia32_rolqi" must have a prototype.
    "/opt/oracle/solaris_studio/lib/compilers/CC-gcc/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include//ia32intrin.h", line 121: Error: The function "__builtin_ia32_rolhi" must have a prototype.
    "/opt/oracle/solaris_studio/lib/compilers/CC-gcc/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include//ia32intrin.h", line 137: Error: The function "__builtin_ia32_rorqi" must have a prototype.
    "/opt/oracle/solaris_studio/lib/compilers/CC-gcc/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include//ia32intrin.h", line 145: Error: The function "__builtin_ia32_rorhi" must have a prototype.
    "/opt/oracle/solaris_studio/lib/compilers/CC-gcc/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include//ia32intrin.h", line 161: Error: The function "__builtin_ia32_pause" must have a prototype.
    "/opt/oracle/solaris_studio/lib/compilers/CC-gcc/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include//ia32intrin.h", line 178: Error: The function "__builtin_ia32_bsrdi" must have a prototype.
    "/opt/oracle/solaris_studio/lib/compilers/CC-gcc/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include//ia32intrin.h", line 186: Error: The function "__builtin_bswap64" must have a prototype.
    "/opt/oracle/solaris_studio/lib/compilers/CC-gcc/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include//adxintrin.h", line 36: Error: The function "__builtin_ia32_addcarryx_u32" must have a prototype.
    "/opt/oracle/solaris_studio/lib/compilers/CC-gcc/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include//adxintrin.h", line 45: Error: The function "__builtin_ia32_addcarryx_u64" must have a prototype.
    14 Error(s) detected.
    I install the studio with the tarball file in CentOS 7. I know that officially it only support RHEL 5 & 6, but this is clearly not an OS issue

    This is a known bug in 12.4 Beta:
      18688928 C++11 <random> header includes x86intrin.h on Linux, leading to failures
    This problem is fixed in a final 12.4 release, which will be announced really soon.
    regards,
      Fedor.

  • How to run the client program in weblogic 8.1 server

    Hi
    I am new to EJB 2.0. I am deployed sucessfully a session ejb program.
    While running an ejb client program it throws an exception. In my session ejb program i created two jar file. one is sessionejb.jar and another one is sessionejbclient.jar. In sessionejb.jar contains home ,remote ,session bean class and deployment descriptor.In sessionejbclient.jar contains home,remote and client program. Both jar files are included in class path of environment variable( i am using Standalone server).
    Plese guide me how to run an session ejb client correctly.
    Regards
    Jaiganesh

    Both jar files are
    included in class path of environment variable( i am
    using Standalone server).did u include both these jars in the "weblogic's class path" ?
    in that case, it obviously wont work.
    what u need is an understanding of the following topics (i have described them briefly, but for details u can always check the documentation of weblogic):
    1. Class loaders in weblogic: there are various levels of class loaders. at the top is the weblogic's class loader. below it are various EARs' class-loaders. and so on....
    2. Packaging. You must ensure that in the same class loader, there are not two classes from 2 different jars.
    hope that helps

  • Multithreaded EJB Client

    Does any one know if it is valid to create multiple threads in a ejb client program that makes synchronous calls to the bean instance.

    if it is valid to create multiple
    threads in a ejb client program that makes synchronous
    calls to the bean instance.Depends of what you mean by 'ejb client'.
    If you mean a non-ejb class ( regular java class/servlet) making calls to an ejb bean, the answer would be yes, although I don't see why you should worry about sync-ing the calls, since the ejb container automatically handles that, i.e locks the bean for the time of the request.
    If you mean by 'ejb client' an ejb bean making calls to another ejb bean , then you're violating the specs, since it is the container who is supposed to have the monopole of handling threads, not the programmer.

  • Compilation errors when using Client program

    Hi all,
    I face a problem when compiling the client.
    Compilation errors:
    "Not able to resolve symbols HelloHome, Hello"
    At this line: HelloHome home = (HelloHome)ctx.lookup("HelloHome")
    I have cut and paste the client program below:
    Please look into it.
    Thanks
    Ranjan
    //Client for HelloBean
    import java.rmi.*;
    import javax.naming.*;
    import java.util.*;
    public class HelloClient {
    public static void main(String args[]) {
    try
    Hashtable ht = new Hashtable();
    ht.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    ht.put(Context.PROVIDER_URL,"t3://localhost:7001");
    InitialContext ctx = null;
    ctx = new InitialContext(ht);
    HelloHome home = (HelloHome)ctx.lookup("HelloHome");
    Hello hel = home.create();
    String retval = hel.sayHello("Ranjan");
    System.out.println("Returned: " + retval);
    hel.remove();
    catch (RemoteException e)
    System.out.println("RemoteException occured: " + e);
    catch (javax.ejb.CreateException e)
    System.out.println("Create Exception occured: " + e);
    catch (javax.ejb.RemoveException e)
    System.out.println("Remove Exception occured: " + e);
    catch(javax.naming.NamingException e)
    System.out.println("Naming Exception occured: " + e);
    **************************

    Hi,
    Yes the Hello and HelloHome classes are present in the same directory as the HelloClient.class
    Regards
    Ranjan

  • Unable to call exported client methods of EJB session bean remote interface

    I am unable to call client methods of a BC4J application module deployed as a Session EJB to Oracle 8i at the client side of my multi-tier application. There is no documentation, and I am unable to understand how I should do it.
    A business components project has been created. For instance, its application module is called BestdataModule. A few custom methods have been added to BestdataModuleImpl.java file, for instance:
    public void doNothingNoArgs() {
    public void doNothingOneArg(String astr) {
    public void setCertificate(String userName, String userPassword) {
    theCertificate = new Certificate(userName, userPassword);
    public String getPermission() {
    if (theCertificate != null)
    {if (theCertificate.getPermission())
    {return("Yes");
    else return("No, expired");
    else return("No, absent");
    theCertificate being a protected class variable and Certificate being a class, etc.
    The application module has been tested in the local mode, made remotable to be deployed as EJB session bean, methods to appear at the client side have been selected. The application module has been successfully deployed to Oracle 8.1.7 and tested in the remote mode. A custom library containing BestdataModuleEJBClient.jar and BestDataCommonEJB.jar has been created.
    Then I try to create a client basing on Example Oracle8i/EJB Client snippet:
    package bestclients;
    import java.lang.*;
    import java.sql.*;
    import java.util.*;
    import javax.naming.*;
    import oracle.aurora.jndi.sess_iiop.*;
    import oracle.jbo.*;
    import oracle.jbo.client.remote.ejb.*;
    import oracle.jbo.common.remote.*;
    import oracle.jbo.common.remote.ejb.*;
    import oracle.jdeveloper.html.*;
    import bestdata.client.ejb.*;
    import bestdata.common.ejb.*;
    import bestdata.common.*;
    import bestdata.client.ejb.BestdataModuleEJBClient;
    public class BestClients extends Object {
    static Hashtable env = new Hashtable(10);
    public static void main(String[] args) {
    String ejbUrl = "sess_iiop://localhost:2481:ORCL/test/TESTER/ejb/bestdata.BestdataModule";
    String username = "TESTER";
    String password = "TESTER";
    Hashtable environment = new Hashtable();
    environment.put(javax.naming.Context.URL_PKG_PREFIXES, "oracle.aurora.jndi");
    environment.put(Context.SECURITY_PRINCIPAL, username);
    environment.put(Context.SECURITY_CREDENTIALS, password);
    environment.put(Context.SECURITY_AUTHENTICATION, ServiceCtx.NON_SSL_LOGIN);
    BestdataModuleHome homeInterface = null;
    try {
    Context ic = new InitialContext(environment);
    homeInterface = (BestdataModuleHome)ic.lookup(ejbUrl);
    catch (ActivationException e) {
    System.out.println(e.getMessage());
    e.printStackTrace();
    System.exit(1);
    catch (CommunicationException e) {
    System.out.println(e.getMessage());
    e.printStackTrace();
    System.exit(1);
    catch (NamingException e) {
    System.out.println(e.getMessage());
    e.printStackTrace();
    System.exit(1);
    try {
    System.out.println("Creating a new EJB instance");
    RemoteBestdataModule remoteInterface = homeInterface.create();
    // Method calls go here!
    // e.g.
    // System.out.println(remoteInterface.foo());
    catch (Exception e) {
    System.out.println(e.getMessage());
    e.printStackTrace();
    It doesnt cause any errors. However, how must I call methods? The public interface RemoteBestdataModule has no such methods:
    void doNothingNoArgs();
    void doNothingOneArg(java.lang.String astr);
    void setCertificate(java.lang.String userName, java.lang.String userPassword);
    java.lang.String getPermission();
    Instead of that it has the following methods:
    oracle.jbo.common.remote.PiggybackReturn doNothingNoArgs(byte[] _pb) throws oracle.jbo.common.remote.ejb.RemoteJboException, java.rmi.RemoteException;
    oracle.jbo.common.remote.PiggybackReturn doNothingOneArg(byte[] _pb, java.lang.String astr) throws oracle.jbo.common.remote.ejb.RemoteJboException, java.rmi.RemoteException;
    oracle.jbo.common.remote.PiggybackReturn customQueryExec(byte[] _pb, java.lang.String aQuery) throws oracle.jbo.common.remote.ejb.RemoteJboException, java.rmi.RemoteException;
    oracle.jbo.common.remote.PiggybackReturn setCertificate(byte[] _pb, java.lang.String userName, java.lang.String userPassword) throws oracle.jbo.common.remote.ejb.RemoteJboException, java.rmi.RemoteException;
    oracle.jbo.common.remote.PiggybackReturn getPermission(byte[] _pb) throws oracle.jbo.common.remote.ejb.RemoteJboException, java.rmi.RemoteException;
    I cannot call those methods. I can see how they are called in BestdataModuleEJBClient.java file:
    public void doNothingNoArgs() throws oracle.jbo.JboException {
    try {
    oracle.jbo.common.remote.PiggybackReturn _pbRet = mRemoteAM.doNothingNoArgs(getPiggyback());
    processPiggyback(_pbRet.mPiggyback);
    if (_pbRet.isReturnStreamValid()) {
    return;
    catch (oracle.jbo.common.remote.ejb.RemoteJboException ex) {
    processRemoteJboException(ex);
    catch (java.rmi.RemoteException ex) {
    processRemoteJboException(ex);
    throw new oracle.jbo.JboException("Marshall error");
    However, I cannot call getPiggyback() function! It is a protected method, it is available to the class BestdataModuleEJBClient which extends EJBApplicationModuleImpl, but it is unavailable to my class BestClients which extends Object and is intended to extend oracle.jdeveloper.html.WebBeanImpl!
    It seems to me that I mustnt use RemoteBestdataModule interface directly. Instead of that I must use the public class BestdataModuleEJBClient that extends EJBApplicationModuleImpl and implements BestdataModule interface. It contains all methods required without additional arguments (see just above). However, how must I create an object of BestdataModuleEJBClient class? That is a puzzle. Besides my custom methods the class has only two methods:
    protected bestdata.common.ejb.RemoteBestdataModule mRemoteAM;
    /*This is the default constructor (do not remove)*/
    public BestdataModuleEJBClient(RemoteApplicationModule remoteAM) {
    super(remoteAM);
    mRemoteAM = (bestdata.common.ejb.RemoteBestdataModule)remoteAM;
    public bestdata.common.ejb.RemoteBestdataModule getRemoteBestdataModule() {
    return mRemoteAM;
    It looks like the remote application module must already exist! In despair I tried to put down something of the kind at the client side:
    RemoteBestdataModule remoteInterface = homeInterface.create();
    BestdataModuleEJBClient dm = new BestdataModuleEJBClient(remoteInterface);
    dm.doNothingNoArgs();
    Of course, it results in an error.
    System Output: null
    System Error: java.lang.NullPointerException
    System Error: oracle.jbo.common.PiggybackOutput oracle.jbo.client.remote.ApplicationModuleImpl.getPiggyForRemovedObjects(oracle.jbo.common.PiggybackOutput) (ApplicationModuleImpl.java:3017)
    System Error: byte[] oracle.jbo.client.remote.ApplicationModuleImpl.getPiggyfront(boolea
    System Error: n) (ApplicationModuleImpl.java:3059)
    System Error: byte[] oracle.jbo.client.remote.ApplicationModuleImpl.getPiggyback() (ApplicationModuleImpl.java:3195)
    System Error: void bestdata.client.ejb.BestdataModuleEJBClient.doNothingNoArgs() (BestdataModuleEJBClient.java:33)
    System Error: void bes
    System Error: tclients.BestClients.main(java.lang.String[]) (BestClients.java:76)
    I have studied a lot of documents in vain. I have found only various senseless discourses:
    "Use the Application Module Wizard to make the Application Module remotable and export the method. This will generate an interface for HrAppmodule (HrAppmodule.java in the Common package) which contains the signature for the exported method promoteAllEmps(). Then, deploy the Application Module. Once the Application Module has been deployed, you can use the promoteAllEmps() method in your client-side programs. Calls to the promoteAllEmps() method in client-side programs will result in calls to the promote() method in the application tier."
    However, I have failed to find a single line of code explaining how it should be called.
    Can anybody help me?
    Best regards,
    Svyatoslav Konovaltsev,
    [email protected]
    null

    Dear Steven,
    1. Thank you very much. It seems to me that the problem is solved.
    2. "I logged into Metalink but it wants me to put in both a tar number and a country name to see your issue." It was the United Kingdom, neither the US nor Russia if you mean my issue.
    I reproduce the text to be written by everyone who encounters the same problem:
    package bestclients;
    import java.util.Hashtable;
    import javax.naming.*;
    import oracle.jbo.*;
    public class BestdataHelper {
    public static ApplicationModule createEJB()
    throws ApplicationModuleCreateException {
    ApplicationModule applicationModule = null;
    try {
    Hashtable environment = new Hashtable(8);
    environment.put(Context.INITIAL_CONTEXT_FACTORY, JboContext.JBO_CONTEXT_FACTORY);
    environment.put(JboContext.DEPLOY_PLATFORM, JboContext.PLATFORM_EJB);
    environment.put(Context.SECURITY_PRINCIPAL, "TESTER");
    environment.put(Context.SECURITY_CREDENTIALS, "TESTER");
    environment.put(JboContext.HOST_NAME, "localhost");
    environment.put(JboContext.CONNECTION_PORT, new Integer("2481"));
    environment.put(JboContext.ORACLE_SID, "ORCL");
    environment.put(JboContext.APPLICATION_PATH, "/test/TESTER/ejb");
    Context ic = new InitialContext(environment);
    ApplicationModuleHome home = (ApplicationModuleHome)ic.lookup("bestdata.BestdataModule");
    applicationModule = home.create();
    applicationModule.getTransaction().connect("jdbc:oracle:kprb:@");
    applicationModule.setSyncMode(ApplicationModule.SYNC_IMMEDIATE);
    catch (NamingException namingException) {
    throw new ApplicationModuleCreateException(namingException);
    return applicationModule;
    package bestclients;
    import bestdata.common.*;
    import certificate.*;
    public class BestClients extends Object {
    public static void main(String[] args) {
    BestdataModule bestdataModule = (BestdataModule)BestdataHelper.createEJB();
    Certificate aCertificate = new Certificate("TESTER", "TESTER");
    //calling a custom method!!
    bestdataModule.passCertificate(aCertificate);
    Thank you very much,
    Best regards,
    Svyatoslav Konovaltsev.
    [email protected]
    null

  • Client program not compiling?

    Hi
    I am using Weblogic server 8.1 for EJB applications.
    I deployed simple session ejb program,i successfully deployed ,but client program not compiling it doesn't take home and remote interface.
    How to set classpath for client program,before compiling a client.
    for example i had client in this dir
    D:\ejb\
    ejbclient.jar
    client.java
    bye

    Hi,
    Before running the ejb client we need to follow the steps as given below.
    1)set the weblogic environment using the setWLSEnv
    2)set the classpath for ejb(home,remote and bean).
    3)run the client program
    Note:To set the classpath for the ejb
    set classpath=d:\ejb;.; %classpath%
    Regards
    Anilkumar kari

Maybe you are looking for

  • Month, QTD, YTD in prompts - Financial Reporting Studio

    Hi All, We developed a report (source: Essbase) using Financial Reporting Studio. We used a prompt for Period Dimension and used all the months in the choices list. We have a new requirement to pull QTD and YTD of the months to the prompt list. We ha

  • Designing a opensparc based system

    I am trying to build a opensparc system using the bsb of XPS 10.1. I am using the cores included in the design found in opensparc package download, namely iop_fpga ( opensparc T1 core) and ccx2mb. I matched all the connections and ports of my design

  • Since downloading and installing iOS 8...

    I downloaded and installed the iOS 8 update and now both my iPhone 5 and my iPad Air have become very sluggish.  Even when I am on my home wifi or when I'm on cellular data at LTE speed, it takes so much longer than usual to access apps such as Faceb

  • Subtype ctreation for the Infotype 0185

    Hi, I am trying to create a subtype for the standard infotype 0185. I have followed below mentioned steps for that: 1) I have created an entry using v_t591a in SM31 and saved it. 2) In PM01, created a Customer Include under Enhancement of Single Scre

  • PDP - no entry in eprtrans

    SRM SERVER 550 SP13 R3 4.7 Classic Reorder point planning. When MRP runs and generates requistions the eprtrans table is not updated with the req. The req does have a procurement profile assigned in the eban table. The req is not subject to release a