File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes SQLExcpetion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "SQLExcpetion" Watch "SQLExcpetion" New topic
Author

SQLExcpetion

Mihai Radulescu
Ranch Hand

Joined: Sep 18, 2003
Posts: 918

Hi
I use the eclipse 3.4 together with the Glassfish v2 and I try to use the example from EJB in action. And here I get an exception :

java.sql.SQLException: This pool is not registered with the runtime environment : null

I realy don't know why ?

Thanks in advance,
M


SCJP, SCJD, SCWCD, OCPJBCD
Marco Ehrentreich
best scout
Bartender

Joined: Mar 07, 2007
Posts: 1282

Hi Mihai,

in Glassfish (like in any other J2EE server) you can define database pools which then can be used by enterprise applications running on this server because it's more efficient to let the server handle database management and reuse existing connections if possible.

Unfortunately I can't tell you in detail how this is done with Glassfish and what kind and name of pool your application expects. But I'm pretty sure the book describes the necessary steps to configure the server environment for the examples (although I personally don't know this book).

Marco
[ September 25, 2008: Message edited by: Marco Ehrentreich ]
Mihai Radulescu
Ranch Hand

Joined: Sep 18, 2003
Posts: 918

Hi Marco,

Thanks for your answer, unfortunately the book does not provides information about this database pools, or I search on the wrong place.

All that I know is that I start the the database after I start the server, I start the database with teh asaadmin comand :


I do something wrong ?

Regards,
M
Sergio Tridente
Ranch Hand

Joined: Mar 22, 2007
Posts: 329

Originally posted by Mihai Radulescu:
All that I know is that I start the the database after I start the server, I start the database with teh asaadmin comand :


Have you tried starting the database before the application server?


SCJP 1.4 (88%) - SCJP 5.0 Upgrade (93%) - SCWCD 1.4 (97%) - SCBCD 5.0 (98%)
Marco Ehrentreich
best scout
Bartender

Joined: Mar 07, 2007
Posts: 1282

I think the problem is that you don't only have to start the database server but to create a database and configure a database pool for it in Glassfish. Glassfish provides the GUI for this task in its web interface. I've only tried this a few times but with an external database server like MySQL and PostgreSQL. For this I unfortunately don't know how you can manage the internal database server which you're obviously using.

Marco
Gaurav Totla
Greenhorn

Joined: Aug 23, 2004
Posts: 6
Hi Mihai

Couple of things-
1. EJB3 in action examples uses the Apache derby database by default.
2. Before running any example you need to start the database by Start > Programs > Sun Microsystems
> Application Server PE 9 > Start Java DB
3. It will start the database server on a new command prompt and you can press enter to run it in background.
4.Once you have started the server (Glassfish) and the database, you need to run the build file which is present at the top level folder of the source code i.e c:\ejb_3_in_action\code_examples.This will prepare data sources and JMS resources necessary for the database.
5. After doing this you can go to each chapter and run the specific build file.i.e cd chapter1 and ant.

I apologize if you have already followed these steps before posting the error.

Gaurav


SCJP 93%
Karnati Sudhakar
Ranch Hand

Joined: Aug 26, 2008
Posts: 270

Hi All,

Even I am using EJB 3 in Action examples.I am able to run these examples without any problem.I have NetBeans but i am not able to use the IDE for these examples.How do i make benefit of Netbeans for opening Ant projects(EJB 3 in Action)?

Regards
Sudhakar Karnati


Regards
Sudhakar
Mihai Radulescu
Ranch Hand

Joined: Sep 18, 2003
Posts: 918

Hi people

Thanks for your interest. An other detail - I am a linux user.
To deploy the example I use the ant runner together with the ant srcpit which i have from the author site.

Marco, can you direct me to this GUI (used to create a database and configure a database pool for it in Glassfish).



Sergio, I try already both combinations :

and


with the same effect :

java.sql.SQLException: This pool is not registered with the runtime environment : null



Gaurav, As I mention before I am linux user - the install routine under linux (KDE) does not adds such kind of menu entries. If you are a windows user can you take a look what exactly do the start database menu entry ?


Karnati, can you provide more details, like which platform, from where you have the ant scripts, etc.




Regards,
M
Karnati Sudhakar
Ranch Hand

Joined: Aug 26, 2008
Posts: 270

Karnati, can you provide more details, like which platform, from where you have the ant scripts, etc.


I am a windows user.You can run the examples downloaded from the Manning site,But you have to modify the SQL scripts that are shipped in with the examples.Those Sql scripts are in Oracle which derby does not support.

Regards
Sudhakar Karnati
Mihai Radulescu
Ranch Hand

Joined: Sep 18, 2003
Posts: 918

Karnati,

I don't hava any sql scripts, I get this exception when I try to deploy the example for the chapter 2. Here I ony add a single table (using JDBC).
Where are this scripts ? I don't have any of this kind.
From where you download you examples ?

Regards,
M
[ September 26, 2008: Message edited by: Mihai Radulescu ]
Karnati Sudhakar
Ranch Hand

Joined: Aug 26, 2008
Posts: 270

Where are this scripts ? I don't have any of this kind.


In chapters 3,4 &5 you will have these scripts in a folder called 'sql'.

Thanks
Sudhakar
Mihai Radulescu
Ranch Hand

Joined: Sep 18, 2003
Posts: 918

Karnati

how about the chapter 2 example ?
Karnati Sudhakar
Ranch Hand

Joined: Aug 26, 2008
Posts: 270

Mihai,

For running chapter 2 you dont have to run additonally any sql scripts as you have to for Chapters3,4 and 5.After you navigated to the chapter2 folder in the command prompt when you just type this 'ant' it will create all the tables required for the chapter2.

I am not sure what problem you are facing but i can tell you one thing.Just start the glassfish from by using this command start-domain domain1 in the asadmin. to do so you have set environment variable to J2EE_HOME to the directory of the glassfish directory.and then run the start-database.

Just login into the Admins console of glassfish and check for the connection pools you have bfore running any ant command for the examples.The EJB 3 in Action examples uses the connection pool DerbyPool. Make sure that it is present under connection pools.

I hope this helps if you still have problem just reply i will try to clarify your doubt.

Regards,
Sudhakar
Mihai Radulescu
Ranch Hand

Joined: Sep 18, 2003
Posts: 918

Karnati,

can you describe your Admin console for database pool - where in the Admin GUI I can find it ?

Regards
M
Karnati Sudhakar
Ranch Hand

Joined: Aug 26, 2008
Posts: 270

where in the Admin GUI I can find it ?


In the admin console expand resources and then JDBC and then Connection pools there you will see one connection pool Derby which is used by the EJB 3 in Action examples.

Regards
Sudhakar Karnati
Mihai Radulescu
Ranch Hand

Joined: Sep 18, 2003
Posts: 918

Hi Karnati,

I just start my database & server and I take a look on Resources->Connection Pools and here I have a DerbyPool, this gui has a ping function and this ping function works with my environment. but when I run the ant script for the chapter 2 I still get the
java.sql.SQLException: This pool is not registered with the runtime environment : null

Do I miss here something ?

Regards,
M
Karnati Sudhakar
Ranch Hand

Joined: Aug 26, 2008
Posts: 270

First run the ant scripts both at the directory level and chapter2 level and then log into the admin console of Glassfish and look for the JDBC resources created jdbc/ActionBazaarDS and jdbc/TurtleDS which should be created.and these resources should be mapped to the Derby Connection pool.

I am not sure if this solves your problem but it has to be the way i mentioned above.

Thanks
Sudhakar Karnati
Mihai Radulescu
Ranch Hand

Joined: Sep 18, 2003
Posts: 918

Karnati,

I get the exception on the deploy - I look on the domain log and here I have the the exception stack trace.

I don't know what I suppose to do - to try to bound other database pool - loke my SQL ?

Regards,
M
Mihai Radulescu
Ranch Hand

Joined: Sep 18, 2003
Posts: 918

Hi people,

I keep playing with my JPA application and I discover that the infamous :
java.sql.SQLException: This pool is not registered with the runtime environment : null
comes togheder with the following code snippet :



but I don't have any idea why.

My persistence.xml looks like :


any comments ??


Regards,
M
Sergio Tridente
Ranch Hand

Joined: Mar 22, 2007
Posts: 329

Have you defined your data source, jdbc/ItemManager?

In order to avoid complications, when I was practising for the exam I used the "default" data source (which comes preconfigured). This is my persistence.xml:



I hope that helps.
[ September 29, 2008: Message edited by: Sergio Tridente ]
Mihai Radulescu
Ranch Hand

Joined: Sep 18, 2003
Posts: 918

Hi Sergio

You was right (again) the key was the data source, or better the XML node :


for a few minutes I just find this by my self by reading some documentation about the data-source (and persistence.xml).
From this point of view the "EJB in action" is a little bit to superficial - it lets you to search a lot of complementary information without even to point you the right direction, of course this make a lot of fun but it cost you also a lot of time (resources).

Well it works (& I understand also why it works) and this is the most important.
What I don't unedrstand is how it works on the others without to define the data-set ?

Regards (and thanks once more),
M
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SQLExcpetion