finder method runtime exception

I'm trying to create a CMP EJB. I create my Customer bean with a single finder method (findByPrimaryKey) and deploy it to the Sun Reference EE Server and everything works fine.

However, when I create a second finder method: findAll(), specify it's EJB-QL statement, and redeploy I get the following error message:

java.lang.RuntimeException: no method found for XML query element

I suspect that there's a problem with the deployment descriptor. Can anyone help?

Charlie Waddington

[522 byte] By [c_waddington] at [2007-9-19]
# 1

You're right, you're missing the query in the DD.

Every finder except for findByPrimaryKey must have an EJBQL string declared in its DD.

<entity>

<display-name>Test</display-name>

<ejb-name>Test</ejb-name>

<home>com.me.TestRemoteHome</home>

<remote>com.me.TestRemote</remote>

<local-home>com.me.TestHome</local-home>

<local>com.me.Test</local>

<ejb-class>com.me.TestBean</ejb-class>

<persistence-type>Container</persistence-type>

<prim-key-class>java.lang.Integer</prim-key-class>

<reentrant>False</reentrant>

<abstract-schema-name>test</abstract-schema-name>

<cmp-field>

<field-name>pkFIeld</field-name>

</cmp-field>

<cmp-field>

<field-name>dataOne</field-name>

</cmp-field>

<cmp-field>

<field-name>dataTwo</field-name>

</cmp-field>

<query>

<query-method>

<method-name>findAll</method-name>

<method-params/>

</query-method>

<ejb-ql>SELECT OBJECT(o) FROM test AS o</ejb-ql>

</entity>

- Seth Osher

> I'm trying to create a CMP EJB. I create my Customer

> bean with a single finder method (findByPrimaryKey)

> and deploy it to the Sun Reference EE Server and

> everything works fine.

>

> However, when I create a second finder method:

> findAll(), specify it's EJB-QL statement, and redeploy

> I get the following error message:

>

> java.lang.RuntimeException: no method found for XML

> query element

>

> I suspect that there's a problem with the deployment

> descriptor. Can anyone help?

>

> Charlie Waddington

set_ipicorp at 2007-7-5 > top of java,Enterprise & Remote Computing,Enterprise Technologies...
# 2

Thanks. You've confirmed what I thought. It looks like there's a bug in the v1.3 deploytool where it doesn't correctly create the deployment descriptor for a finder method. Updating to version 1.3.1 seems to fix the problem.

I've posted the duke dollars to your account. Thanks again.

Charlie

c_waddington at 2007-7-5 > top of java,Enterprise & Remote Computing,Enterprise Technologies...