Dear all,
I can run the create method successully but when I try to run the find method, the client got the following message:
got a context
did the narrow
org.omg.CORBA.UNKNOWN: vmcid: 0x0 minor code: 0 completed: Maybe
at com.sun.corba.ee.internal.core.UEInfoServiceContext.<init>(UEInfoServiceContext.java:36)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27
)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at com.sun.corba.ee.internal.core.ServiceContextData.makeServiceContext(ServiceContextData.java:115)
at com.sun.corba.ee.internal.core.ServiceContexts.<init>(ServiceContexts.java:110)
When I open the
j2ee server log ($J2EE_HOME\logs\mcqapp_lab1\j2ee\j2ee\error.log), the file shows:
ejb20Finder method = public abstract java.util.Collection headfirst.CustomerHome.findByCreditLimit(double) throws javax.ejb.FinderException,java.rmi.RemoteException
ejb20Finder ejbql = SELECT OBJECT(o) FROM CustomerBeanTable AS o WHERE o.limit = ?1
ejb20Finder query = sql not generated yet
javax.ejb.EJBException: nested exception is: SQL Exception: Syntax error: Encountered "sql" at line 1, column 1.
SQL Exception: Syntax error: Encountered "sql" at line 1, column 1.
at c8e.p.i._f1(Unknown Source)
at c8e.p.q._b84(Unknown Source)
at c8e.p.q.handleException(Unknown Source)
at c8e.p.n.handleException(Unknown Source)
at c8e.p.p.handleException(Unknown Source)
at c8e.p.g.<init>(Unknown Source)
at c8e.ct.a.<init>(Unknown Source)
at c8e.ct.e.newLocalPreparedStatement(Unknown Source)
at c8e.p.n.prepareStatement(Unknown Source)
at c8e.ct.e.prepareStatement(Unknown Source)
at c8e.p.n.prepareStatement(Unknown Source)
It seems there is something wrong in the EJB-SQL select statement, however,
the ejb application passed the Verifer checking. Anyone know how to solve problem? Please help. Thank you.
--- Development environment
OS: NT4.0 with sp 6
j2se ver: 1.4.2_03
j2ee ver: 1.3.1
ejb
IDE:
java deploytool
database: java/cloudscape
--- Deployment Descriptor
<ejb-jar>
<display-name>Ejb1</display-name>
<enterprise-beans>
<entity>
<display-name>CustomerBean</display-name>
<ejb-name>CustomerBean</ejb-name>
<home>headfirst.CustomerHome</home>
<remote>headfirst.Customer</remote>
<ejb-class>headfirst.CustomerBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>CustomerBeanTable</abstract-schema-name>
<cmp-field>
<description>no description</description>
<field-name>last</field-name>
</cmp-field>
<cmp-field>
<description>no description</description>
<field-name>limit</field-name>
</cmp-field>
<cmp-field>
<description>no description</description>
<field-name>first</field-name>
</cmp-field>
<cmp-field>
<description>no description</description>
<field-name>custAddress</field-name>
</cmp-field>
<cmp-field>
<description>no description</description>
<field-name>pK</field-name>
</cmp-field>
<primkey-field>pK</primkey-field>
<security-identity>
<description></description>
<use-caller-identity></use-caller-identity>
</security-identity>
<query>
<description></description>
<query-method>
<method-name>findByCreditLimit</method-name>
<method-params>
<method-param>double</method-param>
</method-params>
</query-method>
<ejb-ql>SELECT OBJECT(o) FROM CustomerBeanTable AS o WHERE o.limit = ?1</ejb-ql>
</query>
</entity>
</enterprise-beans>
--- CustomerHome.java source
package headfirst;
import javax.ejb.*;
import java.rmi.RemoteException;
import java.util.Collection;
public interface CustomerHome extends EJBHome {
public Customer create(
String last, String first, String addr, String ID) throws CreateException, RemoteException;
public Customer findByPrimaryKey(String key) throws FinderException, RemoteException;
public Collection findByCreditLimit(double greaterThanAmt) throws FinderException, RemoteException;
}
--- CustomerClient.java source
Context ic = new InitialContext();
System.out.println("got a context");
Object o = ic.lookup("Customer");
System.out.println("got an object" + o);
CustomerHome home = (CustomerHome) PortableRemoteObject.narrow(o, CustomerHome.class);
System.out.println("did the narrow");
Collection collection = home.findByCreditLimit(100.00);
System.out.println("did the find");