• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

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

 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,
 
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic