-->
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.  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Console configuration & JNDI problems
PostPosted: Thu Apr 20, 2006 12:00 pm 
Beginner
Beginner

Joined: Thu Apr 20, 2006 11:51 am
Posts: 44
Hibernate version: last
HI
I'm using the H. tools for the first time with the plugin in Eclipse.
I try to use a JNDI connection with a JBOSS AP
On the Jboss dir
%home_jboss-4.0.2%\server\default\deploy
I've insert the xml that specifies the datasources for oracle DB connection
In eclipse I set the hibernate.cfg.xml in this way:
<session-factory>
<property name="connection.datasource">jdbc/JNCVCoreDS</property>
<property name="show_sql">true</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
</session-factory>

jdbc/JNCVCoreDS is the JNDI name in the xml file oracle-ds.xml on Jboss
now I start the server and in the Hib.tools I try to read the db tables but I can't!
The Hib. Configuration gives me a "Sessionfactory error: Could not find datasource"!

I don't know what's the mistake!
Someone can help me?!
(excusme 4 my bad english)
thx
Alain


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 20, 2006 2:50 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
there are (obviously?) no datasource configured inside eclipse thus you should use a cfg.xml or hibernate.properties that uses a normal jdbc connection.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 21, 2006 4:02 am 
Beginner
Beginner

Joined: Thu Apr 20, 2006 11:51 am
Posts: 44
Hi thx 4 reply
Eclipse has xml datasources configured inside!
I've tested them with a test.jsp page that does a lookup

<%
Context initCtx = new InitialContext();
out.println("acquisizione datasource");
DataSource ds = (DataSource) initCtx.lookup("java:jdbc/JOBNETCoreDS");
out.println("acquisizione connection");
Connection con = ds.getConnection();

%>

in the jsp this works well! No exception and it write "acquisizione datasource acquisizione connection", so jsp can see the jndi.

With the same JNDI name set on the "hibernateJNDB.cfg.xml" the HibernateConsole on Hib.Configurations returns me the error
"Sessionfactory error: Could not find datasource"!

------------hibernateJNDB.cfg.xml--------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.datasource">java:jdbc/JOBNETCoreDS</property>
<property name="show_sql">true</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
</session-factory>
</hibernate-configuration>
--------------------------------------------------

The Hib. console configuration has configured the reference ("Configuration file") to the hibernateJNDB.cfg.xml's path.
Under the "classpath" I've insert the complete path of jdbc driver for Oracle. (classes12.jar)

I've spent a lot of time to resolve this problem... arghh..
Anyone can help me?
thx


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 21, 2006 4:06 am 
Beginner
Beginner

Joined: Thu Apr 20, 2006 11:51 am
Posts: 44
note: I try to change the connection.datasource property with the same
<property name="connection.datasource">jdbc/JOBNETCoreDS</property>
but it still doesn't work!

:(((


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 21, 2006 4:08 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
trust me - eclipse does *not* have datasources inside it.

Your jsp's does not run inside eclipse, they run in your web/appserver - not eclipse.

Just do what I suggested and it will work.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 21, 2006 5:04 am 
Beginner
Beginner

Joined: Thu Apr 20, 2006 11:51 am
Posts: 44
excuse me ..!! I don't want to say
"Eclipse has xml datasources configured inside"
but I want to say
"JBOSS has xml datasources configured inside"
I've Jboss AP installed!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 21, 2006 5:08 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
yes, and the hibernate you are configuring to run *insdie* hibernate via the plugin has *nothing* to do with that remote jboss installation.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 21, 2006 5:10 am 
Beginner
Beginner

Joined: Thu Apr 20, 2006 11:51 am
Posts: 44
this is the xml file for datasource in jboss
%jboss_home%\server\default\deploy
directort!
It works well
with the jsp I can access the db with a lookup!

<?xml version="1.0" encoding="UTF-8"?>

<!-- ===================================================================== -->
<!-- -->
<!-- JBoss Server Configuration -->
<!-- -->
<!-- ===================================================================== -->

<!-- $Id: oracle-ds.xml,v 1.1.2.4 2003/09/17 03:46:01 ejort Exp $ -->
<!-- ==================================================================== -->
<!-- Datasource config for Oracle originally from Steven Coy -->
<!-- ==================================================================== -->


<datasources>
<local-tx-datasource>
<jndi-name>jdbc/JOBNETCoreDS</jndi-name>
<connection-url>jdbc:oracle:thin:@xxx.xxx.xxx.xxx:1521:orcl</connection-url>
<!-- <connection-url>jdbc:oracle:thin:@(description=(address=(host=dbserver)(protocol=tcp)(port=1521))(connect_data=(SERVICE_NAME=orcl.dbserver)))</connection-url>-->
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<transaction-isolation>TRANSACTION_SERIALIZABLE</transaction-isolation>
<user-name>xxx</user-name>
<password>xxx</password>
<min-pool-size>5</min-pool-size>
<max-pool-size>50</max-pool-size>
<blocking-timeout-millis>30000</blocking-timeout-millis>
<idle-timeout-minutes>30</idle-timeout-minutes>
<new-connection-sql>SELECT * FROM JNDB_AMBITO_SKILL</new-connection-sql>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
<track-statements>true</track-statements>
<prepared-statement-cache-size>100</prepared-statement-cache-size>
</local-tx-datasource>
</datasources>


(note: I hide the ip and user/psw here in the post, they're correctly setted on the xml)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 21, 2006 5:20 am 
Beginner
Beginner

Joined: Thu Apr 20, 2006 11:51 am
Posts: 44
here're the screenshot of eclipse and Jboss with the hibernate tool
http://i3.tinypic.com/w15sw7.gif
http://i3.tinypic.com/w15t2o.gif

I need to use jndi


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 21, 2006 5:21 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
ok you are not listening, and i won't answer more questions if you keep claiming you have a datasource available inside your eclipse.

Do as i suggested (use a normal jdbc url connection), since the datasource is *not* available from inside your eclipse.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 21, 2006 5:25 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
jndi is not supported directly from the query console.

do you understand that ?

and why can you not get a connection to the database when you can via your datasource ? The query console is not intended for usage within production systems, it is used for testing and development.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 21, 2006 5:36 am 
Beginner
Beginner

Joined: Thu Apr 20, 2006 11:51 am
Posts: 44
hy
don't be angry.. I've tought maybe you haven't understood my problem because my english is bad!
I don't want to do the same question over and over again.. excuse me for this. It's hard 4 me to explain my problem in english.
So you say me I can't use that jndi configuration with the Hibernate tool on eclipse..
so I can must do something like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.password">xxx</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@19x.xxx.xxx.xxx:1521:orcl</property>
<property name="hibernate.connection.username">xxx</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
</session-factory>
</hibernate-configuration>

I try to do that but the tool is stopped on "fetching childern on database"
as you can see in this screen
http://i3.tinypic.com/w15wnn.gif
I wait but nothing.... it doesn't see anything.
I'm angry because it's from 2days I try to solve this problem... and for a moment it's work an I've seen the db table but few minutes later (I don't know what I've changed) it again did not work.
Thanks 4 your patinet.
Alain


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 21, 2006 5:43 am 
Beginner
Beginner

Joined: Thu Apr 20, 2006 11:51 am
Posts: 44
Hy
With this configuration now it works ok. I can see tha tables.
If I can I would ask why that doesn't work with the jndi?
excuse me I'm a newbie on Eclipse and on Hibernate.
Since a week I've used only netbeans
thanks 4 your time
Alain


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 21, 2006 5:49 am 
Beginner
Beginner

Joined: Thu Apr 20, 2006 11:51 am
Posts: 44
It's maybe that the Tools can't resolve the jndi name and so it can't see the DB?
So when I deploy the webapp on the server I can change the normal connection with a jndi datasource and it works?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 21, 2006 5:56 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
yes

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 16 posts ]  Go to page 1, 2  Next

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.