Discussions

EJB design: Problem with EJB on JBOSS

  1. Problem with EJB on JBOSS (10 messages)

    Hi

    I have got an stateless session EJB, which i am able to successfully deploy. I have defined added 2 XML files (ejb-jar.xml and jboss.xml) Then i have a servlet, which calls that EJB.

    Now the problem i am facing is that when i try to create the home object using the JNDI name .. i get an exception saying ...

    "The system properties or the environment has not been defined"

    I am unable to find a solution for this problem please help me .. its urgent !!!

    Threaded Messages (10)

  2. Problem with EJB on JBOSS[ Go to top ]

    Sounds like a jndi.properties problem...
    You need to have the following three lines in your jndi.properties file and the file must be in your CLASSPATH.

    java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
    java.naming.provider.url=localhost:1099
    java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

    I hope this helps you

    Cheers,

    Jake


  3. Problem with EJB on JBOSS[ Go to top ]

    I have already treid pasting it in jndi.properties

    java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
    java.naming.provider.url=http://localhost:1099
    java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

    but as long as

    java.naming.provider.url=http://localhost:1099

    is commented by # it works .. otherwise the JNDI service intialization fails
  4. Problem with EJB on JBOSS[ Go to top ]

    The actuall error statement is

    [EmbeddedTomcat]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
  5. Problem with EJB on JBOSS[ Go to top ]

    the error i am getting now is .......


    [Auto deploy] Auto deploy of file:/E:/jboss/deploy/myBean.jar
    [J2EE Deployer] Deploy J2EE application: file:/E:/jboss/deploy/myBean.jar
    [J2EE Deployer] Could not delete temporary file: /E:/jboss/bin/../tmp/deploy/copy1001.zip
    [J2EE Deployer] Create application myBean.jar
    [J2EE Deployer] Installing EJB package: myBean.jar
    [J2EE Deployer] Starting module myBean.jar
    [Container factory] Deploying:file:/E:/jboss/bin/../tmp/deploy/myBean.jar/ejb1002.jar
    [Verifier] Verifying file:/E:/jboss/bin/../tmp/deploy/myBean.jar/ejb1002.jar
    [Container factory] Deploying myBean
    [Container factory] javax.naming.ServiceUnavailableException: http. Root exception is java.net.UnknownHostException: http
    [Container factory] at java.net.InetAddress.getAllByName0(InetAddress.java:571)
    [Container factory] at java.net.InetAddress.getAllByName0(InetAddress.java:540)
    [Container factory] at java.net.InetAddress.getByName(InetAddress.java:449)
    [Container factory] at java.net.Socket.<init>(Socket.java:100)
    [Container factory] at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:94)
    [Container factory] at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:693)
    [Container factory] at org.jnp.interfaces.NamingContext.rebind(NamingContext.java:193)
    [Container factory] at org.jnp.interfaces.NamingContext.rebind(NamingContext.java:186)
    [Container factory] at javax.naming.InitialContext.rebind(InitialContext.java:366)
    [Container factory] at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.rebind(JRMPContainerInvoker.java:454)
    [Container factory] at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.start(JRMPContainerInvoker.java:370)
    [Container factory] at org.jboss.ejb.StatelessSessionContainer.start(StatelessSessionContainer.java:179)
    [Container factory] at org.jboss.ejb.Application.start(Application.java:174)
    [Container factory] at org.jboss.ejb.ContainerFactory.deploy(ContainerFactory.java:736)
    [Container factory] at org.jboss.ejb.ContainerFactory.deploy(ContainerFactory.java:272)
    [Container factory] at java.lang.reflect.Method.invoke(Native Method)
    [Container factory] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
    [Container factory] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
    [Container factory] at org.jboss.deployment.J2eeDeployer.startApplication(J2eeDeployer.java:645)
    [Container factory] at org.jboss.deployment.J2eeDeployer.deploy(J2eeDeployer.java:137)
    [Container factory] at java.lang.reflect.Method.invoke(Native Method)
    [Container factory] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
    [Container factory] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
    [Container factory] at org.jboss.ejb.AutoDeployer.deploy(AutoDeployer.java:332)
    [Container factory] at org.jboss.ejb.AutoDeployer.run(AutoDeployer.java:268)
    [Container factory] at org.jboss.ejb.AutoDeployer.startService(AutoDeployer.java:311)
    [Container factory] at org.jboss.util.ServiceMBeanSupport.start(ServiceMBeanSupport.java:92)
    [Container factory] at java.lang.reflect.Method.invoke(Native Method)
    [Container factory] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
    [Container factory] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
    [Container factory] at org.jboss.dependencies.DependencyManager.startMBean(DependencyManager.java:284)
    [Container factory] at org.jboss.dependencies.DependencyManager.loadService(DependencyManager.java:261)
    [Container factory] at org.jboss.dependencies.DependencyManager.processService(DependencyManager.java:243)
    [Container factory] at org.jboss.dependencies.DependencyManager.startMBeans(DependencyManager.java:117)
    [Container factory] at org.jboss.Main.<init>(Main.java:162)
    [Container factory] at org.jboss.Main$1.run(Main.java:87)
    [Container factory] at java.security.AccessController.doPrivileged(Native Method)
    [Container factory] at org.jboss.Main.main(Main.java:83)
    [J2EE Deployer] Starting myBean.jar failed!
    [J2EE Deployer] Module myBean.jar is not running
    [J2EE Deployer] Destroying application myBean.jar
    [J2EE Deployer] deployment.cfg file deleted.
    [J2EE Deployer] Could not remove file: file:/E:/jboss/tmp/deploy/myBean.jar
    [Auto deploy] Deployment failed:file:/E:/jboss/deploy/myBean.jar
  6. Problem with EJB on JBOSS[ Go to top ]

    It seems that your naming service is not available on port 1099. Have you configured JBoss to provide the naming service on an alternate port?
  7. Problem with EJB on JBOSS[ Go to top ]

    By the way, you should have two separate jndi.properties files. One in $JBOSS/conf/, which I have not modified and contains the following.

    java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
    #java.naming.provider.url=localhost
    java.naming.factory.url.pkgs=org.jboss.naming

    You should also have a jndi.properties file for your client, which looks something like this.

    java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
    java.naming.provider.url=localhost:1099
    java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

    Your JBoss server does not need to know the url of the naming service, because it provides naming service.

    However, your client has no knowledge of the naming service, so you must provide it with the url.
  8. Problem with EJB on JBOSS[ Go to top ]

    Oh, one other thing...

    The JNDI service initialization may have been failing because you were modifying the server's jndi.properties.

    My client's jndi.properties file does not exist in the system CLASSPATH, I specify it as a command line argument when I invoke the client. Which probably makes little difference, but just so you know...
  9. Problem with EJB on JBOSS[ Go to top ]

    This message looks like your EJB-deployment-descriptor contains a !DOCTYPE entry that points to an address in the internet.
    The JBoss XML-parser tries to resolve the address and if your server has no connection to the internet, the deployment will fail.

  10. Problem with EJB on JBOSS[ Go to top ]

    Isn't the actual solution in the difference between the following two statements:

    http://localhost:1099
    and
    localhost:1099

    On the second line of the jndi.properties...
    [Container factory] javax.naming.ServiceUnavailableException: http. Root exception is java.net.UnknownHostException: http
    This error gives it away I think. The naming server does not run on http protocol, but instead on jndi:// or jnp:// Which you needn't specify.

    regards,
    Jeroen
  11. Re: Problem with EJB on JBOSS[ Go to top ]

    I have the error like this. javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory] javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory] 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.(Unknown Source) i have put my WorkspaceHandler.jar in Jboss deploy dir and this is my java's code: Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); env.put(Context.PROVIDER_URL, "localhost"); env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces" ); Context initCtx = new InitialContext(env); Object ref = initCtx.lookup("WorkspaceHandler"); homeHandler = (WorkspaceHandlerHome) PortableRemoteObject.narrow(ref, homeHandler = (WorkspaceHandlerHome) PortableRemoteObject.narrow(ref, WorkspaceHandlerHome.class); //Create remote interface if (homeHandler == null) { throw new Exception("Could not get home for WorkspaceHandler"); } remoteHandler = homeHandler.create(); }catch(Exception e){ System.out.println(e); e.printStackTrace(); } what is the problem ? i need help please. regards.