This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 142899 - [test] 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
Summary: [test] javax.naming.NoInitialContextException: Need to specify class name in ...
Status: VERIFIED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Hibernate (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Vadiraj Deshpande
URL: http://statistics.netbeans.org/except...
Keywords:
: 142900 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-08-05 11:48 UTC by Jan Horvath
Modified: 2008-09-30 08:39 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter: 35862


Attachments
stacktrace (194 bytes, text/plain)
2008-08-05 11:48 UTC, Jan Horvath
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Horvath 2008-08-05 11:48:33 UTC
Build: NetBeans IDE Dev (Build 080805)
VM: Java HotSpot(TM) Client VM, 1.5.0_13-119, Java(TM) 2 Runtime Environment, Standard Edition, 1.5.0_13-b05-237
OS: Mac OS X, 10.5.4, i386

User Comments: 
-run HQL query editor in existing project
-start typing a query, exception raised while typing

Stacktrace: 
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(NamingManager.java:645)
        at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
        at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:284)
        at javax.naming.InitialContext.getNameParser(InitialContext.java:439)
        at org.hibernate.util.NamingHelper.bind(NamingHelper.java:52)
        at org.hibernate.impl.SessionFactoryObjectFactory.addInstance(SessionFactoryObjectFactory.java:90)
Comment 1 Jan Horvath 2008-08-05 11:48:38 UTC
Created attachment 66576 [details]
stacktrace
Comment 2 Vadiraj Deshpande 2008-08-05 12:24:56 UTC
*** Issue 142900 has been marked as a duplicate of this issue. ***
Comment 3 Vadiraj Deshpande 2008-08-05 12:27:38 UTC
Hi Honza,

I would like to see your cfg file. Can you please attach it here ? Most probably this issue is because you have a 'name'
attribute in <session-factory /> tag, which is actually refers to jndi name..
Comment 4 Vadiraj Deshpande 2008-08-05 12:28:30 UTC
Hi Honza,

I would like to see your cfg file. Can you please attach it here ? Most probably this issue is because you have a 'name'
attribute in <session-factory /> tag, which is actually refers to jndi name.. If you remove this attribute, you should
be able to see on-the-fly sql and be able to run the query.
Comment 5 Jan Horvath 2008-08-05 12:53:29 UTC
Yes, there is a name attribute in session-factory.

<hibernate-configuration>
  <session-factory name="session1">
    <property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/fittest</property>
    <property name="hibernate.connection.username">fittest</property>
    <property name="hibernate.connection.password">netbeans</property>
    <property name="current_session_context_class">thread</property>
    <property name="hibernate.hbm2ddl.auto">update</property>
    <mapping class="org.netbeans.test.entity.Testsuite"/>
    <mapping class="org.netbeans.test.entity.Project"/>
...
Comment 6 Jan Horvath 2008-08-05 15:31:19 UTC
even if I remove the name attribute I get this error:

org.hibernate.hql.ast.QuerySyntaxException: Testsuite is not mapped [select t from Testsuite t]
	at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:158)
	at org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:87)
	at org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:70)
...
Comment 7 Vadiraj Deshpande 2008-08-08 12:43:43 UTC
The exceptions after removing the session-name attribute are because of http://www.netbeans.org/issues/show_bug.cgi?id=136996 (Annotation support), 
which is fixed as part of that issue. I will investigate the exception due to the presence of session-name attribute. Thnx
Comment 8 Vadiraj Deshpande 2008-08-18 21:59:09 UTC
Fixed:
http://hg.netbeans.org/main/rev/6cf97ed3ff9e
Comment 9 Vadiraj Deshpande 2008-08-18 22:22:27 UTC
My mistake. This changeset does not fix this issue..
Comment 10 Vadiraj Deshpande 2008-08-21 23:35:58 UTC
Fixed: (Added pre-check to ensure JNDI setup if specified in cfg file, is correct)

http://hg.netbeans.org/main/rev/6bf7d174a9cc
Comment 11 Martin Fousek 2008-09-30 08:39:26 UTC
I cannot reproduce it now.

Verified with NetBeans IDE Dev (Build 200809300201).