I have this entity bean, MEMBER. I have created a findByName that passes in a memberId (primary key). memberId is a CMP. the return type is a collection so i can create a DTO/Facade. My
ejb ql statement looks like this:
SELECT OBJECT(m) FROM Member m WHERE m.memberId = ?1
I have a testClient with this code in the main.
MemberTestClient1 client = new MemberTestClient1();
try {
Integer memberId = new Integer("1");
Collection c = client.findByName(memberId);
Iterator i = c.iterator();
while (i.hasNext()) {
MemberRemote mcr = (MemberRemote)PortableRemoteObject.narrow(i.next(),MemberRemote.class);
System.out.println("member first name = " + mcr.getFName());
System.out.println("member last name = " +mcr.getLName());
}
} catch (Exception ex) {
ex.getStackTrace();
System.out.println("Exception = " + ex);
I can not see anything wrong with the ejb ql statement. I have looked over the ejb-jar.xml and the ejb-borland.xml for anything that looks out of place - found nothing. I add another entity bean and make code corrections so two entity beans are used during the DTO/facade. The error is the same - it does not seem to like Member???
Help ... Any ideas???
The error I receive is:
java.rmi.ServerException: java.rmi.RemoteException: [line 1, col 23] <identifier> expected, but 'MEMBER' found; nested exception is:
com.borland.ejb.ql.QueryError: [line 1, col 23] <identifier> expected, but 'MEMBER' found
at com.inprise.ejb.EJBHome$RemoteStrategyImpl.getSystemException(EJBHome.java:851)
at com.inprise.ejb.Dispatcher.doInvoke(Dispatcher.java:1407)
at com.inprise.ejb.Dispatcher.invokeSecurityCheck(Dispatcher.java:1023)
at com.inprise.ejb.Dispatcher.invoke(Dispatcher.java:816)
at com.inprise.ejb.Dispatcher.find(Dispatcher.java:695)
at com.inprise.ejb.EntityHome.doFind(EntityHome.java:221)
at com.inprise.ejb.EntityHome.find(EntityHome.java:235)
at com.inprise.ejb.EJBHome.invoke(EJBHome.java:369)
at com.inprise.ejb.EJBHome.access$300(EJBHome.java:6)
at com.inprise.ejb.EJBHome$RemoteStrategyImpl.invoke(EJBHome.java:740)
at member.MemberRemoteHomePOAInvokeHandler.findByName(MemberRemoteHomePOAInvokeHandler.java:75)
at member.MemberRemoteHomePOAInvokeHandler.findByName(MemberRemoteHomePOAInvokeHandler.java:116)
at member.MemberRemoteHomePOA._invoke(MemberRemoteHomePOA.java:102)
at member.MemberRemoteHomePOA._invoke(MemberRemoteHomePOA.java:44)
at com.inprise.vbroker.poa.POAImpl.invoke(POAImpl.java:2693)
at com.inprise.vbroker.poa.ActivationRecord.invoke(ActivationRecord.java:109)
at com.inprise.vbroker.poa.ServerInterceptorManager$ARWrapper.invoke(ServerInterceptorManager.java:110)
at com.inprise.vbroker.GIOP.GiopProtocolAdapter.doRequest(GiopProtocolAdapter.java:824)
at com.inprise.vbroker.IIOP.ServerProtocolAdapter.doRequest(ServerProtocolAdapter.java:68)
at com.inprise.vbroker.GIOP.GiopProtocolAdapter.dispatchMessage(GiopProtocolAdapter.java:1106)
at com.inprise.vbroker.orb.TPDispatcherImpl$TPDispatcher.run(TPDispatcherImpl.java:106)
at com.inprise.vbroker.orb.ThreadPool$PoolWorker.run(ThreadPool.java:76)
Caused by: com.borland.ejb.ql.QueryError: [line 1, col 23] <identifier> expected, but 'MEMBER' found
at com.borland.ejb.ql.QueryError.raiseQueryError(QueryError.java:144)
at com.borland.ejb.ql.QueryError.differentSymbolExpected(QueryError.java:44)
at com.borland.ejb.ql.Parser.expectError(Parser.java:769)
at com.borland.ejb.ql.Parser.accept(Parser.java:764)
at com.borland.ejb.ql.Parser.ident(Parser.java:745)
at com.borland.ejb.ql.Parser.id_var_decl(Parser.java:301)
at com.borland.ejb.ql.Parser.select_stmt(Parser.java:125)
at com.borland.ejb.ql.Parser.parseSQL(Parser.java:84)
at com.borland.ejb.ql.QueryTranslater.translate(QueryTranslater.java:38)
at com.borland.ejb.pm.JdbcQlFinder.translateQuery(JdbcQlFinder.java:195)
at com.borland.ejb.pm.JdbcEntityManager.prepareJdbcQlFinder(JdbcEntityManager.java:460)
at com.borland.ejb.pm.JdbcEntityManager.getFinder(JdbcEntityManager.java:316)
at com.borland.ejb.pm.JdbcEntityManager.findCollection(JdbcEntityManager.java:828)
at com.borland.ejb.pm.JdbcEntityManager.findCollection(JdbcEntityManager.java:815)
at member.MemberBean_PM.ejbFindByName(MemberBean_PM.java:71)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.inprise.ejb.ConcreteMethod.invoke(ConcreteMethod.java:32)
at com.inprise.ejb.EJBContext.invoke(EJBContext.java:166)
at com.inprise.ejb.Dispatcher.doInvoke(Dispatcher.java:1301)
... 20 more
; nested exception is:
java.rmi.RemoteException: [line 1, col 23] <identifier> expected, but 'MEMBER' found; nested exception is:
com.borland.ejb.ql.QueryError: [line 1, col 23] <identifier> expected, but 'MEMBER' found-- Failed: findByName(1)
at member._MemberRemoteHome_Stub.findByName(_MemberRemoteHome_Stub.java:346)
at member.MemberTestClient1.findByName(MemberTestClient1.java:90)
at member.MemberTestClient1.main(MemberTestClient1.java:828)
Caused by: java.rmi.RemoteException: [line 1, col 23] <identifier> expected, but 'MEMBER' found; nested exception is:
com.borland.ejb.ql.QueryError: [line 1, col 23] <identifier> expected, but 'MEMBER' found
at com.inprise.vbroker.orb.DelegateImpl.handleReply(DelegateImpl.java:850)
at com.inprise.vbroker.orb.DelegateImpl.invoke(DelegateImpl.java:689)
at org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:457)
at member._MemberRemoteHome_Stub.findByName(_MemberRemoteHome_Stub.java:255)
... 2 more
Caused by: com.borland.ejb.ql.QueryError: [line 1, col 23] <identifier> expected, but 'MEMBER' found
at com.borland.ejb.ql.QueryError.raiseQueryError(QueryError.java:144)
at com.borland.ejb.ql.QueryError.differentSymbolExpected(QueryError.java:44)
at com.borland.ejb.ql.Parser.expectError(Parser.java:769)
at com.borland.ejb.ql.Parser.accept(Parser.java:764)
at com.borland.ejb.ql.Parser.ident(Parser.java:745)
at com.borland.ejb.ql.Parser.id_var_decl(Parser.java:301)
at com.borland.ejb.ql.Parser.select_stmt(Parser.java:125)
at com.borland.ejb.ql.Parser.parseSQL(Parser.java:84)
at com.borland.ejb.ql.QueryTranslater.translate(QueryTranslater.java:38)
at com.borland.ejb.pm.JdbcQlFinder.translateQuery(JdbcQlFinder.java:195)
at com.borland.ejb.pm.JdbcEntityManager.prepareJdbcQlFinder(JdbcEntityManager.java:460)
at com.borland.ejb.pm.JdbcEntityManager.getFinder(JdbcEntityManager.java:316)
at com.borland.ejb.pm.JdbcEntityManager.findCollection(JdbcEntityManager.java:828)
at com.borland.ejb.pm.JdbcEntityManager.findCollection(JdbcEntityManager.java:815)
at member.MemberBean_PM.ejbFindByName(MemberBean_PM.java:71)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.inprise.ejb.ConcreteMethod.invoke(ConcreteMethod.java:32)
at com.inprise.ejb.EJBContext.invoke(EJBContext.java:166)
at com.inprise.ejb.Dispatcher.doInvoke(Dispatcher.java:1301)
at com.inprise.ejb.Dispatcher.invokeSecurityCheck(Dispatcher.java:1023)
at com.inprise.ejb.Dispatcher.invoke(Dispatcher.java:816)
at com.inprise.ejb.Dispatcher.find(Dispatcher.java:695)
at com.inprise.ejb.EntityHome.doFind(EntityHome.java:221)
at com.inprise.ejb.EntityHome.find(EntityHome.java:235)
at com.inprise.ejb.EJBHome.invoke(EJBHome.java:369)
at com.inprise.ejb.EJBHome.access$300(EJBHome.java:6)
at com.inprise.ejb.EJBHome$RemoteStrategyImpl.invoke(EJBHome.java:740)
at member.MemberRemoteHomePOAInvokeHandler.findByName(MemberRemoteHomePOAInvokeHandler.java:75)
at member.MemberRemoteHomePOAInvokeHandler.findByName(MemberRemoteHomePOAInvokeHandler.java:116)
at member.MemberRemoteHomePOA._invoke(MemberRemoteHomePOA.java:102)
at member.MemberRemoteHomePOA._invoke(MemberRemoteHomePOA.java:44)
at com.inprise.vbroker.poa.POAImpl.invoke(POAImpl.java:2693)
at com.inprise.vbroker.poa.ActivationRecord.invoke(ActivationRecord.java:109)
at com.inprise.vbroker.poa.ServerInterceptorManager$ARWrapper.invoke(ServerInterceptorManager.java:110)
at com.inprise.vbroker.GIOP.GiopProtocolAdapter.doRequest(GiopProtocolAdapter.java:824)
at com.inprise.vbroker.IIOP.ServerProtocolAdapter.doRequest(ServerProtocolAdapter.java:68)
at com.inprise.vbroker.GIOP.GiopProtocolAdapter.dispatchMessage(GiopProtocolAdapter.java:1106)
at com.inprise.vbroker.orb.TPDispatcherImpl$TPDispatcher.run(TPDispatcherImpl.java:106)
at com.inprise.vbroker.orb.ThreadPool$PoolWorker.run(ThreadPool.java:76)
-- Return value from findByName(1): null.
Exception = java.lang.NullPointerException