Tried to lookup an EJB (succ dply) got: javax.naming.NameNotFoundException

Hi
I use JDev Studio 10.1.3.40.66 and EJB 3.0 with annotations. I am working in the same Project (Model) with two stateless beans and some entities. In the same Project I have one test-client which implemented the lookup.
Here a snippet of the EJB:
@Stateless( name = "MyDao" )
public class MyDaoImpl implements IMyDao {
... }Here piece of code out of test-client:
final Context context = getInitialContext();
IMyDao iMyDao = (IMyDao)context.lookup("MyDao");Now everything worked fine and nobody changed anything in the project. So it may be that after a "power off" and a restart I couldn't find my EJBs with the lookup?!
Here is what I get from OC4J log:
07/04/02 10:32:09 FEIN: TxSecIORInterceptor.addCSIv2Components Unable to obtain mutual auth port
07/04/02 10:32:09 FEIN: TxSecIORInterceptor.addCSIv2Components UnknownType exceptioncom.sun.corba.ee.spi.legacy.interceptor.UnknownType
(Here is some more stack trace!)
FEIN: [current-workspace-app:Azima_AzimaModel_0] Initializing EntityManagerFactory named Azima-local with persistence provider oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.
07/04/02 10:32:13 WARNUNG: Application.setConfig Application: current-workspace-app is in failed state as initialization failed.
java.lang.LinkageError: loader constraints violated when linking javax/persistence/spi/PersistenceUnitInfo class
Checking that EJBs were successfully deployed in embedded OC4J...
All EJBs are successfully deployed.From my test-client log I get:
javax.naming.NameNotFoundException: MyDao not found
     at com.evermind.server.rmi.RMIClientContext.lookup(RMIClientContext.java:52)
     at javax.naming.InitialContext.lookup(InitialContext.java:351)
     at com.promatis.azima.model.test.Client.main(Client.java:390)
...So I couldn't test my EJB anymore. If you have some suggestions or if you need more information about my project just post...
I need some help with this problem!
Thanks

I work now more that two days on this error!!!
-> I remade my complete jdev project, it did not work!
-> I deleted the jdev/system/j2ee/oc4j/workspace dir
-> I search for some .lock files
-> and many more tries!!! But without success...
Is there a way to reset the Embedded OC4J?

Similar Messages

  • JNDI lookup from OC4J to weblogic throws javax.naming.NameNotFoundException

    Hi All,
    We have the below setup in our production environment.
    EJB application is deployed in the Weblogic 10.3.4.0 Server on Sun Solaris. The EJB version is 3.0
    OC4J 10.2.0 is running on another Sun Solaris machine.
    There are 2 webservice applications WEBSERV1 & TestSoapEJB running on this OC4J container.
    We need to do lookup the EJBs deployed on the Weblogic server. For this we used the below logic in the web service's Stateless session bean:
    String weblogicURL = "";
    Properties props = new Properties();
    try
    props.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("wl.properties"));
    weblogicURL     = props.getProperty("weblogicURL");     
    catch (FileNotFoundException e)
    e.printStackTrace();
    catch (IOException e)
    e.printStackTrace();
    Context ctx = null;
    Hashtable ht = new Hashtable();
    ht.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    ht.put(Context.SECURITY_PRINCIPAL,"weblogic");
    ht.put(Context.SECURITY_CREDENTIALS,"weblogic654");
    ht.put(Context.PROVIDER_URL, weblogicURL);
    ctx = NamingManager.getInitialContext(ht) ;
    // tried using //ctx = new InitialContext(ht); same behavior.
    TestEJB.AdministratorEJB ejb = (TestEJB.AdministratorEJB) ctx.lookup("TestEJB#TestEJB.AdministratorEJB");
    ctx.close();
    When we first test first WEBSER1, the lookup is fine.
    But when we test the second webservice WEBSER2, the webservice name itself not able to lookup: It gives the below error:
    javax.naming.NameNotFoundException: remaining name: env/TestSoapEJB
    Below is the stack throws thrown on browser:
    500 Internal Server Error
    javax.naming.NameNotFoundException: remaining name: env/TestSoapEJB     
    at weblogic.j2eeclient.SimpleContext.resolve(SimpleContext.java:35)     
    at weblogic.j2eeclient.SimpleContext.resolve(SimpleContext.java:39)     
    at weblogic.j2eeclient.SimpleContext.lookup(SimpleContext.java:59)     
    at weblogic.j2eeclient.SimpleContext.lookup(SimpleContext.java:59)     
    at weblogic.j2eeclient.SimpleContext.lookup(SimpleContext.java:64)     
    at weblogic.jndi.factories.java.ReadOnlyContextWrapper.lookup(ReadOnlyContextWrapper.java:45)     
    at weblogic.jndi.internal.AbstractURLContext.lookup(AbstractURLContext.java:130)     
    at javax.naming.InitialContext.lookup(InitialContext.java:392)     
    at oracle.j2ee.ws.SessionBeanRpcWebService.init(SessionBeanRpcWebService.java:65)     
    at javax.servlet.GenericServlet.init(GenericServlet.java:258)     
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpApplication.loadServlet(HttpApplication.java:2354)     
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpApplication.findServlet(HttpApplication.java:4795)     
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpApplication.getRequestDispatcher(HttpApplication.java:2821)     
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:680)     
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:285)     
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:126)     
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)     
    at java.lang.Thread.run(Thread.java:662)
    It seems that, the OC4J is looking in Weblogic context. But it should be looking in its own context. How to resolve this issue.
    The same case happens if i restart the OC4J and first test the TestSoapEJB the lookup is fine . But if i test the WEBSERV1 , it throws the same error as above. In short, if one of the webservices lookup is working fine, the other webservice is not working. At the same time only one webservice's lookup is working.
    Kindly help me to resolve this issue.
    regards,
    Zia
    Edited by: PT Expert on Sep 9, 2012 3:16 AM

    I work now more that two days on this error!!!
    -> I remade my complete jdev project, it did not work!
    -> I deleted the jdev/system/j2ee/oc4j/workspace dir
    -> I search for some .lock files
    -> and many more tries!!! But without success...
    Is there a way to reset the Embedded OC4J?

  • Javax.naming.NameNotFoundException: While trying to lookup 'mail.NewMailSes

    Hi All,
    Am using jdeveloper 11.1.1.6. Am trying to send a mail through ADF
    I have verfied the link which given below and trying to do the same.
    http://adfblogs.blogspot.in/2012/01/sending-e-mail-from-adf-application.html
    While am pressing the send button am getting the exception as
    <LifecycleImpl> <_handleException> ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase INVOKE_APPLICATION 5
    javax.faces.el.EvaluationException: javax.naming.NameNotFoundException: While trying to lookup 'mail.NewMailSession' didn't find subcontext 'mail'. Resolved ''; remaining name 'mail/NewMailSession'
         at org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:58)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodBinding(UIXComponentBase.java:1256)
         at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:183)
         at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
         at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:889)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:379)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:194)
    Could any one pls help me to resolve it?

    I had restarted the weblogic server even though am getting the same error
    javax.naming.NameNotFoundException: While trying to lookup 'mail.NewMailSession' didn't find subcontext 'mail'. Resolved ''; remaining name 'mail/NewMailSession'
         at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
         at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:247)
         at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:182)
         at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206)
         at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)
         at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:411)
         at javax.naming.InitialContext.lookup(InitialContext.java:392)
         at Mail.SendAction(Mail.java:49)
         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 com.sun.el.parser.AstValue.invoke(Unknown Source)
         at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)

  • Javax.naming.NameNotFoundException: While trying to lookup 'jdbc.SampleHR1DS' didn't find subcontext

    hi,
    i have installed hr schema and created a page with a table.when i run the page,
    i am getting  javax.naming.NameNotFoundException: While trying to lookup 'jdbc.SampleHR1DS' didn't find subcontext 'jdbc'. Resolved ''; remaining name 'jdbc/SampleHR1DS'
    Do i need to create data source for this.How to resolve this.
    i am using 11.1.2.4.0 jdev

    there are multiple option of creating data source.which one i should use.
    should i use generic one. what is URL information for oracle xe client.what is driver name?

  • [b]EJB unable to find my Home interface-javax.naming.NameNotFoundException[

    I am pretty new to J2ee so help me out with these basics
    I had deployed my application at college which worked exactly but when I deployed it at my home, it got deployed well but its returning a error message when create is called. Also i had used mssql for jdbc connection but haven't set the j2ee_classpath, pls help me how to find jdbc drivers .jar file. Does j2ee_classpath has anything to do with my error.All other paths are intact.
    Help me soon, i have to hurry up my proj...
    Advanced Thanks To Your Good Heart.
    - Suresh Kumar.R
    coding snippet -->****Down
         public AccountBean()
              try
                   Context ic=new InitialContext();
                   java.lang.Object objref=ic.lookup("java:comp/env/ejb/Account");
                   accountHome=(AcHome)PortableRemoteObject.narrow(objref,AcHome.class);
              catch(Exception re)
                   System.err.println("Couldn't locate Account Home");
                   re.printStackTrace();
              reset();
    ********Error :********
    Couldn't locate Account Home
    javax.naming.NameNotFoundException: Account not found
    <<no stack trace available>>ack trace available>>

    yes Everything you say is right in my prog. but it still does n't works.
    i haven't set my j2ee_classpath & does it have anything to do with my error.
    if so, where to find the drivers(MS-SQL) .jar file.
    Thank You for Your reply
    -Suresh Kumar.R

  • EJB javax.naming.NameNotFoundException:

    Hi,
    I have EJB deployed in JRUN. I am trying to run Client program. It is giving the following error
    javax.naming.NameNotFoundException: ejbT.test1Home not found
    at allaire.ejipt._NamingContext.lookup(_NamingContext.java:73)
    at allaire.ejipt._ClientContext.lookup(_ClientContext.java:113)
    at javax.naming.InitialContext.lookup(InitialContext.java:347)
    at ejbT.testClient.main(testClient.java:44)
    I checked <ejb-name> in ejb-jar.xml and jrun-ejb-jar.xml file .. they are the same.
    What can be the problem.
    Can some please help me.
    Thanks in advance.

    Does the JNDI name in your client match that of your EJB?

  • Javax.naming.NameNotFoundException: ejb/collaxa/system/DeliveryBean not fou

    Hi,
    I'm trying to run an esb process that invokes a bpel process but I'm getting the following error invoking bpel:
    oracle.tip.esb.server.common.exceptions.BusinessEventFatalException: Se ha devuelto una excepción no tratada en el sistema ESB. La excepción mostrada es: "java.lang.Exception: Fallo al crear el bean "ejb/collaxa/system/DeliveryBean"; la excepción mostrada es: "javax.naming.NameNotFoundException: ejb/collaxa/system/DeliveryBean not found
         at com.evermind.server.rmi.RMIClientContext.lookup(RMIClientContext.java:52)
         at javax.naming.InitialContext.lookup(InitialContext.java:351)
         at com.oracle.bpel.client.util.BeanRegistry.lookupDeliveryBean(BeanRegistry.java:279)
         at com.oracle.bpel.client.delivery.DeliveryService.getDeliveryBean(DeliveryService.java:250)
         at com.oracle.bpel.client.delivery.DeliveryService.post(DeliveryService.java:174)
         at com.oracle.bpel.client.delivery.DeliveryService.post(DeliveryService.java:158)
         at oracle.tip.esb.server.service.impl.bpel.BPELService.processBusinessEvent(BPELService.java:342)
         at oracle.tip.esb.server.dispatch.InitialEventDispatcher.dispatchNonRoutingService(InitialEventDispatcher.java:106)
         at oracle.tip.esb.server.dispatch.InitialEventDispatcher.dispatch(InitialEventDispatcher.java:85)
         at oracle.tip.esb.server.dispatch.BusinessEvent.raise(BusinessEvent.java:1416)
         at oracle.tip.esb.utils.EventUtils.raiseBusinessEvent(EventUtils.java:105)
         at oracle.tip.esb.server.service.EsbRouterSubscription.onBusinessEvent(EsbRouterSubscription.java:273)
         at oracle.tip.esb.server.dispatch.EventDispatcher.executeSubscription(EventDispatcher.java:138)
         at oracle.tip.esb.server.dispatch.DeferredEventDispatcher.processSubscriptions(DeferredEventDispatcher.java:150)
         at oracle.tip.esb.server.dispatch.EventDispatcher.dispatchRoutingService(EventDispatcher.java:94)
         at oracle.tip.esb.server.dispatch.DeferredEventDispatcher.dispatch(DeferredEventDispatcher.java:67)
         at oracle.tip.esb.server.dispatch.agent.JavaDeferredMessageHandler.handleMessage(JavaDeferredMessageHandler.java:115)
         at oracle.tip.esb.server.dispatch.agent.ESBWork.process(ESBWork.java:162)
         at oracle.tip.esb.server.dispatch.agent.ESBWork.run(ESBWork.java:120)
         at oracle.j2ee.connector.work.WorkWrapper.runTargetWork(WorkWrapper.java:242)
         at oracle.j2ee.connector.work.WorkWrapper.doWork(WorkWrapper.java:215)
         at oracle.j2ee.connector.work.WorkWrapper.run(WorkWrapper.java:190)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:814)
         at java.lang.Thread.run(Thread.java:595)
         at com.oracle.bpel.client.util.ExceptionUtils.handleServerException(ExceptionUtils.java:82)
         at com.oracle.bpel.client.delivery.DeliveryService.getDeliveryBean(DeliveryService.java:254)
         at com.oracle.bpel.client.delivery.DeliveryService.post(DeliveryService.java:174)
         at com.oracle.bpel.client.delivery.DeliveryService.post(DeliveryService.java:158)
         at oracle.tip.esb.server.service.impl.bpel.BPELService.processBusinessEvent(BPELService.java:342)
         at oracle.tip.esb.server.dispatch.InitialEventDispatcher.dispatchNonRoutingService(InitialEventDispatcher.java:106)
         at oracle.tip.esb.server.dispatch.InitialEventDispatcher.dispatch(InitialEventDispatcher.java:85)
         at oracle.tip.esb.server.dispatch.BusinessEvent.raise(BusinessEvent.java:1416)
         at oracle.tip.esb.utils.EventUtils.raiseBusinessEvent(EventUtils.java:105)
         at oracle.tip.esb.server.service.EsbRouterSubscription.onBusinessEvent(EsbRouterSubscription.java:273)
         at oracle.tip.esb.server.dispatch.EventDispatcher.executeSubscription(EventDispatcher.java:138)
         at oracle.tip.esb.server.dispatch.DeferredEventDispatcher.processSubscriptions(DeferredEventDispatcher.java:150)
         at oracle.tip.esb.server.dispatch.EventDispatcher.dispatchRoutingService(EventDispatcher.java:94)
         at oracle.tip.esb.server.dispatch.DeferredEventDispatcher.dispatch(DeferredEventDispatcher.java:67)
         at oracle.tip.esb.server.dispatch.agent.JavaDeferredMessageHandler.handleMessage(JavaDeferredMessageHandler.java:115)
         at oracle.tip.esb.server.dispatch.agent.ESBWork.process(ESBWork.jav
    I know that the processes work fine because I have deployed them in another server and they are working fine. The esb process invokes the bpel without problems.
    I have read some threads in this forum where this error appears, but they are related to jsps, and the solution given doesn't apply.
    I really appreciate any help. Thanks in advance,
    Zaloa

    here is the detailed properties.
    properties.put("java.naming.factory.initial",                         "com.evermind.server.rmi.RMIInitialContextFactory");
                   properties.put("java.naming.provider.url", "ormi://localhost");
                   properties.put("java.naming.security.principal",
                             "admin");
                   properties.put("java.naming.security.credentials",
                             "welcome"

  • EJB Reference could not be resolved (javax.naming.NameNotFoundException)

    I am new to EJBs and am trying to get a simple Java client to run which I've generated from a EJB3.0 session bean.
    The code for the client (LoanAppFacadeClient.java) is
    package buslogic;
    import java.util.Hashtable;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    public class LoanAppFacadeClient {
    public static void main(String [] args) {
    try {
    final Context context = getInitialContext();
    LoanAppFacade loanAppFacade = (LoanAppFacade)context.lookup("java:comp/env/ejb/LoanAppFacade");
    // Call any of the Remote methods below to access the EJB
    // System.out.println( loanAppFacade.getLoans( ) );
    loanAppFacade.addLoan( "Galactic Loans", 30, "fixed", 6.25 );
    String ssn = "123-12-1234";
    System.out.println(loanAppFacade.getCreditRating( ssn ));
    } catch (Exception ex) {
    ex.printStackTrace();
    private static Context getInitialContext() throws NamingException {
    Hashtable env = new Hashtable();
    // Standalone OC4J connection details
    env.put( Context.INITIAL_CONTEXT_FACTORY, "oracle.j2ee.naming.ApplicationClientInitialContextFactory" );
    env.put( Context.SECURITY_PRINCIPAL, "oc4jadmin" );
    env.put( Context.SECURITY_CREDENTIALS, "welcome1" );
    env.put(Context.PROVIDER_URL, "ormi://localhost:23791/LoanApp");
    return new InitialContext( env );
    When the trying to run the client I get a warning:
    "WARNING: EJB Reference "ejb/LoanAppFacade" could not be resolved."
    followed by the error
    "javax.naming.NameNotFoundException: java:comp/env/ejb/LoanAppFacade not found in Lab1_BusinessServices-app-client"
    When the client was created I right-clicked on the session bean (LoanAppFacadeBean which implements LoanAppFacade) and chose New Sample Java Client.
    This automatically creates the java client and also created the following xml file (application-client.xml)
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <application-client xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application-client_1_4.xsd" version="1.4" xmlns="http://java.sun.com/xml/ns/j2ee">
    <display-name>Lab1_BusinessServices-app-client</display-name>
    <ejb-ref>
    <ejb-ref-name>ejb/LoanAppFacade</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <remote>buslogic.LoanAppFacade</remote>
    <ejb-link>LoanAppFacade</ejb-link>
    </ejb-ref>
    </application-client>
    Could someone please help me to fix these errors?
    Thanks,
    Andrew

    I used windows for years whereby I stored all photos in folders. As macs don't use this concept I am finding it hard to organize my photos.
    You can do this on your Mac too. Just don't use iPhoto. But iPhoto is a lot more flexible.
    For instance:
    I usually sort them by month so when I say move to an album I mean I create an album called for example '2013 March' so I can easily find specific photos/videos.
    Click on the Magnifying Glass lower left to reveal the search box. Then click on the magnifying glass in the search box, and select Date. Now you can instantly find all the photos from a particular month, or day.
    File -> New Smart Album will allow you to create an automatic album for any date or date range you choose.
    Select one of the affected videos in the iPhoto Window and go File -> Reveal in Finder -> Original. A Finder Window should open with the file selected. Does it play?

  • Javax.naming.NameNotFoundException: error in whil calling EJB Bean

    Dear friends,
    I have created (Bean Managed Entity) a remote,home and bean objects for adding a country in a database. When i convert
    into jar and and deploy means, its working fine. But if i put into a package means it does work
    and raise "javax.naming.NameNotFoundException" error.
    i keep my files as following folder structure
    d:\siva\projects\ShopCart\
    (under this )
    CountryMas.java
    CountryHome.java
    CountryBean.java
    CountryMasPK.java
    <meta-inf>
    ejb-jar.xml
    weblogic-ejb-jar.xml
    and deployed in weblogic 6.1 using console.
    i have copied the source code here with
    Remote interface
    package ShopCart;
    import javax.ejb.*;
    import javax.rmi.*;
    public interface CountryMas extends EJBObject {
    Home Interface
    package ShopCart;
    import javax.ejb.*;
    import java.rmi.*;
    public interface CountryHome extends EJBHome {
         public CountryMas create(String Cname) throws CreateException,RemoteException;
         public CountryMas findByPrimaryKey(CountryMasPK pk) throws      
    FinderException,RemoteException;
    BEAN OBJECT
    package ShopCart;
    import java.io.*;
    import java.util.*;
    import java.sql.*;
    import javax.sql.*;
    import javax.ejb.*;
    import javax.naming.*;
    public class CountryBean implements EntityBean {
         private EntityContext ctx;
         private int CountryId;
         private String CountryName;
         public void setEntityContext(EntityContext ctx){
              this.ctx = ctx;
         public void unsetEntityContext(){
              this.ctx = null;
         public void ejbActivate(){
         public void ejbPassivate(){
         public void ejbLoad(){
         public void ejbStore(){
         public void ejbRemove(){
              Connection con = null;
              PreparedStatement ps = null ;
              try {
                   con = getConnection();
                   ps = con.prepareStatement("Delete from CountryMas where id=?");
                   ps.setInt(1,CountryId);
                   if (ps.executeUpdate() !=1) {
                        String Error = "JDBC did not create any row";
                        throw new CreateException (Error);
              }catch (Exception e){
                   System.out.println (e);
         public CountryMasPK ejbCreate(String Cname) throws CreateException {
              this.CountryName =Cname;
              Connection con = null;
              PreparedStatement ps = null ;
              try {
                   con = getConnection();
                   ps = con.prepareStatement("insert into CountryMas values(?)");
                   ps.setString (1,CountryName);
                   if (ps.executeUpdate() !=1) {
                        String Error = "JDBC did not delete any row";
                        throw new CreateException (Error);
                   con.commit();
              }catch (Exception e){
                   System.out.println (e);
              int PKid=0;
              ResultSet rs;
              PreparedStatement ps1 = null;
              try {
                   ps1 = con.prepareStatement("select max(id) as Mid from CountryMas");
                   rs = ps1.executeQuery();
                   PKid = rs.getInt("mid");
              }catch(Exception e){
                   System.out.println (e);
              return new CountryMasPK(PKid);
         public void ejbPostCreate(String Cname) throws CreateException {
         private Connection getConnection()throws SQLException {
              InitialContext initCtx = null;
              DataSource ds = null;
              try{
                   initCtx = new InitialContext ();
                   ds = (javax.sql.DataSource)
                        initCtx.lookup("java:comp/env/jdbc/ShopCartPool");
              }catch(Exception e){
                   System.out.println(e);
              return ds.getConnection();           
         public CountryMasPK ejbFindByPrimaryKey(CountryMasPK pk)throws ObjectNotFoundException {
              Connection con= null;
              PreparedStatement ps = null ;
              try{
                   con = getConnection();
                   ps = con.prepareStatement("select cname from CountryMas where id=?");
                   ps.setInt(1,pk.ID);
                   ps.executeQuery();
                   ResultSet rs= ps.getResultSet();
                   if (rs.next()){
                        this.CountryName = rs.getString(1);
              }catch(Exception e){
                   System.out.println(e);
              //return new CountryMasPK(pk.i);
              return pk;
    PRIMARY KEY OBJECT
    package ShopCart;
    import java.io.Serializable;
    public class CountryMasPK implements java.io.Serializable {
         public int ID;
         public CountryMasPK(int ID){
              this.ID =ID;
         public CountryMasPK(){
         public CountryMasPK(CountryMasPK pk){
                   this.ID = pk.ID;
         public String toString(){
                   return new Integer(ID).toString();
         public int hashCode(){
              return new Integer(ID).hashCode();
         public boolean equals(Object countrymas){
              //return ((CountryMasPK)countrymas).ID.equals(ID);
              return true;
    EJB-JAR.XML
    <?xml version="1.0"?>
    <!DOCTYPE ejb-jar PUBLIC
    '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN'
    'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
    <ejb-jar>
    <enterprise-beans>
    <entity>
    <ejb-name>ShopCart</ejb-name>
    <home>ShopCart.CountryHome</home>
    <remote>ShopCart.CountryMas</remote>
    <ejb-class>ShopCart.CountryBean</ejb-class>
    <persistence-type>Bean</persistence-type>
    <prim-key-class>ShopCart.CountryMasPK</prim-key-class>
    <reentrant>False</reentrant>
    <resource-ref>
    <res-ref-name>jdbc/ShopCartPool</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    </entity>
    </enterprise-beans>
    <assembly-descriptor>
    <container-transaction>
    <method>
    <ejb-name>ShopCart</ejb-name>
         <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>
    WEBLOGIC-EJB-JAR.XML
    <?xml version="1.0"?>
    <!DOCTYPE weblogic-ejb-jar PUBLIC
    '-//BEA Systems, Inc.//DTD WebLogic 6.0.0 EJB//EN'
    'http://www.bea.com/servers/wls600/dtd/weblogic-ejb-jar.dtd'>
    <weblogic-ejb-jar>
    <weblogic-enterprise-bean>
    <ejb-name>ShopCart</ejb-name>
    <reference-descriptor>
    <resource-description>
    <res-ref-name>jdbc/ShopCartPool</res-ref-name>
         <jndi-name>ShopCartDataSource</jndi-name>
    </resource-description>
    </reference-descriptor>
    <jndi-name>Country</jndi-name>
    </weblogic-enterprise-bean>
    </weblogic-ejb-jar>
    i converted jar file like this
    d:\siva\projects\> set claapath=%classpath%;.;
    cd d:\siva\projects\ShopCart > javac *.java
    cd d:\siva\projects\ShopCart > jar -cvf Sh.jar *
    cd..
    d:\siva\projects> java weblogic.ejbc ShopCart\Sh.jar ShopCart\Shop.jar
    and deployed using weblogic 6.1 console
    and client code as follows
    Client.java
    import java.io.*;
    import javax.naming.*;
    import javax.ejb.*;
    import javax.rmi.*;
    import java.util.*;
    import ShopCart.*;
    class Client {
         public static void main(String args[]){
              Context ctx=null;
              try{
                   Properties pr = new Properties();
                   pr.put(Context.INITIAL_CONTEXT_FACTORY,
                        "weblogic.jndi.WLInitialContextFactory");
                   pr.put(Context.PROVIDER_URL,"t3://localhost:7001");
                   ctx= new InitialContext(pr);
                   Object obj = ctx.lookup("Country");
                   CountryHome cm = (CountryHome)
    javax.rmi.PortableRemoteObject.narrow(obj,CountryHome.class);
                   cm.create(args[0]);
                   System.out.println ("Creating Country " + args[0] +" ..... [Done]");          
              }catch (Exception e){
                   System.out.println(e);
    when i run this file it raise the error
    D:\Siva\Projects>java Client.java
    Exception in thread "main" java.lang.NoClassDefFoundError: Client/java
    D:\Siva\Projects>java Client
    javax.naming.NameNotFoundException: Unable to resolve Country. Resolved: '' Unre
    solved:'Country' ; remaining name ''
    D:\Siva\Projects>
    This is the error message. Please observe it and do let me know what would be the error. There
    would be small configuration error. But i couldn't locate it . plz help me somebody.
    Thanx & Regards,
    Siva.

    you need to use the name java:comp/env/Country in the client.
    and the client deployment descriptor will need an ejb-ref entry:
    <ejb-ref>
      <ejb-ref-name>
        Country
      </ejb-ref-name>
      <ejb-ref-type>
        Session
      </ejb-ref-type>
      <home>
        ShopCart.CountryHome
      </home>
      <remote>
        ShopCart.CountryMas
      </remote>
    </ejb-ref>toby

  • JNDI lookup failed:javax.naming.NameNotFoundException

    Hello:
    I have a application (not web) that publish messages to a specific topic, i want to receive these messages in a Web Service, but when the web service make the call to a class that is the JMS Client it can't find the Connection factory Name that i create in the aplication.
    I want to know what i have to do,
    I work with J2EE1.3.1 and JMS1.0.2 for the application that publish the messages
    and Jwsdp1.1, tomcat 4 and j2sdk 1.4.0 for the web service.
    I create the connection factory with this command:
    j2eeadmin -addJmsFactory jms/DurableTopicB topic -props clientID=IdTopicB
    Then in the class that the web service invoke i trying to join with this:
    try {
    jndiContext =new InitialContext();
    }catch (NamingException e){
    System.err.println("Could not create JNDI API "+
    "context:"+e.toString());
    return;
    *Look up connection factory and topic.If either  
    *does not exist,exit.                            
    try {
    topicConnectionFactory =(TopicConnectionFactory)
    jndiContext.lookup(conFacName);
    }catch (NamingException e){                      
    System.err.println("JNDI API lookup failed:"+
    e.toString());
    return;
    //System.exit(1);
    But i receive a error message in the log of Tomcat:
    JNDI API lookup failed:javax.naming.NameNotFoundException: El nombre DurableTopicB no este asociado a este contexto
    Thanks

    Hello:
    I display the full context of the connection factory in the application that publish the message:
    Full context is :
    Enviroment is : {java.naming.corba.orb=com.sun.enterprise.iiop.POAEJBORB@ec4a87}
    And in the web service when i create the initial context the full context is:
    Full context is : java:
    Enviroment is : {java.naming.factory.initial=org.apache.naming.java.javaURLContextFactory, java.naming.factory.url.pkgs=org.apache.naming}
    How can i see the connection factory in the Web Service, because the connection factory was created in other Application?

  • Javax.naming.NameNotFoundException: Unable to resolve ejb-link.

    Env: JDK 1.3.1_08
    Weblogic: 7.0
    We are attempting to use EJB's (session) and have it all localized in a jar.
    The Business and Custom Logic is all compiled to WEB-INF/classes. All the jars including the EJB jar is under WEB-INF/lib.
    On Startup Weblogic throws the error message
    weblogic.management.ApplicationException: activate failed for application
    Module Name: application, Error: weblogic.j2ee.DeploymentException: Could not setup environment - with nested exception:
    [javax.naming.NameNotFoundException: Unable to resolve ejb-link. Appejb.jar#AppServerBean is not in the context. The context includes the following link bindings: {} Make sure the link reference is relative to the URI of the referencing module.]
    I have tried using the ../ notation before the Appejb.jar in the web.xml and what not, but that does not work either.
    I have sucesfully deployed the EJB jar through the weblogic console.
    Any Clues or suggestions will be most appreciated..
    thanks
    -a

    Create a ear application from the ejb jar and web application war.
    Copy ear application to the applications directory.
    In the ejb-link element in web.xml specify the relative path to the ejb jar.
    <ejb-link>../Appejb.jar</ejb-link>
    thanks,
    Deepak
    Akshay <[email protected]> wrote:
    Env: JDK 1.3.1_08
    Weblogic: 7.0
    We are attempting to use EJB's (session) and have it all localized in
    a jar.
    The Business and Custom Logic is all compiled to WEB-INF/classes. All
    the jars including the EJB jar is under WEB-INF/lib.
    On Startup Weblogic throws the error message
    weblogic.management.ApplicationException: activate failed for application
    Module Name: application, Error: weblogic.j2ee.DeploymentException: Could
    not setup environment - with nested exception:
    [javax.naming.NameNotFoundException: Unable to resolve ejb-link. Appejb.jar#AppServerBean
    is not in the context. The context includes the following link bindings:
    {} Make sure the link reference is relative to the URI of the referencing
    module.]
    I have tried using the ../ notation before the Appejb.jar in the web.xml
    and what not, but that does not work either.
    I have sucesfully deployed the EJB jar through the weblogic console.
    Any Clues or suggestions will be most appreciated..
    thanks
    -a

  • EJB ERR: Namingexception caught:javax.naming.NoInitialContextException

    Hi,
    I am trying to deploy a sample ejb on Jboss and trying to call it from a client.
    I am getting the following error.
    *********Before LookUP*********
    Namingexception caught:javax.naming.NoInitialContextException: Need to specify c
    lass name in environment or system property, or as an applet parameter, or in an
    application resource file: java.naming.factory.initial
    This is my client code for the ejb where I have specified the INITIAL_CONTEXT_FACTORY and PROVIDER_URL..
    Am I missing something here?
    Is there any other way to go about this. Any help would be greatly appreciated.
    Thanks and Regards,
    Ajith
    THE CLIENT CODE IS AS GIVEN BELOW
    package simple_bean_client;
    import javax.ejb.*;
    import simpleBean.*;
    import javax.naming.Context;
    import java.util.Properties;
    import java.util.Hashtable;
    import javax.naming.InitialContext;
    class SalaryClient
         public static void main(String args[])
              Hashtable env = new Hashtable();
              env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
              env.put(Context.PROVIDER_URL, "localhost:1099");
              env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
         /*Properties pro = System.getProperties();
         pro.put( "java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory" );
         pro.put( "java.naming.provider.url","localhost:1099" );*/
              try{
                   InitialContext ctx=new InitialContext();
                   System.out.println("*********Before LookUP*********");
                   Object objRef=ctx.lookup("SalaryHome");
                   System.out.println("*********After LookUP*********");
                   SalaryHome home=(SalaryHome)javax.rmi.PortableRemoteObject.narrow(
                   objRef,SalaryHome.class);
                   Salary bean=home.create();
                   System.out.println("monthly net salary:"+bean.calculateSalary(28000,2,500));
              }catch(javax.naming.NamingException ne){
                   System.out.println("Namingexception caught:"+ne);
              }catch(javax.ejb.CreateException ce){
                   System.out.println("Create exeption caught:"+ce);
              }catch(java.rmi.RemoteException re){
                   System.out.println("Remote Exception caught:"+re);               
         }//closing main
    }//closing the class

    Found this . . .
    The following works for JBOSS, jndi.properties -file:
    java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
    java.naming.provider.url=jnp://your.host.com:1099
    The client code is as follows:
    Properties prop = new Properties();
    InputStream is = this.getClass().getClassLoader().getResourceAsStream(jndi_property_file);
    prop.load(is);
    Context ctx = new InitialContext(prop);
    anEJBHome =(EJBHome)PortableRemoteObject.narrow(ctx.lookup(homeClass.getName()),homeClass);

  • Javax.naming.NameNotFoundException while trying to lookup for the Datasourc

    I get following exception when the datasource is looked up after redeployment.
    javax.naming.NameNotFoundException: Unable to resolve 'jdbc.oracleDS' Resolved: '' Unresolved:'jdbc' ; remaining name 'jdbc.oracleDS'
    But after redeployment if I restart the application server, this problem gets resolved automatically and I am able to get the connection.
    So is there any specific configuration, so that I can access the Database connections without restarting the servers after re-deployment?
    Connection Pool and DataSource are targetted to a Cluster.
    Please let me know if there is any solution for this.
    Thanks in advance !

    there are multiple option of creating data source.which one i should use.
    should i use generic one. what is URL information for oracle xe client.what is driver name?

  • Javax.naming.NameNotFoundException during a lookup() call.

    I am getting this exception when I try to get a reference to my Local Entity bean from within a Remote Session bean.
    ( I did a search in these forums, and found a few topics similar to mine. However, those that were similar were unfortunately still unresolved).
    I have a Session Bean with a Remote interface (ExecutionReportOperator),
    and an Entity Bean with a local interface (ExecutionReport). It is deployed in JBoss, here is output that indicates successful deployment:
    INFO [EjbModule] Deploying ExecutionReport
    INFO [EjbModule] Deploying ExecutionReportOperator
    INFO [BaseLocalProxyFactory] Bound EJB LocalHome 'ExecutionReport' to jndi 'local/ExecutionReport@4199584'
    INFO [ProxyFactory] Bound EJB Home 'ExecutionReportOperator' to jndi 'ExecutionReportOperator'
    INFO [EJBDeployer] Deployed: file:/C:/Program Files/jboss-4.0.3SP1/server/default/deploy/ExecReportingEJBs.jar
    Now, within my Session bean, I'm trying to get a reference to the Home interface of my Entity bean:
    private ExecutionReportHome getExecutionReportHomeObject()
    throws NamingException {
    InitialContext ic = new InitialContext();
    ExecutionReportHome erh = (ExecutionReportHome) ic.lookup("ExecutionReport");
    return erh;
    However this throws a Naming exception. I guess the string I'm sending in to the lookup() method needs to be adjusted/modified. I've tried "local/ExecutionReport" as well as the full package name, no luck. Does anyone know what the string should look like?
    Here are the contents of my ejb-jar.xml file:
    <enterprise-beans>
    <session>
    <ejb-name>ExecutionReportOperator</ejb-name>
    <home>com.fanfare.server.execReporting.beans.session.ExecutionReportOperatorHome</home>
    <remote>com.fanfare.server.execReporting.beans.session.ExecutionReportOperator</remote>
    <ejb-class>com.fanfare.server.execReporting.beans.session.ExecutionReportOperatorBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    <entity>
    <ejb-name>ExecutionReport</ejb-name>
    <local-home>com.fanfare.server.execReporting.beans.entity.ExecutionReportHome</local-home>
    <local>com.fanfare.server.execReporting.beans.entity.ExecutionReport</local>
    <ejb-class>com.fanfare.server.execReporting.beans.entity.ExecutionReportBean</ejb-class>
    <persistence-type>Container</persistence-type>
    <prim-key-class>java.lang.Integer</prim-key-class>
    <reentrant>false</reentrant>
    <cmp-version>2.x</cmp-version>
    <abstract-schema-name>ExecutionReport</abstract-schema-name>
    ...

    Some additional info: Just to test, I created a Remote interface for my Entity bean and deployed it to JBoss. Once I did that, I was able to successfully locate the Local object without any Naming exceptions. (No code changes to my original function, just created the Remote interface and deployed it).
    Hope this extra information is useful.

  • EventService lookup from ejb project

    hi
    We want to use the EventService from with in a class which resides in an ejb project of our portal application.
    We used the EventService from within the portal webapp project without problems. With
    Object o = p_context.lookup( "java:comp/env/ejb/EventService" );
    we could lookup the object and narrow it to the EventServiceHome interface. However this does not work within the ejb project.
    We get the error message:
    "javax.naming.NameNotFoundException: While trying to look up comp/env/ejb/EventService in /app/ejb/scp_helpers.jar#EJBTTHelper.; remaining name 'comp/env/ejb/EventService'"
    We tried another name which we found in different depoyment descriptors: p13n_ejb.jar#EventService . No success.
    What name do we have to use or shortly: what are we doing wrong? How could we get the EventService SessionBean from within an ejb project?

    look up the resource-ref in web.xml (and weblogic.xml). Add the same in ejb-jar.xml (and weblogic-ejb-jar.xml). The entries are not exactly the same, but the concept is the same.
    Best regards...
    hi
    We want to use the EventService from with in a class
    which resides in an ejb project of our portal
    application.
    We used the EventService from within the portal
    webapp project without problems. With
    Object o = p_context.lookup(
    "java:comp/env/ejb/EventService" );
    we could lookup the object and narrow it to the
    EventServiceHome interface. However this does not
    work within the ejb project.
    We get the error message:
    "javax.naming.NameNotFoundException: While trying to
    look up comp/env/ejb/EventService in
    /app/ejb/scp_helpers.jar#EJBTTHelper.; remaining name
    'comp/env/ejb/EventService'"
    We tried another name which we found in different
    depoyment descriptors: p13n_ejb.jar#EventService . No
    success.
    What name do we have to use or shortly: what are we
    doing wrong? How could we get the EventService
    SessionBean from within an ejb project?

Maybe you are looking for

  • How to import a message class in a fm

    Hello! I' m programminn a FM. I need to use a message class that i have created. How i can import it? I have to return a strcuct which i have to copy my message class. My code:           DETAIL_RETURN-ID =           DETAIL_RETURN-NUMBER =           D

  • Stage dimensions(size) in Flash CS4 (AS3)

    Hi again, I need to know how to get the dimensions of my stage (x,y), BUT only the stage and not all the objects that might continue off the stage included. For example :      My stage is 400 x 550.      I want to get 400 and 550 returned. Thank you

  • Porting Flex 2 apps to Flex 3 (SDK)

    Is there a list somewhere of the specific changes made in Flex 3? http://blogs.adobe.com/flexdoc/2008/02/migrating_from_flex_2_to_flex.html Ok, this helps, but looking here, it mentions style property changes.  Trying SDK 3 real quick on an SDK 2 app

  • How to link  MC in library in CS5

    Hi, can u plz tell me how to link ball_mc from library in CS5 Thanks JaxNa

  • How does account determination take place ??

    dear experts pls enlighten me on how excatly account determination take place . what is an account grping code what is transaction event key what is the technical name for keys used in OBYC like BSX , WRX GBB etc what is the other keys like VAX ,INV