[jboss-user] [EJB 3.0] - Re: Problem with Bean

jaikiran do-not-reply at jboss.com
Wed Jun 4 04:41:41 EDT 2008


anonymous wrote : javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is j
  | avax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception 
  | is java.net.ConnectException: Connection refused: connect]]
  | 	at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:274)
  | 	at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1533)
  | 	at org.jnp.interfaces.NamingContext.rebind(NamingContext.java:487)
  | 	at javax.naming.InitialContext.rebind(InitialContext.java:412)
  | 	at org.hibernate.util.NamingHelper.bind(NamingHelper.java:74)
  | 	at org.hibernate.impl.SessionFactoryObjectFactory.addInstance(SessionFactoryObjectFactory.java:90)
  | 	at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:306)
  | 	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
  | 	at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:713)
  | 	at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.
  | java:127)

In your LoginBean.jar you probably are not including a jndi.properties file, because of which the default localhost:1099 is being used. But since you start the server using run -b [IP], the JNDI and other services are not available at localhost. Include a jndi.properties with the following contents:

java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
  | java.naming.provider.url=jnp://[IP]:1099
  | java.naming.factory.url.pkgs=org.jboss.naming.jnp.interfaces
  | 
  |  

Replace the [IP] appropriately in this jndi.properties file. 



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4155585#4155585

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4155585



More information about the jboss-user mailing list