• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

about resource reference for ejb

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


in ejb-jar.xml,
......
<resource-ref>
<description>DataSource for db<description>
<res-ref-name>jdbc/JZHDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

In Deployment Descriptor has already generated DataSource (jdni is JZHDB)

(NOTE:they were automatic generated by jbuilder5 entitybean wizard

below is my Client.java
..............
InitialContext c1=new InitialContext();
DataSource ds=(DataSource)c1.lookup("jdbc/JZHDB"); //<======Client.java:28 line
Connection n1=ds.getConnection();
......................
when running,generated following exception
org.omg.CORBA.OBJECT_NOT_EXIST: minor code: 0 completed: No
at java.lang.Class.newInstance0(Native Method)
at java.lang.Class.newInstance(Class.java:237)
at com.inprise.vbroker.orb.SE.read(SE.java:28)
at com.inprise.vbroker.orb.DelegateImpl.handleReply(DelegateImpl.java:711)
at com.inprise.vbroker.orb.DelegateImpl.invoke(DelegateImpl.java:606)
at org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:297)
at com.inprise.vbroker.orb.RequestImpl._invoke(RequestImpl.java:195)
at com.inprise.vbroker.orb.RequestImpl.invoke(RequestImpl.java:130)
at org.omg.CosNaming._NamingContextStub.resolve(_NamingContextStub.java:156)
at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:324)
at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:373)
at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:351)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at hav1.Client.main(Client.java:28)
pls ask, how to solve?
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is only a guess (I don't know what JBuilder's wizards do) but neither the deployment descriptor of the EJB nor the reference on the client side actually CREATE the DataSource. They both simply reference a DataSource that must be created separately in the application server. My guess is you haven't created the DataSource inside your app server.
Kyle
------------------
Kyle Brown,
Author of Enterprise Java (tm) Programming with IBM Websphere
See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.
 
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Suggestion:
1. you need use your app server to configurate a datasource.
2. The part of the full name of the data source is determined by your app server. So I am not sure: jdbc/JZHDB is correct ?
Best luck.
Ruilin
 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should probably try the following:
ctx.lookup("java:comp/env/jdbc/JZHDB") if you created a reference especially for that bean. Otherwise the datasource does not exist, if the posted JNDI name is the real name of the
entry.
------------------
Marco Barenkamp
____________________________________________
L M I N T E R N E T S E R V I C E S AG
Senior Trainer & Architect,
BEA Certified Enterprise Developer
Sun Certified Programmer for the Java2 Platform
Sun Certified Web Component Developer for the Java2 Platform
Sun Certified Developer for the Java 2 Platform
Sun Certified Enterprise Architect for the Java 2 Platform Enterprise Edition (PI)
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic