9 Replies Latest reply on Dec 8, 2009 9:46 AM by Wolfgang Knauf

    NotBound ERRoR

    amira manai Newbie

      Hi EveryBody,
      after running the client i have this error and i can't find a solution:I'm running the client in another java project which contain the jindi.properties and log4j.properties.

      My HotelTestBean.java and HotelTestBeanLocal.java and HotelTestBeanRemote.java are in another ejb project

      this is the errrors:
      03:59:12,480 DEBUG TimedSocketFactory:87 - createSocket, hostAddr: localhost/127.0.0.1, port: 1099, localAddr: null, localPort: 0, timeout: 0
      javax.naming.NameNotFoundException: HotelTestBean not bound
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
      at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
      at org.jnp.server.NamingServer.lookup(NamingServer.java:396)
      at sun.reflect.GeneratedMethodAccessor251.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
      at sun.rmi.transport.Transport$1.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Unknown Source)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
      at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
      at sun.rmi.server.UnicastRef.invoke(Unknown Source)
      at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:722)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:682)
      at javax.naming.InitialContext.lookup(Unknown Source)
      at FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:22)
      Exception in thread "main" java.lang.RuntimeException: javax.naming.NameNotFoundException: HotelTestBean not bound
      at FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:34)
      Caused by: javax.naming.NameNotFoundException: HotelTestBean not bound
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
      at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
      at org.jnp.server.NamingServer.lookup(NamingServer.java:396)
      at sun.reflect.GeneratedMethodAccessor251.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
      at sun.rmi.transport.Transport$1.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Unknown Source)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
      at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
      at sun.rmi.server.UnicastRef.invoke(Unknown Source)
      at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:722)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:682)
      at javax.naming.InitialContext.lookup(Unknown Source)
      at FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:22)

      this my FirstEJB3TutorialClient:
      mport java.util.Properties;
      import javax.naming.Context;
      import javax.naming.InitialContext;
      import javax.naming.NamingException;

      public static void main(String[] args) {

      Context context;
      try{
      context = new InitialContext();
      HotelTestBeanRemote beanRemote = (HotelTestBeanRemote) context.lookup(HotelTestBean.RemoteJNDIName);
      beanRemote.test(); }
      catch (NamingException e){
      e.printStackTrace();
      throw new RuntimeException(e);} }}

      I'm a biginner and i don't know what to do help please.
      Regards.

        • 1. Re: NotBound ERRoR
          Wolfgang Knauf Master

          Hi,

          Do you have a "jndi.properties" file? If not, you have to provide some properites to "InitialContext":

          Properties props = new Properties();
           props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
           props.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming.client");
           props.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");
           props.setProperty("j2ee.clientName", "ClientNameFromJBossClientXML");
          
           InitialContext initialContext = new InitialContext(props);


          What is the value of "HotelTestBean.RemoteJNDIName"?
          It should be "EARName/EJBName/remote" if your app is bundled as EAR file, or "EJBName/remote" if you deploy only an EJB jar.

          Hope this helps

          Wolfgang

          • 2. Re: NotBound ERRoR
            amira manai Newbie

            Hi Mr Knauf,
            I'm so sorry for late reply i was at university!
            yes i have the jndi.properties:
            java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
            java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
            java.naming.provider.url=localhost:1099


            HotelTestBean.RemoteJNDIName=
            public static final String RemoteJNDIName = HotelTestBean.class.getSimpleName() + "/remote";

            Sir i know that it's a stupid question BUT I'M SORRY
            i'm a biginner: how can i know if my app is bundled as EAR fil or as EJB jar.

            But i think it is bundled as EAR file because i have this error:so how can i know the name of my EARName.
            Thank u so much sir

            • 3. Re: NotBound ERRoR
              amira manai Newbie

              Hi Sir,
              after a reaserch i wanna tell you that my appl is an EjB jar ,
              so everything is correct as u said it to me!
              so what is the problem
              should i install another jboss server
              Thank you in advance

              • 4. Re: NotBound ERRoR
                jaikiran pai Master

                Since you are new to EJB3, the best place to start is, looking at the tutorials. Download AS 5.1.0 and try these tutorials http://www.jboss.org/file-access/default/members/jbossejb3/freezone/docs/tutorial/1.0.7/html/index.html

                • 5. Re: NotBound ERRoR
                  amira manai Newbie

                  Hi Mr wolfgang,
                  i'm just using u property code:
                  Properties props = new Properties();
                  props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
                  props.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming.client");
                  props.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");
                  props.setProperty("j2ee.clientName", "ClientNameFromJBossClientXML");

                  InitialContext initialContext = new InitialContext(props);
                  But i'm having an exception and this is it:
                  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(Unknown Source)
                  at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
                  at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
                  at javax.naming.InitialContext.lookup(Unknown Source)
                  at com.et.GestionDeStockClient.main(GestionDeStockClient.java:29)
                  Thank you so much

                  • 6. Re: NotBound ERRoR
                    amira manai Newbie

                     

                    "Wolfgang Knauf" wrote:
                    Hi,

                    Do you have a "jndi.properties" file? If not, you have to provide some properites to "InitialContext":
                    Properties props = new Properties();
                     props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
                     props.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming.client");
                     props.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");
                     props.setProperty("j2ee.clientName", "ClientNameFromJBossClientXML");
                    
                     InitialContext initialContext = new InitialContext(props);


                    What is the value of "HotelTestBean.RemoteJNDIName"?
                    It should be "EARName/EJBName/remote" if your app is bundled as EAR file, or "EJBName/remote" if you deploy only an EJB jar.

                    Hope this helps

                    Wolfgang

                    Hi i ried to use this code without editing it but i still have this error: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
                    But after a reaserch i found that i have to install jars

                    "So Just adding the "appserv-rt.jar" in sun server lib folder to the classpath does the trick for providing the corba properties" :tih is what i found is this a solution!!
                    Thank u for help



                    • 7. Re: NotBound ERRoR
                      Wolfgang Knauf Master

                      Hi,

                      in my "Properties" snippet, there is one thing you have to replace with your own config: the "j2ee.clientName" should be declared in your "jboss-client.xml" file.
                      But you don't need this line if you don't want to use the ENC for lookup.

                      What do you mean with "sun server lib"? Is your client actually a ejb app in a sun app server?

                      It seems that you are missing big conceptual parts of EJB3. So I would advice you (as Jaikiran already did) to take the time and read a good book or at least some EJB tutorials ;-).

                      Best regards

                      Wolfgang

                      • 8. Re: NotBound ERRoR
                        amira manai Newbie

                         

                        "Wolfgang Knauf" wrote:
                        Hi,

                        in my "Properties" snippet, there is one thing you have to replace with your own config: the "j2ee.clientName" should be declared in your "jboss-client.xml" file.
                        But you don't need this line if you don't want to use the ENC for lookup.

                        What do you mean with "sun server lib"? Is your client actually a ejb app in a sun app server?

                        It seems that you are missing big conceptual parts of EJB3. So I would advice you (as Jaikiran already did) to take the time and read a good book or at least some EJB tutorials ;-).

                        Best regards

                        Wolfgang

                        Hi Sir,
                        Thank u for ur reply!!
                        My client is an ejb application:and this it:

                        package ClientBeans;
                        
                        
                        
                        import java.util.Iterator;
                        import java.util.List;
                        import java.util.Properties;
                        
                        import javax.naming.Context;
                        import javax.naming.InitialContext;
                        import javax.naming.NamingException;
                        import javax.persistence.EntityManager;
                        import javax.persistence.PersistenceContext;
                        
                        import de.laliluna.library.Hotel;
                        import de.laliluna.library.HotelTestBean;
                        import de.laliluna.library.HotelTestBeanRemote;
                        
                        
                        public class ClientA {
                        
                         /**
                         * @param args
                         */
                        
                        
                        
                        
                         public static void main(String[] args) {
                        
                         // Context context;
                        
                        
                        
                        
                         try
                         {
                        
                         Properties props = new Properties();
                         props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
                         props.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming.client");
                         props.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");
                         // props.setProperty("j2ee.clientName", "ClientNameFromJBossClientXML");
                        
                         InitialContext initialContext = new InitialContext(props);
                        
                        
                        
                        
                        
                        
                         //context = new InitialContext();
                        
                         HotelTestBeanRemote beanRemote = (HotelTestBeanRemote) initialContext.lookup("HotelTestBean/local");
                        
                         beanRemote.test();
                        
                        
                        
                         } catch (NamingException e)
                         {
                         e.printStackTrace();
                        
                         throw new RuntimeException(e);
                         }
                        
                        
                        
                        
                         }
                        
                        }
                        
                        I have an error when i start my jboos server , sop that's why the client can't be executed and this it:



                        
                        04:38:38,232 ERROR [AbstractKernelController] Error installing to Start: name=persistence.unit:unitName=#sample state=Create
                        javax.persistence.PersistenceException: [PersistenceUnit: sample] Unable to build EntityManagerFactory
                         at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
                         at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)
                         at org.jboss.jpa.deployment.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:301)
                         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                         at java.lang.reflect.Method.invoke(Unknown Source)
                         at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:59)
                         at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:150)
                         at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
                         at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:241)
                         at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47)
                         at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:109)
                         at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:70)
                         at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:221)
                         at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)
                         at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42)
                         at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
                         at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
                         at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
                         at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
                         at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598)
                         at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
                         at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
                         at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
                         at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:774)
                         at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)
                         at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:121)
                         at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:51)
                         at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
                         at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
                         at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
                         at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
                         at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
                         at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
                         at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
                         at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
                         at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598)
                         at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
                         at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
                         at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
                         at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
                         at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
                         at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
                         at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:698)
                         at org.jboss.system.server.profileservice.ProfileServiceBootstrap.loadProfile(ProfileServiceBootstrap.java:304)
                         at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:205)
                         at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:405)
                         at org.jboss.Main.boot(Main.java:209)
                         at org.jboss.Main$1.run(Main.java:547)
                         at java.lang.Thread.run(Unknown Source)
                        Caused by: org.hibernate.HibernateException: cannot simultaneously fetch multiple bags
                         at org.hibernate.loader.BasicLoader.postInstantiate(BasicLoader.java:89)
                         at org.hibernate.loader.entity.EntityLoader.<init>(EntityLoader.java:98)
                         at org.hibernate.loader.entity.EntityLoader.<init>(EntityLoader.java:66)
                         at org.hibernate.loader.entity.EntityLoader.<init>(EntityLoader.java:56)
                         at org.hibernate.loader.entity.BatchingEntityLoader.createBatchingEntityLoader(BatchingEntityLoader.java:126)
                         at org.hibernate.persister.entity.AbstractEntityPersister.createEntityLoader(AbstractEntityPersister.java:1775)
                         at org.hibernate.persister.entity.AbstractEntityPersister.createEntityLoader(AbstractEntityPersister.java:1779)
                         at org.hibernate.persister.entity.AbstractEntityPersister.createLoaders(AbstractEntityPersister.java:3012)
                         at org.hibernate.persister.entity.AbstractEntityPersister.postInstantiate(AbstractEntityPersister.java:3005)
                         at org.hibernate.persister.entity.SingleTableEntityPersister.postInstantiate(SingleTableEntityPersister.java:712)
                         at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:322)
                         at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
                         at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
                         at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
                         ... 50 more
                        04:38:38,271 WARN [WebServiceDeployerEJB] Ingore ejb deployment with null classname: org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData@8fd19516{HotelTestBean}
                        04:38:38,333 ERROR [ProfileServiceBootstrap] Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
                        
                        DEPLOYMENTS MISSING DEPENDENCIES:
                         Deployment "jboss.j2ee:jar=BaseHotele.jar,name=HotelTestBean,service=EJB3" is missing the following dependencies:
                         Dependency "<UNKNOWN jboss.j2ee:jar=BaseHotele.jar,name=HotelTestBean,service=EJB3>" (should be in state "Described", but is actually in state "** UNRESOLVED Demands 'persistence.unit:unitName=#sample' **")
                        
                        DEPLOYMENTS IN ERROR:
                         Deployment "<UNKNOWN jboss.j2ee:jar=BaseHotele.jar,name=HotelTestBean,service=EJB3>" is in error due to the following reason(s): ** UNRESOLVED Demands 'persistence.unit:unitName=#sample' **
                         Deployment "persistence.unit:unitName=#sample" is in error due to the following reason(s): org.hibernate.HibernateException: cannot simultaneously fetch multiple bags
                        
                        04:38:38,353 INFO [Http11Protocol] D�marrage de Coyote HTTP/1.1 sur http-127.0.0.1-8080
                        
                        

                        And i can't identify the cause i think it's my persistence.xml who cause the problem:
                        My persistence.xml

                        
                        <persistence xmlns="http://java.sun.com/xml/ns/persistence"
                         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                         xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
                         version="1.0">
                         <persistence-unit name="sample">
                         <jta-data-source>java:/DefaultDS</jta-data-source>
                         <properties>
                        
                         <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
                         </properties>
                         </persistence-unit>
                        </persistence>

                        I'm reading a lot of tutorial as you said it to me you and Mr jaikiran.
                        If you can help me please Give me a help i really need it.
                        Thank you so much Sir