Server site stack on client site calling EJB's methods

Dear colleagues,
I have the following method on EJB site
public boolean testUncheckedException(String msg)
throws RemoteException
boolean result = true;
char ch = msg.charAt(1000);
return result;
and I have the following
try
{ returnValue = errorhandling_EJBTestRemoteObject.testUncheckedException("Force
Error");
catch(Exception e)
CFCErrorHandler.handle(e);
} return returnValue;
This throws an exception java.lang.StringIndexOutOfBoundsException: String index
out of range: 1000 that is wrapped to RemoteException as detail property.
My problem is that I am getting a server site stack back only on one machine (my
local PC with WebLogic 6.0 sp2). Any other machine around does not return the
stack back with the same software installed.
Any idea what could be the problem
Yevgeny

Dear colleagues,
I have the following method on EJB site
public boolean testUncheckedException(String msg)
throws RemoteException
boolean result = true;
char ch = msg.charAt(1000);
return result;
and I have the following
try
{ returnValue = errorhandling_EJBTestRemoteObject.testUncheckedException("Force
Error");
catch(Exception e)
CFCErrorHandler.handle(e);
} return returnValue;
This throws an exception java.lang.StringIndexOutOfBoundsException: String index
out of range: 1000 that is wrapped to RemoteException as detail property.
My problem is that I am getting a server site stack back only on one machine (my
local PC with WebLogic 6.0 sp2). Any other machine around does not return the
stack back with the same software installed.
Any idea what could be the problem
Yevgeny

Similar Messages

  • Calling ejb remote method

    SQLPLUS How to call ejb remote method in the sql plus.i am getting problem to intiallize the initial context.

    hi chidambaresh,
    you could have sent this to me directly.
    the Enumeration si an interface and so the object we get during the runtime is basically an object of some implementation of this interface.
    the Enumeration you get from HAshtable is actually Serializable.
    but the Enumeration you actually get from Vector (this is actaully an inner class of Vector viz., Vector$1) is not serializable. that is what the error you are getting.
    regards
    Srinivasan.R
    (VAMSOFT)

  • Got javax.transaction.HeuristicMixedException  when calling EJB business methods

              I have developed two EJBs. One is a stateless session bean,
              called InventorySessionBean(JNDI name: Inventory); the other one
              is a CMP Entity Bean called InventoryBean(JNDI name:
              InventoryBean). The InventoryBean represents the business object
              of Inventory. InventoryBean is declared CMT and all methods in
              the beans have attribute "Required". The InventorySessionBean is a session facade
              which encapsulate the business methods of
              InventoryBean. InventorySessionBean is declared CMT and all
              methods in the bean have attribute"RequiresNew" The backend
              database is Ingres.
              I have setup JDBC connection pool, Datasource and Tx Datasource.
              There is a client program which invokes InventorySessionBean to get business data
              from database.
              Actually the InventorySessionBean invokes InventoryBean entity bean to get data
              from database.
              After I starting up the weblogic server, I ran the client program to get data,
              everything works fine.
              After a period of time (about 50 minutes ) from starting the WLS server, I reran
              the client program.
              I got following exceptions:
              Exception while commiting Tx : Name=[EJB com.memec.na.mppl.businessobjects.inventory.InventorySessionBean.getPriceAndAvailability(java.lang.String,ja
              va.lang.String,java.lang.String,java.lang.String)],Xid=4:916d7da2142a593c(2094524),Status=Committed,HeuristicErrorCode=XA_HEURHAZ,numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds
              since begin=3,seconds left=119,ServerResourceInfo[weblogic.jdbc.jts.Connection]=(state=committed,assigned=leiWLS),SCInfo
              [leiwang+leiWLS]=(state=committed),properties=({weblogic.transaction.name=[EJBcom.memec.na.mppl.businessobjects.inventory.InventorySessionBean.getPriceAndAvailability(java.lang.String,java.lang.String,java.lang.String,java.lang.String)],
              weblogic.jdbc=t3://10.1.129.124:7001}),OwnerTransactionManage
              r=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=leiWLS+10.1.129.124:7001+leiwang+,
              Resources={})],CoordinatorURL=leiWLS+10.1.129.124:7001+leiwa
              ng+); nested exception is:
              javax.transaction.HeuristicMixedException: (weblogic.jdbc.jts.Connection,
              HeuristicHazard, (javax.transaction.xa.XAException: Error dequeueing
              message for statement connection # 23 type S))
              java.rmi.RemoteException: Exception while commiting Tx : Name=[EJB com.memec.na.mppl.businessobjects.inventory.InventorySessionBean.getPriceAndAvailab
              ility(java.lang.String,java.lang.String,java.lang.String,java.lang.String)],Xid=4:916d7da2142a593c(2094524),Status=Committed,HeuristicErrorCode=XA_HEU
              RHAZ,numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=3,seconds left=119,ServerResourceInfo[weblogic.jdbc.jts.Connection]=(state=committe
              d,assigned=leiWLS),SCInfo[leiwang+leiWLS]=(state=committed),properties=({weblogic.transaction.name=[EJB
              com.memec.na.mppl.businessobjects.inventory.In
              ventorySessionBean.getPriceAndAvailability(java.lang.String,java.lang.String,java.lang.String,java.lang.String)],
              weblogic.jdbc=t3://10.1.129.124:7001
              }),OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=leiWLS+10.1.129.124:7001+leiwang+,
              Resources={})],CoordinatorURL=leiWL
              S+10.1.129.124:7001+leiwang+); nested exception is:
              javax.transaction.HeuristicMixedException: (weblogic.jdbc.jts.Connection,
              HeuristicHazard, (javax.transaction.xa.XAException: Error dequeueing
              message for statement connection # 23 type S))
              javax.transaction.HeuristicMixedException: (weblogic.jdbc.jts.Connection, HeuristicHazard,
              (javax.transaction.xa.XAException: Error dequeueing message
              for statement connection # 23 type S))
              at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:237)
              at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:190)
              at weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:231)
              at com.memec.na.mppl.businessobjects.inventory.InventorySessionBean_9wgxw_EOImpl.getPriceAndAvailability(InventorySessionBean_9wgxw_EOImpl.jav
              a:224)
              at com.memec.na.mppl.processors.Outbound3A2Processor.getData(Outbound3A2Processor.java:202)
              Stop the WLS server and restart it again. Everything works well.
              Any comments to this problem would be really appreciated. Thanks.
              

    Hi
    I was using the session bean.Your suggestion helped me a lot.Perfect.
    I debug my program and found that from ejbCreate()exception is getting.
    I was getting the datasource object thro ejb create() initialisation.
    Somehow the look up jndi which i mentioned was not interpretting from ejb-jar.xml ias-ejb-jar.xml and datasource ref .Due to this iam getting jndi Namenotfound exception which in turns to null pointer as datasource is getting null.
    when i hardcoded in the ejb the the jndi name for datasource it is working fine.Bit worried all the existing ejbs working with the xml referenced datasource and jndi,but when i added a new ejb with same properties it is failing to get the jndi name.
    Piece of code from ias-ejb-jar.xml
    <resource-ref>
              <res-ref-name>myDataSource</res-ref-name>
              <jndi-name>jdbc/nb/myData</jndi-name>
    </resource-ref>
    Piece of code from ejb-jar.xml
    <resource-ref>
              <res-ref-name>myDataSource</res-ref-name>
              <res-type>javax.sql.DataSource</res-type>
              <res-auth>Container</res-auth>
    </resource-ref>
    Thanks a lot meka

  • Azure Dedicated Role Cache does not fire notification to client when call DataCache.Clear method

    Hi,
    I'm using Azure Dedicated Role cache and  Enabled the local cache and notification.
    <localCache isEnabled="true" sync="NotificationBased" objectCount="20000" ttlValue="3600" />
    <clientNotification pollInterval="1" maxQueueLength="10000" />
    but when I call DataCache.Clear method in one client, the notification does not send to all clients, the client's local cached content still been used.
    is this a bug of Azure SDK 2.5?

    I assume that you have correctly configured and enabled Cache notifications, instead of using the DataCache's clear method - have you tried clearing all regions in your cache because I am not sure if DataCache.Clear triggers the cache notification or not.
    so your code should look something like this
    foreach (string regionName in cache.GetSystemRegions())
    cache.ClearRegion(regionName)
    You can refer the link which explains about Triggering Cache Notifications  https://msdn.microsoft.com/en-us/library/ee808091(v=azure.10).aspx
    Bhushan | Blog |
    LinkedIn | Twitter

  • Getting error while calling ejb business methods from servlet

    Hi
    Iam getting error when i try to call a ejb method from servlet.Error is
    "com.netscape.server.eb.UncheckedException: unchecked exception nested exception is:java.lang.NullPointerException".
    I build the application and deployed it successfully.Iam using IAS 6.O with windows NT 4.0.
    This is just a method which takes values from database and return as an array of bean to servlet.
    Any help on this.Thanks Shank

    Hi
    I was using the session bean.Your suggestion helped me a lot.Perfect.
    I debug my program and found that from ejbCreate()exception is getting.
    I was getting the datasource object thro ejb create() initialisation.
    Somehow the look up jndi which i mentioned was not interpretting from ejb-jar.xml ias-ejb-jar.xml and datasource ref .Due to this iam getting jndi Namenotfound exception which in turns to null pointer as datasource is getting null.
    when i hardcoded in the ejb the the jndi name for datasource it is working fine.Bit worried all the existing ejbs working with the xml referenced datasource and jndi,but when i added a new ejb with same properties it is failing to get the jndi name.
    Piece of code from ias-ejb-jar.xml
    <resource-ref>
              <res-ref-name>myDataSource</res-ref-name>
              <jndi-name>jdbc/nb/myData</jndi-name>
    </resource-ref>
    Piece of code from ejb-jar.xml
    <resource-ref>
              <res-ref-name>myDataSource</res-ref-name>
              <res-type>javax.sql.DataSource</res-type>
              <res-auth>Container</res-auth>
    </resource-ref>
    Thanks a lot meka

  • Tuxedo calling EJB in pub/sub model

    Hello Everyone,
    I have a tuxedo application which works on pub/sub architecture. I have an eLink
    adapter which publishes the data from the database and an another adapater which
    has subscribed for it. So once this gets the data(tuxedo server-c program) how
    does this call EJB(java)in my WLE Domain 5.1v . does JOLT/JET help in such scenarios?
    Just wondering JOLT enabling of the server (the server which subscribes for the
    data) helps here!
    Please help. It's urgent.
    with regds
    siva

    Hi,
    we have exactly the same problem!! We also use FP14
    Please help!
    Greetings
    Thomas

  • TimeoutException - when calling web services method that opens a PDF

    I am updating a legacy program which uses Adobe Acrobat 7.0 Professional.  The idea is that the client will call web service methods, which handle opening a PDF, reading from or writing to the PDF, saving if necessary, and closing.  It then returns the data (if reading) to the client.
    The only issue with this that I'm having is that the client will pause for about 60 seconds, and throw a TimeoutException.
    I know that the method on the web services end is working, because I wrote a quick driver which calls the very same method, but it executes normally, and works perfectly.
    My question is basically, is there anything that would cause the client to hang/freeze when calling the web services method to do this task? Everything is running on my workstation, and I've debugged to see that the filename being passed is the same in both tests.
    Thanks!

    Thank you, I somehow missed seeing that subforum. I reposted it in that forum instead. This thread can be deleted/closed. Thanks!

  • HANA Server site JavaScript how to call functions in another .js file? thanks

    In HANA Studio, I have created a .js file and a server site javaScript .xsjs file. The .js file and .xsjs file are in the same path .I create function F1() in js file. Then I want to call function F1 in xsjs file. But it always through an error “f1 was used before it was defined”. Any suggestion? Thanks very much
    .js file:
    .xsjs file:

    Hi Jim,
    Now I have found the method how to use external library. If we want to outsource some of xsjs functions to an external library, XSEngine provides a special format for this, called “.xsjslib”. Then in xsjslib file, we define functions need to be outsourced.
    In .xsjs file, we can import a library using the following code:
    $.import("<Package_Library_was_deployed>","xsjslib File Name");
    The Package_Library_was_deployed please refer to:
    Access functions inside library by this path:
    $.Package_Library_was_deployed.xsjsFileName.FunctionName();

  • How to set the granted permission in RMI SERVER site

    Hi everyone,
    I have developin some simple RMi program but the error message is keep on prompting out and I cant really test out what is the result. I understand I got to GRANT the permission for the RMI but I I dun really know where should I start first. I know there are code that can be implement in the sErver site, just hope some one can guide me out.
    Thank lot...
    here is the code for server:
    import java.rmi.*;
    import java.rmi.server.UnicastRemoteObject;
    public class myRMIServer
    public static void main(String[] argv)
    System.setSecurityManager(new RMISecurityManager());
    try
    myRMIImpl implementation = new myRMIImpl("myRMIImplInstance");
    catch (Exception e)
    System.out.println("Exception occurred: " + e);
    Where should i code the getProperties and setProperties code...

    so, what u mean is the problem occur doesnt related to coding part ?? do you think it is because I did not start the rmiRegistry, but somehow when i started the rmiRegistry, the console window is blank an it is nothing in the window. pls pls help me to solve this problem... sound easy initially but end up it is not...
    by the way, here is the code
    Interface
    public interface myRMIInterface extends java.rmi.Remote
    public java.util.Date getDate() throws java.rmi.RemoteException;
    Interface Implementation
    import java.rmi.*;
    import java.rmi.server.UnicastRemoteObject;
    public class myRMIImpl extends UnicastRemoteObject implements myRMIInterface
    public myRMIImpl(String name) throws RemoteException
    super();
    try
    Naming.rebind(name, this);
    catch(Exception e)
    System.out.println("Exception occurred: " + e);
    public java.util.Date getDate()
    return new java.util.Date();
    server
    import java.rmi.*;
    import java.rmi.Naming;
    import java.rmi.RMISecurityManager;
    import java.rmi.server.UnicastRemoteObject;
    import java.rmi.registry.LocateRegistry;
    import java.util.Properties;
    public class myRMIServer
    public static void main(String[] argv)
    //System.setProperty("java.security.policy","C:\\workspace\\MyRMI\\java.policy");           
    //System.getProperty("java.security.policy","C:\\workspace\\MyRMI\\java.policy");
         //myRMIServer m = System.getProperties();
         //m.setProperty("java.security.policy","C:\\workspace\\MyRMI\\java.policy");
         //System.setSecurityManager(new RMISecurityManager());
    //Properties p = System.getProperties();
    //p.setProperty("java.security.policy","C:\\workspace\\MyRMI\\java.policy");
    try
    myRMIImpl implementation = new myRMIImpl("myRMIImplInstance");
    Properties p = System.getProperties();
         System.setProperty("java.security.policy","C:\\workspace\\MyRMI\\java.policy.txt");
         System.setProperty("java.rmi.server.codebase","file:///P:\\Projects\\RMIServer\\bin");
         if (System.getSecurityManager() == null) {
         System.setSecurityManager(new RMISecurityManager());
         System.out.println("Security manager registered");
         //System.out.println("Service registered");
    catch (Exception e)
    System.out.println("Exception occurred: " + e);
    here is the code, to run, I got a client one as well, but is just for displat purpose..
    thank you, guys....really appreciate ur help

  • Calling EJB from other EJB on other J2EE Server

    Can I call EJB from other EJB on other J2EE Server
    Servers - Websphere 5.0
    Do i require home & remote interface of that ejb on client side also
    Help me, please

    the problem is actually i require that is specific to websphere
    for example i want to call a method ion that ejb
    say my ejb name is myejb
    so the normal way i should call is
    InitialContext initialContext = new InitialContext();     
    Object homeObject = initialContext.lookup("ejb/MyEjbHome");
    MyEJBHome myEJBHome =(MYEjbHome )javax.rmi.PortableRemoteObject.narrow(homeObjectMYEjbHome.class);
              myEJB = lSHome.create();
    myEJB.someMethod();
    but here i am having class for home and remote available
    now if other app server i am not having this classes then what to do

  • DFS server / SIte and Services

    Hi Guys,
    A knowledge question about DFS server Windows 2008 R2.
    I have four data center on each Europe location, and I will install DFS server also on the location to attach the data on the nearly site location. My domain level is Windows 2008.
    Example:
    Site A: 192.168.1.x
    Site B: 192.178.1.x
    Site C: 192.188.1.x
    Site D: 192.198.1.x
    I have already setup a DFS server on Site A and its working, with example IP number: 192.168.1.100, now I will setup a new DFS server for Site B, C and D. with using Full mesh replication.
    When I setup a new server on site B example with IP number: 192.178.1.100 and ready to use. But if the user logon from Site B, the user have to use DFS server from site B and not from Site A site. (to get his data from server site A) If the DFS server from
    site B is down the user will get his Data from Site A. She have always use Site B, how can I build this way on each location.
    I heard that I have to crate a Site for this option and other information what I get is use costs options. ( and do I need a domain controller on each site)
    Can somebody advice how to build and the best practice DFS server on multiple locations with one or more DFS server on location.
    Kind regards,
    Hakan
    Good luck everyone.

    Hi Hakan,
    Actually it is not a DFS related question - It is AD related.
    As you said you need to create sites for your different subnets and setup site link cost. Detailed steps please refer to:
    Create a site
    http://technet.microsoft.com/en-us/library/cc728152(v=ws.10).aspx
    Configure site link cost
    http://technet.microsoft.com/en-us/library/cc784142(v=ws.10).aspx
    By Default DFS will provide an in-site target to clients. If no in-site target is available, it will provide an out-site target according to site link cost. 
    If you have any feedback on our support, please send to [email protected]

  • Client calling EJB + No object bound eror

    Hi,
    I am a newbie to oc4j. I have tried to get a client to call a stateless ejb using a bat file outside the server, with no luck. I get NamingException: No object bound for java:comp/env/EmployeeBean when doing a jndi lookup. I have read the doc's, tried the answers in the forum and I even used the example code provided from oracle, but I still get the same error message every time.
    Has anyone come across this issue when calling an ejb from a client??
    Any help would be greatly appreciated. It’s driving me crazy.
    Thanks
    David

    Hi,
    I will check out the link, thank you. I am a newbie to java and oracle, so any help would be great. i wasnt sure which bits of code would be really helpfull, so i just put most of it in, sorry if it is too much info.
    i am using oracle9ias release 1.0.2.2a (i dont know if this would make any difference). I deploy all my ears using the enterprise manager. The client-jar is within the ear. i use a bat to run the Client code.
    I can get a servlet to call the same ejbs and that works fine.
    #batfile
    ========
    i set the classpath which including refernces to oc4j.jar and oc4jclient.jar and my ejb-jar
    and then i use
    set BigD=-Dorg.omg.CORBA.ORBInitialHost=localhost -Duser.timezone=ECT
    java.exe %BigD% -classpath "%classpath%" com.test.client.Client
    //Client Code
    =============
    public class Client {
         public static void main(String[] args) {
              System.out.println("Client started again...");
              try {
                   Context context = new InitialContext();
                   System.out.println("got context");
                   Object homeObject = context.lookup("java:comp/env/ejb/ConsumerRequestSession");
                   ConsumerRequestSessionHome home = (ConsumerRequestSessionHome) PortableRemoteObject.narrow(homeObject, ConsumerRequestSessionHome.class);
                   System.out.println("got home");
                   ConsumerRequestSession remote = (ConsumerRequestSession) PortableRemoteObject.narrow(home.create(), ConsumerRequestSession.class);
                   System.out.println("got remote");
                   String retValue = remote.getString();
                   System.out.println("The retValue from client is : " + retValue);
              }catch(Exception e) {
                   e.printStackTrace();
                   System.out.println("ERROR in try block of client when creating jndi :" + e.getMessage());
    #jndi
    ====
    java.naming.factory.initial=com.evermind.server.ApplicationClientInitialContextFactory
    java.naming.provider.url=ormi://localhost/test
    java.naming.security.principal=admin     
    java.naming.security.credentials=welcome
    #application-client.xml
    =======================
    <application-client>
    <display-name>ejb/ConsumerRequestSession</display-name>
         <ejb-ref>
              <ejb-ref-name>ejb/ConsumerRequestSession</ejb-ref-name>
              <ejb-ref-type>Session</ejb-ref-type>
              <home>com.test.ejb.ConsumerRequestSessionHome</home>
              <remote>com.test.ejb.ConsumerRequestSession</remote>
         </ejb-ref>
    <!--          <display-name>EmployeeBean</display-name>
         <ejb-ref>
              <ejb-ref-name>EmployeeBean</ejb-ref-name>
              <ejb-ref-type>Session</ejb-ref-type>
              <home>employee.EmployeeHome</home>
              <remote>employee.Employee</remote>
         </ejb-ref>
         -->
    </application-client>
    #orion-application-client.xml
    =============================
    <orion-application-client>
         <ejb-ref-mapping location="com/test/ejb/ConsumerRequestSession" name="ejb/ConsumerRequestSession"/>
         <!--<ejb-ref-mapping name="EmployeeBean" location="employee/EmployeeBean" />
              <ejb-ref-mapping name="EmployeeBean" location="employee/EmployeeBean" />-->
    </orion-application-client>
    #ejb-jar.xml
    <ejb-jar>
         <enterprise-beans>
              <session>
                   <ejb-name>ejb/ConsumerRequestSession</ejb-name>
                   <home>com.test.ejb.ConsumerRequestSessionHome</home>
                   <remote>com.test.ejb.ConsumerRequestSession</remote>
                   <ejb-class>com.test.ejb.ConsumerRequestSessionEJB</ejb-class>
                   <session-type>Stateless</session-type>
                   <transaction-type>Container</transaction-type>
              </session>
         </enterprise-beans>
         <assembly-descriptor>
              <container-transaction>
                   <method>
                        <ejb-name>ejb/ConsumerRequestSession</ejb-name>
                        <method-name>*</method-name>
                   </method>
                   <trans-attribute>Required</trans-attribute>
              </container-transaction>
         </assembly-descriptor>
    </ejb-jar>
    #orion-ejb-jar.xml
    ==================
    <orion-ejb-jar>
         <enterprise-beans>
              <session-deployment location="com/test/ejb/ConsumerRequestSession" name="ejb/ConsumerRequestSession"/>
         </enterprise-beans>
         <assembly-descriptor>
              <default-method-access>
                   <security-role-mapping name="<default-ejb-caller-role>" impliesAll="true"/>
              </default-method-access>
         </assembly-descriptor>     
    </orion-ejb-jar>
    thank you for your help
    david.

  • Calling EJB from from a client app

    Hi all,
    I am trying to call an EJB component from portal. The example EJB I have taken is from SDN Bonus Calculator example - Application Server/Web Dynpro/Samples and Tutorials/Using EJBs (20)
    I deployed the EAR file - no issue
    I wrote the following code in a client app and trying to connect to the EJB remotely.
              try {
                   java.util.Properties properties = new Properties();
                   properties.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");
                   properties.put(Context.PROVIDER_URL, "ux0800:55304");
                   InitialContext ctx = new InitialContext(properties);
                   //InitialContext ctx = new InitialContext();
                   // get ejb home
                   home =
                        (BonusCalculatorLocalHome) ctx.lookup(
                             "localejbs/MySessionBean");
                   theCalculator = home.create();
              } catch (Exception namingException) {
                   namingException.printStackTrace();
    I get the following error
    javax.naming.NoInitialContextException: Cannot instantiate class: com.sap.engine.services.jndi.InitialContextFactoryImpl [Root exception is java.lang.ClassNotFoundException: com.sap.engine.services.jndi.InitialContextFactoryImpl]
         at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
         at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
         at javax.naming.InitialContext.init(Unknown Source)
         at javax.naming.InitialContext.<init>(Unknown Source)
         at com.sap.bonus.calculation.sessionBean.MyCommandBean.<init>(MyCommandBean.java:27)
         at com.sap.bonus.calculation.sessionBean.MyCommandBean.main(MyCommandBean.java:68)
    Caused by: java.lang.ClassNotFoundException: com.sap.engine.services.jndi.InitialContextFactoryImpl
         at java.net.URLClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClassInternal(Unknown Source)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Unknown Source)
         at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
    Any clue will be appreciated.
    thnx

    Hi Sabbir,
    Following code works for me in calling EJB from normal java application. Did you added the jar files to your application?. see the required jar files in end of code.
    Create simple java applcation do the following steps:
    Give JNDI name to the EJB(HelloJNDI)->Add the HelloEJB to HelloEAR ->deploy
    Proxy Program to call ejb:
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import com.sample.Hello;
    import com.sample.HelloHome;
    public class HelloTest {
         public static void main(String[] args) {
                       Hello remote = null;
                      try {
                        Context ctx = new InitialContext();
                        HelloHome home = (HelloHome) ctx.lookup("HelloJNDI");
                        remote = home.create();
                        String result = remote.hello();
                        System.out.print("Result:" + result);
                         } catch (Exception e) {
                                System.out.println("Exception:" + e.getLocalizedMessage());
    1. Go To  Run > Java Application ->New->select your project and select your main class(java program from which your going to call EJB)
    2. Click  next tab ->(x)=Arguments
    paste the following code in VM Arguments
    -Djava.naming.factory.initial=com.sap.engine.services.jndi.InitialContextFactoryImpl -Djava.naming.provider.url=localhost:50104
    replace the server IP address with your server IP address where your ejbs are running.
    Under Class path settings for the program put the following jar files.
    You can search for them from net weaver soruce folders
    or copy from D:\usr\sap\J2E\JC01\j2ee\j2eeclient
    ejb20.jar
    logging.jar
    exception.jar
    sapj2eeclient.jar
    Add Corresponding ejb.jar
    and RUN >>>
    this makes testing of your client programs easier, you can find the error trace on which line and saves lot of time.
    Regards, Suresh

  • Calling EJB from app client

    Hello, everybody,
    I'm very new at EJB and I'm trying to learn it.
    I have created Enterprise Application using Netbeans IDE, I have EJB and APP client. What I want is to connect to my MySql database and get some info from table.
    For e.g. Login and Password.
    How can I call EJB from my client app which connects to my database and gets information I need?

    What server you are using?
    if you use jboss AS ,here is a simple Main class how to connect EJB and access ejb methods:
    package com.david.ejb.client;
    import java.util.Properties;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.rmi.PortableRemoteObject;
    import com.david.ejb.domain.Person;
    import com.david.ejb.domain.PersonRemote;
    public class Main {
         public static void main(String[] args) {
              try {
                   Context ctx = getInitialContext();
                   Object obj = ctx.lookup("PersonSessionRemote/remote");
                PersonRemote pr=(PersonRemote)PortableRemoteObject.narrow(obj, PersonRemote.class);
                Person p=new Person();
                p.setName("david");
                pr.addPerson(p);
                pr.findPerson(1);
                   // System.out.print(br.find(pk).getAuthor_name());
              } catch (Exception ex) {
                   ex.printStackTrace();
         private static Context getInitialContext() throws NamingException {
              Properties p = new Properties();
              p.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.NamingContextFactory");
              p.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
              p.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");
              return new InitialContext(p);
    }Person is ant @Entity and PersonRemote is remote interfaces, to connect database you have to make datasource file at jboss-4.2.3.GA\server\default\deploy
    simle mysql-ds.xml looks like this:
    datasources>
       <local-tx-datasource>
          <jndi-name>some name</jndi-name>
          <connection-url>jdbc:mysql://localhost:3306/dbname</connection-url>
          <driver-class>com.mysql.jdbc.Driver</driver-class>
          <user-name>root</user-name>
          <password>root password</password>
          <min-pool-size>5</min-pool-size>
          <max-pool-size>100</max-pool-size>
          <idle-timeout-minutes>15</idle-timeout-minutes>
          <exception-sorter-class-name>com.mysql.jdbc.integration.jboss.ExtendedMysqlExceptionSorter</exception-sorter-class-name>
          <valid-connection-checker-class-name>com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker</valid-connection-checker-class-name>
       </local-tx-datasource>
    </datasources>also at resources/META-INF directory you must have persistence.xml like this
    <persistence>
         <persistence-unit name="SimpleEjb">
              <jta-data-source>java:/some name</jta-data-source>
              <properties>
                   <property name="hibernate.hbm2ddl.auto" value="update" />
                   <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
                   <property name="hibernate.show_sql" value="true"/>
                   <property name="hibernate.format_sql" value="true"/>
              </properties>
         </persistence-unit>
    </persistence>

  • Trouble with deploying a standlone Java app/client that calls an EJB

    Hey guys,
    I am well aware that there are many topics that are quite similar to this topic that I am posting but the fact of the matter is I have failed to procure a satisfactory answer.
    So a bit of background about the environment I am using. I am using Netbeans 5.5 development build, today's version, JDK 6 Build 77, and Sun Application Server 8.2 to create, run and learn J2EE 1.4 based apps following the Sun J2EE 1.4 tutorial pdf and the Netbeans 4.1 tutorial pdf which I realize is a bit outdated but it gets the job done for the most part.
    I have satisfactorily created and built the Converter application as described in the above mentioned tutorial pdfs. For memory refreshment purposes, it is the simple session bean example where it is stateless and remote and has 2 business methods:
    dollarToYen(BigDecimal dollar)
    yenToEuro(BigDecimal yen)So I have this EJB being called, for learning purposes, by both a JSP and a Servlet as well as a standalone Java client. Now since the development machine is where I am deploying and running the enterprise application, everything works without a hitch. Once I have the Application server up and running I am able to access and execute the EJB's methods through JSP and Servlet even from remote machines on my home LAN. I realize that since the JSP and Servlet are in the same application context as that of the EJB I am not requiring the client jar which is where my confusion starts coming in. I know I need the client jar when I try to run the standalone java client from a different machine because it simply cannot access the EJB I have written.
    Now I found this link below and I read it and sorta understand it. I also found that under C:\AppServer\domains\domain1\applications\j2eeapps\ConverterApp I see a file called ConverterAppClient.jar. Is this the so called client jar? If so how do I go about using it?
    Before I end my rather long post, let me detail the steps I used to create the standlone Java client. I selected java application in the new menu of Netbeans and gave it the name ConverterClient and the IDE then proceeded to create a main class for me with a main method where I stuck in the following code:
    try
                Context c = new InitialContext();
                Object remote = c.lookup("ejb/ConverterBean");
                ConverterRemoteHome rv = (ConverterRemoteHome) PortableRemoteObject.narrow(remote, ConverterRemoteHome.class);
                ConverterRemote converter = rv.create();
                BigDecimal param = new BigDecimal(100);
                System.out.println(param + " Dollars are  " + converter.dollarToYen(param) + " Yen.");
                System.out.println(param + " Yen are " + converter.yenToEuro(param) + " Euro.");
            catch (RemoteException ex)
                ex.printStackTrace();
            catch (ClassCastException ex)
                ex.printStackTrace();
            catch (NamingException ex)
                ex.printStackTrace();
            catch (CreateException ex)
                ex.printStackTrace();
        }and that code works when I call it from the same machine that the Application Server is running with the EJB deployed. I also added in the classpath of the client application, the j2ee.jar and the other appserv-rt.jar as well. Have I missed anything?
    I even tried using the deploytool but to no avail as all it generated for me was the same jar file that I found underneath the Application server application directory as I mentioned earlier.
    If anyone is willing to help me, I will upload my Netbeans project files and all you have to do is open it through Netbeans 5.5 to recreate the exact scenario I am talking about.
    Thanks in advance. I apologize for the rather long post but I thought it would be best to provide as much details as was possible.
    Cheers,
    Surya

    hI,
    Pls, I'm happy to know u r using application server. I have just started reading enterprise bean.
    But I could not set the path and some other configurations for it to start working.
    Pls, I would be most grateful, if u could put me through on how to configure application server.
    Right now, I'm in the state of dilemma due to the insufficient knowledge in it.
    My email is [email protected]
    Remain blessed

Maybe you are looking for

  • ERROR at DAC Execution Step

    Hello all, I am running HR-R11.5.10 - FLexfield Execution Plan. When I run this execution plan, I get this error Connected to Integration Service: [EDW_INT]. Starting workflow [SDE_ORA_Flx_EBSSegDataTmpLoad] ERROR: Workflow [SDE_ORA11510_Adaptor:SDE_

  • Problem with coloring rows

    hi there, how can i get a single row in my jtable colored? i tried out some solutions that were postet here, but they do not work for me. my problem is, that all rows get the new color although i defined it only for one row. i post some code for bett

  • Open event for RAW files from Bridge

    I installed the "Open As Layer.jsx" to promote the background into a layer and rename that layer to the file name. This is working perfect when I open the file via file menu from PS. If I use a double-click from the Bridge it works only for JPEG's an

  • Resize online redolog files, make RMAN obsolute backups as usable

    Dear Guru's, I have following doubts, please clarify me on the same. thanks in advance 1. why can not we resize online redolog files instead of re-creating the same with large size and remove the older onces. 2. How can we make RMAN obsolute backups

  • Filter filetype file extension for file upload

    How do I configure KM to disallow uploading of certain filetypes, for instance, .exe or .bmp? Thanks