• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Core Java Server Faces 2 - Database (Ch 5) example, not working

 
Camilo Morales
Ranch Hand
Posts: 92
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey ranchers,

I'm kinda new in this technology and thats why Im reading this great book. I'm in chapter 5 and trying to run the Database example, but Glassfish keeps telling me that he can not find the Database that the CustomerBeans is looking up. I am VERY VERY noob in glassfish (how I miss you JBoss) but since all the examples are made to work with Netbeans and Glassfish, I thought that this was a great opportunity to get to know this two products. (I normally work with Eclipse and JBoss).

Anyway ... when I saw the lookup to the databse in the CustomerBean class, I thought (I hoped) that this database was like HiperSonic in JBoss, I mean, that it comes inside the AS, but the NameNotBound exception is telling that Glassfish can not find the database.

Here is the lookup I'm telling you:

DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/mydb");


Could anyone tell me if I have to deploy the DB descriptor (and install a DB in my pc), and if so ,,, where should I put the descriptor (where is the JBoss_Root\server\default\deploy directory in Glassfish ??) ??

Thanks ranchers,
 
Freddy Wong
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure if this can help you since I don't have any Core JavaServer Faces book. But I've used glassfish and NetBeans for quite some time.

If you want to configure the JDBC inside glassfish, you need to login to admin console, and then click Resources->JDBC Resources. Create a new JDBC resources. By default, the Derby connection pool has already been configured.

Hope this helps.
 
Mark Spritzler
ranger
Sheriff
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or you can change the datasource to use defaultDS and just copy the war file into the deploy directory of your JBoss instance.

Mark
(Jboss employee)
 
Camilo Morales
Ranch Hand
Posts: 92
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you both for your replies.

Yeah, with JBoss I just deleted the resource-ref from the web.xml and change the lookup to java:/DefaultDS and it works perfectly. Anyway, it was mission imposible to make it run in Glassfish ... I guess Im still on the beginning of the learning curve for this product.

Regards,
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic