-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Configuration Issue
PostPosted: Tue Apr 27, 2004 9:19 am 
Beginner
Beginner

Joined: Tue Mar 02, 2004 1:12 pm
Posts: 25
Location: Newcastle Upon Tyne
Hi

Can I ask another question about configuration? I am now using a hibernate.cfg.xml file (with hibernate 2.1.2 and MySql as my DB), which looks like:

Code:
<?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>
   <!-- a SessionFactory instance listed as /jndi/name -->
   <session-factory name="java:comp/env/hibernate/SessionFactory">
      <!-- properties -->
      <property name="connection.url">jdbc:mysql://localhost:3306/mir</property>
      <property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
      <!--<property name="connection.url">jdbc:mysql://localhost:3306/mir</property>-->
      <property name="connection.username">arijitm</property>
      <property name="connection.password">password</property>
      <property name="connection.driver_class">org.gjt.mm.mysql.Driver</property>
      <property name="show_sql">false</property>
      <property name="use_outer_join">true</property>
      <!-- mapping files -->
      <!-- Package DomainData -->
      <mapping resource="uk/org/mygrid/mir/infomodel/DomainData/FormatType.hbm.xml"/>
      <mapping resource="uk/org/mygrid/mir/infomodel/DomainData/TransferType.hbm.xml"/>
      <!-- Package EScienceProcess -->
      <mapping resource="uk/org/mygrid/mir/infomodel/EScienceProcess/ExperimentDesign.hbm.xml"/>
      <mapping resource="uk/org/mygrid/mir/infomodel/EScienceProcess/ExperimentInstance.hbm.xml"/>
      <mapping resource="uk/org/mygrid/mir/infomodel/EScienceProcess/Study.hbm.xml"/>
      <mapping resource="uk/org/mygrid/mir/infomodel/EScienceProcess/Programme.hbm.xml"/>
      <mapping resource="uk/org/mygrid/mir/infomodel/EScienceProcess/LabBookView.hbm.xml"/>
      <!-- Package Operations -->
      <mapping resource="uk/org/mygrid/mir/infomodel/Operations/FormalInputParameter.hbm.xml"/>
      <mapping resource="uk/org/mygrid/mir/infomodel/Operations/FormalOutputParameter.hbm.xml"/>
      <mapping resource="uk/org/mygrid/mir/infomodel/Operations/Operation.hbm.xml"/>
      <mapping resource="uk/org/mygrid/mir/infomodel/Operations/OperationContent.hbm.xml"/>
      <mapping resource="uk/org/mygrid/mir/infomodel/Operations/OperationType.hbm.xml"/>
      <mapping resource="uk/org/mygrid/mir/infomodel/Operations/WebService.hbm.xml"/>
      <mapping resource="uk/org/mygrid/mir/infomodel/Operations/WSPortType.hbm.xml"/>
      <!-- Package PeopleAndOrganizations -->
      <mapping resource="uk/org/mygrid/mir/infomodel/PeopleAndOrganizations/Person.hbm.xml"/>
      <mapping resource="uk/org/mygrid/mir/infomodel/PeopleAndOrganizations/Address.hbm.xml"/>
      <mapping resource="uk/org/mygrid/mir/infomodel/PeopleAndOrganizations/Affiliation.hbm.xml"/>
      <mapping resource="uk/org/mygrid/mir/infomodel/PeopleAndOrganizations/AffiliationEpisode.hbm.xml"/>
      <mapping resource="uk/org/mygrid/mir/infomodel/PeopleAndOrganizations/OrganizationalStructure.hbm.xml"/>
      <mapping resource="uk/org/mygrid/mir/infomodel/PeopleAndOrganizations/OrganizationalUnit.hbm.xml"/>
      <!-- Package Provenance -->
      <mapping resource="uk/org/mygrid/mir/infomodel/Provenance/ActualInputParameter.hbm.xml"/>
      <mapping resource="uk/org/mygrid/mir/infomodel/Provenance/ActualOutputParameter.hbm.xml"/>
      <mapping resource="uk/org/mygrid/mir/infomodel/Provenance/CreationType.hbm.xml"/>
      <mapping resource="uk/org/mygrid/mir/infomodel/Provenance/DataProvenance.hbm.xml"/>
      <mapping resource="uk/org/mygrid/mir/infomodel/Provenance/OperationTrace.hbm.xml"/>
      <mapping resource="uk/org/mygrid/mir/infomodel/Provenance/ScuflWorkflowTrace.hbm.xml"/>
      <!-- Package Resources -->
      <mapping resource="uk/org/mygrid/mir/infomodel/Resources/LSDocument.hbm.xml"/>
      <mapping resource="uk/org/mygrid/mir/infomodel/Resources/MetaDataAnnotation.hbm.xml"/>
      <mapping resource="uk/org/mygrid/mir/infomodel/Resources/Resource.hbm.xml"/>
   </session-factory>
</hibernate-configuration>


The file is loaded and the database is accessed, but there is one exception:

Code:
     [java] - Using Hibernate built-in connection pool (not for production use!)
     [java] - Hibernate connection pool size: 1
     [java] - using driver: org.gjt.mm.mysql.Driver at URL: jdbc:mysql://localhost:3306/mir
     [java] - connection properties: {user=arijitm, password=password}
     [java] - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
     [java] - Use scrollable result sets: true
     [java] - Use JDBC3 getGeneratedKeys(): true
     [java] - Optimize cache for minimal puts: false
     [java] - Query language substitutions: {no='N', true=1, yes='Y', false=0}
     [java] - cache provider: net.sf.hibernate.cache.HashtableCacheProvider
     [java] - instantiating and configuring caches
     [java] - building session factory
     [java] - Factory name: java:comp/env/hibernate/SessionFactory
     [java] - JNDI InitialContext properties:{}
     [java] - Could not bind factory to JNDI
     [java] 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
     [java]     at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:640)
     [java]     at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
     [java]     at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:280)
     [java]     at javax.naming.InitialContext.getNameParser(InitialContext.java:429)
     [java]     at net.sf.hibernate.util.NamingHelper.bind(NamingHelper.java:52)
     [java]     at net.sf.hibernate.impl.SessionFactoryObjectFactory.addInstance(SessionFactoryObjectFactory.java:90)
     [java]     at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:172)
     [java]     at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:750)
     [java]     at uk.org.mygrid.mir.test.HibernateTest.main(HibernateTest.java:268)


What does this imply and how can I get rid of it?

Regards
Arijit


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 27, 2004 9:25 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Do you want your SessionFactory bound in JNDI? If no, drop name="java:comp/env/hibernate/SessionFactory" from the <session-factory> element. If yes, and you use Tomcat, get a proper container with a write-accessible JNDI context. If yes, and you have a proper container, give more info about your setup.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 27, 2004 9:32 am 
Beginner
Beginner

Joined: Tue Mar 02, 2004 1:12 pm
Posts: 25
Location: Newcastle Upon Tyne
michael wrote:
Do you want your SessionFactory bound in JNDI? If no, drop name="java:comp/env/hibernate/SessionFactory" from the <session-factory> element. If yes, and you use Tomcat, get a proper container with a write-accessible JNDI context. If yes, and you have a proper container, give more info about your setup.


Thank you Michael. This solved the problem. I am not much aware of JNDI.

Right now, I am doing all development and testing locally. But ultimately I will have to deploy my application as a Web Service running on Tomcat. The remote clients would access the methods exposed by this service (this methods would use hibernate internally). I hope I wouldn't need this JNDI context even in that case? Am I correct?

Arijit


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 27, 2004 1:57 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
No you are not forced to use JNDI.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.