Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problems with JNDI name configuration  RSS feed

 
patrick patel
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to create a simple J2EE application using stateless session beans, struts, hibernate on JBoss server. Everything seems to be working fine, but the server output is not what I expect. In the output, there is a line indicating, "[SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured". I don't know as to why is the statement appearing. Here is the server output.

10:21:00,548 INFO [STDOUT] Form setId. id = 2
10:21:00,565 INFO [STDOUT] Initial id :
10:21:00,565 INFO [STDOUT] Form is NOT null
10:21:00,566 INFO [STDOUT] Form getId. id = 2
10:21:00,567 INFO [STDOUT] After assign, id : 2
10:21:00,568 INFO [STDOUT] Properties set successfully
10:21:02,142 INFO [STDOUT] ejbCreate() on obj src.SchoolEJB@1b7c680
10:21:02,224 INFO [TestClient] listing honey
10:21:02,229 INFO [STDOUT] Before session factory configuration
10:21:02,230 INFO [Configuration] configuring from resource: /WEB-INF/hibernate.cfg.xml
10:21:02,230 INFO [Configuration] Configuration resource: /WEB-INF/hibernate.cfg.xml
10:21:02,246 INFO [Configuration] Mapping resource: src/InputForm.hbm.xml
10:21:03,143 INFO [Binder] Mapping class: src.InputForm -> student
10:21:03,151 INFO [Configuration] Configured SessionFactory: null
10:21:03,153 INFO [STDOUT] After session factory configuration
10:21:03,153 INFO [Configuration] processing one-to-many association mappings
10:21:03,154 INFO [Configuration] processing one-to-one association property references
10:21:03,159 INFO [Configuration] processing foreign key constraints
10:21:03,160 INFO [Dialect] Using dialect: net.sf.hibernate.dialect.MySQLDialect
10:21:03,161 INFO [SettingsFactory] Maximim outer join fetch depth: 2
10:21:03,162 INFO [SettingsFactory] Use outer join fetching: true
10:21:03,162 INFO [DriverManagerConnectionProvider] Using Hibernate built-in connection pool (not for production use!)
10:21:03,163 INFO [DriverManagerConnectionProvider] Hibernate connection pool size: 20
10:21:03,163 INFO [DriverManagerConnectionProvider] using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost/school
10:21:03,164 INFO [DriverManagerConnectionProvider] connection properties: {user=root, password=}
10:21:03,164 INFO [TransactionManagerLookupFactory] No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
10:21:03,454 INFO [SettingsFactory] Use scrollable result sets: true
10:21:03,454 INFO [SettingsFactory] Use JDBC3 getGeneratedKeys(): true
10:21:03,455 INFO [SettingsFactory] Optimize cache for minimal puts: false
10:21:03,456 INFO [SettingsFactory] Query language substitutions: {}
10:21:03,456 INFO [SettingsFactory] cache provider: net.sf.hibernate.cache.EhCacheProvider
10:21:03,457 INFO [Configuration] instantiating and configuring caches
10:21:03,458 INFO [SessionFactoryImpl] building session factory
10:21:03,511 INFO [STDOUT] Form getName. name = null
10:21:03,512 INFO [STDOUT] Form setName. name = null
10:21:03,589 INFO [SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured
10:21:03,592 INFO [STDOUT] Before SELECT query
10:21:03,625 INFO [STDOUT] name = hello world
10:21:03,626 INFO [STDOUT] Form setName. name = hello world
10:21:03,648 INFO [STDOUT] Form getId. id = 2
10:21:03,649 INFO [STDOUT] Form getName. name = hello world

============
jboss.xml
============
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC
"-//JBoss//DTD JBOSS 4.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd">
<jboss>
<enterprise-beans>
<session>
<ejb-name>src/SchoolEJB</ejb-name>
<jndi-name>ejb/src/SchoolEJB</jndi-name>
</session>
</enterprise-beans>
<resource-managers>
</resource-managers>
</jboss>

===========
ejb-jar.xml
===========
<?xml version="1.0" encoding="UTF-8"?>
<!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>
<session>
<description>Session Bean ( Stateless )</description>
<display-name>SchoolEJB</display-name>
<ejb-name>src/SchoolEJB</ejb-name>
<home>src.SchoolHome</home>
<remote>src.School</remote>
<ejb-class>src.SchoolEJB</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
<assembly-descriptor>
</assembly-descriptor>
</ejb-jar>

=================
hibernate.cfg.xml
=================
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- properties -->
<property name="connection.username">root</property>
<property name="connection.url">jdbc:mysql://localhost/school</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<property name="connection.password"></property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>

<!-- mapping files -->
<mapping resource="src/InputForm.hbm.xml"/>
</session-factory>
</hibernate-configuration>

============
Action class
============

Context ctx = getInitialContext();
Object objref = ctx.lookup("ejb/src/SchoolEJB");
mySchoolHome = (SchoolHome) PortableRemoteObject.narrow(objref, SchoolHome.class);
mySchoolRemote = mySchoolHome.create();
name = mySchoolRemote.searchById(id);
System.out.println("name = " + name);
formobj.setName(name);

private Context getInitialContext() throws NamingException
{
Properties properties = null;
String error = "";
properties = new Properties();
properties.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
properties.put("java.naming.provider.url", "jnp://localhost:1099");
properties.put("java.naming.factory.url.pkgs", "org.jboss.naming rg.jnp.interfaces");
System.out.println("Properties set successfully");
try
{
return new InitialContext(properties);
}
catch (NamingException e)
{
System.out.println("ERROR_DTO " + e.getMessage());
error = "error.servidor.general";
throw new NamingException(error);
}
}

===================

The error which I think is the key to the problem is:
"Not binding factory to JNDI, no JNDI name configured"

I really don't know as to why am I getting this error.

Thanks.
 
kumar kk
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey if you got the answer for this,
mail me .
even i am looking for this solution .
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"kumar kk"

Please check your private message, for a message from JavaRanch.
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by kumar kk:
hey if you got the answer for this,
mail me .
even i am looking for this solution .


The original poster had posted the question 2 years back. It might be difficult to get an answer as to whether he got the problem fixed. Provide us more details about your application and also the issue that you are running into.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!