Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Aghh - J2EE BMP Enterprise Beans with Microsoft Access???

0 views
Skip to first unread message

Adam Retter

unread,
Mar 20, 2003, 11:25:31 AM3/20/03
to
Please please please help, this is driving me crazy!

Im trying to use a Microsoft Access Database from J2EE Bean Managed
Persistence (BMP) Enterprise Java Beans, and its not working :-[

Im doing a Java course but our lecturer has been absent until very recently
and however his lectures seem to cover general java concepts rather than
practical implementation, ive spent the last two weeks tearing my hair out
over deploying EJB's - but that works now :-)

Okay my platform is - Together 6.0.1, Sun JDK 1.3, Sun J2EE 1.3 Reference
Implementation.

I have created a series of Entity and Session beans, basically empty classes
at the moment, I am now trying to call one of my EJB's and have it return a
record from a database. At the moment I am having trouble making my EJB's
talk to my Microsoft Access Database.

What I have done so far -

1.) Setup a System DSN in ODBC called JAuction that points to my access
database.

2.) Using the Deployment Tool that is bundled with J2EE -
Tools -> Server Configuration -> DataSources -> Standard

Here I added a new driver class sun.jdbc.odbc.JdbcOdbcDriver

I also added a new datasource -
JNDI Name: jdbc/JAuction
JDBC URL: jdbc:odbc:JAuction

3.) I have a 'UserBean' whoose JNDI name i set to 'UserHome' in the
deployment settings I also give it the resource reference -
Coded Name: jdbc/JAuction
Type: javax.sql.DataSource
Authentication: Container
Shareable: [Ticked]
JNDI Name: jdbc/JAuction
Username: [blank]
Password: [blank]

4.) I verify and deploy my beans to the server using the deployment tool
which all works fine.

However if I call the create method of UserBean from my client app, UserBean
tries to connect to the database and I get an Exception thrown and I dont
know why.

My Client (JFrame1) throws this exception data -

org.omg.CORBA.UNKNOWN: minor code: 0 completed: Maybe
at
com.sun.corba.ee.internal.core.UEInfoServiceContext.<init>(UEInfoServiceCont
ext.java:36)
at java.lang.reflect.Constructor.newInstance(Native Method)
at
com.sun.corba.ee.internal.core.ServiceContextData.makeServiceContext(Service
ContextData.java:115)
at
com.sun.corba.ee.internal.core.ServiceContexts.<init>(ServiceContexts.java:1
10)
at
com.sun.corba.ee.internal.iiop.messages.ReplyMessage_1_2.read(ReplyMessage_1
_2.java:120)
at
com.sun.corba.ee.internal.iiop.IIOPInputStream.unmarshalHeader(IIOPInputStre
am.java:126)
at
com.sun.corba.ee.internal.iiop.IIOPConnection.getResponse(IIOPConnection.jav
a:671)
at
com.sun.corba.ee.internal.iiop.IIOPOutputStream.invoke(IIOPOutputStream.java
:124)
at
com.sun.corba.ee.internal.iiop.ClientRequestImpl.invoke(ClientRequestImpl.ja
va:79)
at
com.sun.corba.ee.internal.corba.ClientDelegate.invoke(ClientDelegate.java:23
2)
at
com.sun.corba.ee.internal.POA.GenericPOAClientSC.invoke(GenericPOAClientSC.j
ava:96)
at org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:454)
at _UserHome_Stub.create(Unknown Source)
at JFrame1.<init>(JFrame1.java:40)
at JFrame1.main(JFrame1.java:69)


The Sun J2EE RI Server shows this in error.log

java.rmi.RemoteException: nested exception is: javax.ejb.EJBException:
nested exception is:
javax.naming.NameNotFoundException;nested exception is:
javax.ejb.EJBException: nested exception is:
javax.naming.NameNotFoundException
javax.ejb.EJBException: nested exception is:
javax.naming.NameNotFoundException
javax.naming.NameNotFoundException
<<no stack trace available>>
javax.ejb.EJBException: nested exception is:
javax.naming.NameNotFoundException
at UserBean.setEntityContext(UserBean.java:51)
at
com.sun.ejb.containers.EntityContainer.getPooledEJB(EntityContainer.java:123
9)
at
com.sun.ejb.containers.EntityContainer.getContext(EntityContainer.java:197)
at
com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:365)
at UserBean_RemoteHomeImpl.create(UserBean_RemoteHomeImpl.java:22)
at _UserBean_RemoteHomeImpl_Tie._invoke(Unknown Source)
at
com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatchToServant(GenericPO
AServerSC.java:520)
at
com.sun.corba.ee.internal.POA.GenericPOAServerSC.internalDispatch(GenericPOA
ServerSC.java:210)
at
com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatch(GenericPOAServerSC
.java:112)
at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:255)
at
com.sun.corba.ee.internal.iiop.RequestProcessor.process(RequestProcessor.jav
a:84)
at
com.sun.corba.ee.internal.orbutil.ThreadPool$PooledThread.run(ThreadPool.jav
a:99)


The code that tries to connect to my ODBC source of my EJB 'UserBean' Entity
Bean is as follows -

public void setEntityContext(javax.ejb.EntityContext context) throws
javax.ejb.EJBException
{
ctx = context;

try
{
InitialContext initCtx = new InitialContext();

DataSource dataSource =
(DataSource)initCtx.lookup("java.comp/env/jdbc/JAuction");

connection = dataSource.getConnection();

}
catch(NamingException namingEx)
{
throw new EJBException(namingEx);
}
catch(SQLException sqlEx)
{
throw new EJBException(sqlEx);
}
}


Thanks Thanks and Thanks again I really need help with this one

Adam.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.463 / Virus Database: 262 - Release Date: 17/03/2003


agreatham

unread,
Mar 21, 2003, 4:44:19 PM3/21/03
to
"Adam Retter" <ad...@cosmic.org.uk> wrote in message news:<1Ylea.5374$Gk6....@newsfep4-glfd.server.ntli.net>...

> DataSource dataSource =
> (DataSource)initCtx.lookup("java.comp/env/jdbc/JAuction");

Shouldn't that be "java:comp/env/jdbc/JAuction" ?

Adam Retter

unread,
Mar 21, 2003, 9:13:57 PM3/21/03
to
Thank You very much :-)

Yes that was a problem, a typo that ive been staring at too closely!
But not the last problem unfortunately...

I now get a RemoteException on the client side, and in the J2EE RI error.log
I get - (again any ideas appreciated)

Warning: Username/password not specified for resource reference
jdbc/JAuction
javax.ejb.EJBException: nested exception is: java.lang.NullPointerException
java.lang.NullPointerException
at UserBean.ejbCreate(UserBean.java:200)
at UserBean_RemoteHomeImpl.create(UserBean_RemoteHomeImpl.java:24)


at _UserBean_RemoteHomeImpl_Tie._invoke(Unknown Source)
at
com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatchToServant(GenericPO
AServerSC.java:520)
at
com.sun.corba.ee.internal.POA.GenericPOAServerSC.internalDispatch(GenericPOA
ServerSC.java:210)
at
com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatch(GenericPOAServerSC
.java:112)
at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:255)
at
com.sun.corba.ee.internal.iiop.RequestProcessor.process(RequestProcessor.jav
a:84)
at
com.sun.corba.ee.internal.orbutil.ThreadPool$PooledThread.run(ThreadPool.jav
a:99)

javax.ejb.EJBException: nested exception is: java.lang.NullPointerException
at
com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.ja
va:1558)
at
com.sun.ejb.containers.BaseContainer.checkExceptionNoTx(BaseContainer.java:1
407)
at
com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:1267)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:403)
at UserBean_RemoteHomeImpl.create(UserBean_RemoteHomeImpl.java:30)


at _UserBean_RemoteHomeImpl_Tie._invoke(Unknown Source)
at
com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatchToServant(GenericPO
AServerSC.java:520)
at
com.sun.corba.ee.internal.POA.GenericPOAServerSC.internalDispatch(GenericPOA
ServerSC.java:210)
at
com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatch(GenericPOAServerSC
.java:112)
at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:255)
at
com.sun.corba.ee.internal.iiop.RequestProcessor.process(RequestProcessor.jav
a:84)
at
com.sun.corba.ee.internal.orbutil.ThreadPool$PooledThread.run(ThreadPool.jav
a:99)

java.rmi.RemoteException: nested exception is:
java.lang.NullPointerException; nested exception is:
java.lang.NullPointerException
java.lang.NullPointerException
at UserBean.ejbCreate(UserBean.java:200)
at UserBean_RemoteHomeImpl.create(UserBean_RemoteHomeImpl.java:24)


at _UserBean_RemoteHomeImpl_Tie._invoke(Unknown Source)
at
com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatchToServant(GenericPO
AServerSC.java:520)
at
com.sun.corba.ee.internal.POA.GenericPOAServerSC.internalDispatch(GenericPOA
ServerSC.java:210)
at
com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatch(GenericPOAServerSC
.java:112)
at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:255)
at
com.sun.corba.ee.internal.iiop.RequestProcessor.process(RequestProcessor.jav
a:84)
at
com.sun.corba.ee.internal.orbutil.ThreadPool$PooledThread.run(ThreadPool.jav
a:99)

"agreatham" <agre...@hotmail.com> wrote in message
news:96a0c1f.03032...@posting.google.com...

0 new messages