facebook

Problem with deployment descriptors [Closed]

  1. MyEclipse Archived
  2.  > 
  3. Application Servers and Deployment
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #219373 Reply

    nraponi
    Member

    Hoping this is the correct section to post this in…

    Please excuse what is probably a stupid question – but as I don’t know the answer…

    I am created an entity EJB and using XDoclet to do it (first time I’ve tried this). I’ve added the EJB XDoclet support and also the JBOSS support and actually have the bean working fine, its accessible from a JSP page and I can store data and use findAll() to retrieve data.

    My next step was to try and implement a custom finder method. I get the following error when deploying:-

    Bean : SimpleBean
    Method : public abstract Collection findByName(String) throws FinderException, RemoteException
    Section: 10.5.6
    Warning: Every finder method except findByPrimaryKey(key) must be associated with a query element in the deployment descriptor.

    I’ve determined that my problem is that the xdoclet @jboss.*** tags I am putting in my bean are being ignored and hence I am not getting the required query in my jboss deployment file.

    I have the following in my bean file:-

    * @jboss.finder-query name=”findByName” query=”name like ‘%?1%'”
    * @ejb.finder
    * signature=”java.util.Collection findByName(String name)”
    * query=”SELECT OBJECT(e) FROM SimpleBeanEJB AS e where e.name like ‘%?1%'”
    * transaction-type=”Supports”

    The ejb.finder is working but the jboss.finder-query doesn’t seem to be processed. I recognise that the actual query may not yet be syntactically correct, but I’d have at least expected the @jboss.finder-query tag to put the query in so that I can get a message telling me this.

    Do I need to do anything further to tell XDoclet to process this tag, or have I missed something?

    Thanks for any help
    Nick

    #219384 Reply

    Scott Anderson
    Participant

    Nick,

    Did you add the jboss xdoclet subtask to the project on the xdoclet configuration page? There’s a description on doing this in the EJB tutorial available in the Documentation section here: http://myeclipseide.com/ContentExpress-display-ceid-67.html

    #219391 Reply

    nraponi
    Member

    Hi Scott,
    Thanks for the thought but I did do this, the jboss and jbosscmp descriptors are being created.

    JBoss.XML contains

    <?xml version=”1.0″ encoding=”UTF-8″?>
    <!DOCTYPE jboss PUBLIC “-//JBoss//DTD JBOSS 4.0//EN” “http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd”&gt;

    <jboss>

    <enterprise-beans>

    <!–
    To add beans that you have deployment descriptor info for, add
    a file to your XDoclet merge directory called jboss-beans.xml that contains
    the <session></session>, <entity></entity> and <message-driven></message-driven>
    markup for those beans.
    –>

    <entity>
    <ejb-name>SimpleBean</ejb-name>
    <jndi-name>ejb/SimpleBeanHome</jndi-name>
    <local-jndi-name>ejb/SimpleBeanLocalHome</local-jndi-name>

    <method-attributes>
    </method-attributes>

    </entity>

    <session>
    <ejb-name>BusinessLogicSessionBean</ejb-name>
    <jndi-name>ejb/BusinessLogicSessionBeanHome</jndi-name>
    <local-jndi-name>ejb/BusinessLogicSessionBeanLocalHome</local-jndi-name>

    <method-attributes>
    </method-attributes>
    </session>

    </enterprise-beans>

    <resource-managers>
    </resource-managers>

    <!–
    | for container settings, you can merge in jboss-container.xml
    | this can contain <invoker-proxy-bindings/> and <container-configurations/>
    –>

    </jboss>

    and jbosscmp-jdbc.XML contains:

    <?xml version=”1.0″ encoding=”UTF-8″?>
    <!DOCTYPE jbosscmp-jdbc PUBLIC “-//JBoss//DTD JBOSSCMP-JDBC 4.0//EN” “http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_4_0.dtd”&gt;

    <jbosscmp-jdbc>
    <defaults>
    <datasource>java:/MyDS</datasource>
    <datasource-mapping>mySQL</datasource-mapping>
    </defaults>

    <enterprise-beans>

    <!–
    To add beans that you have deployment descriptor info for, add
    a file to your XDoclet merge directory called jbosscmp-jdbc-beans.xml
    that contains the <entity></entity> markup for those beans.
    –>

    <entity>
    <ejb-name>SimpleBean</ejb-name>

    <table-name>tsimplebean</table-name>

    <cmp-field>
    <field-name>id</field-name>
    <column-name>fid</column-name>

    </cmp-field>
    <cmp-field>
    <field-name>name</field-name>
    <column-name>fname</column-name>

    </cmp-field>

    <!– jboss 3.2 features –>
    <!– optimistic locking does not express the exclusions needed –>
    </entity>

    </enterprise-beans>

    </jbosscmp-jdbc>

    This is what leads me to believe that for some reason my jboss finder delcaration is being missed.

    Thanks for your help
    Nick

    #219392 Reply

    nraponi
    Member

    Just to be sure I checked xdoclet-build.xml and it does contain:

    <jboss Version=”4.0″ datasource=”java:/MyDS” datasourceMapping=”mySQL” destDir=”src/META-INF” >
    </jboss>

    Nick

    #219417 Reply

    Scott Anderson
    Participant

    Nick,

    It seems you’re doing everything correctly. It might be a bug in the XDoclet support for the JBoss tags in the version we’ve included. A list of all those bugs is available here:
    http://opensource.atlassian.com/projects/xdoclet/secure/IssueNavigator.jspa?reset=true&mode=hide&summary=true&description=true&query=jboss

    I didn’t rigorously go through them all, but some seemed related.

    #219441 Reply

    nraponi
    Member

    Thanks Scott – I’ll take a look.

    I have updated the XDoclet support as per another message as I also wanted to deploy a different project to Weblogic.

    #219442 Reply

    nraponi
    Member

    Hi Scott,
    Thanks for that link – whilst it wasn’t the same problem the parting comment of http://opensource.atlassian.com/projects/xdoclet/browse/XDT-637 gives the answer.

    Basically “@jboss.finder-query is a JAWS thing (CMP 1.x). For CMP2.x use @jboss.query “.

    This has got the expected entries in the jbosscmp-jdbc.xml file, I’m still getting the error but at least its moved on some!

    Thanks again
    Nick

    #219444 Reply

    nraponi
    Member

    Arghhhhh, Arghhhhh, and more Arghhhhh.

    Found the problem. The jboss deployment descriptors weren’t the cause of the problem – just an interesting diversion.

    So that you know if it comes up again the problem was with the declaration of the parameter to the find method. I had declared it as String. Declaring it as java.lang.String fixed the error.

    Doh!

    Nick.

    #219456 Reply

    support-michael
    Keymaster

    @nraponi wrote:

    Hoping this is the correct section to post this in…

    Please excuse what is probably a stupid question – but as I don’t know the answer…

    I am created an entity EJB and using XDoclet to do it (first time I’ve tried this). I’ve added the EJB XDoclet support and also the JBOSS support and actually have the bean working fine, its accessible from a JSP page and I can store data and use findAll() to retrieve data.

    My next step was to try and implement a custom finder method. I get the following error when deploying:-

    Bean : SimpleBean
    Method : public abstract Collection findByName(String) throws FinderException, RemoteException
    Section: 10.5.6
    Warning: Every finder method except findByPrimaryKey(key) must be associated with a query element in the deployment descriptor.

    I’ve determined that my problem is that the xdoclet @jboss.*** tags I am putting in my bean are being ignored and hence I am not getting the required query in my jboss deployment file.

    I have the following in my bean file:-

    * @jboss.finder-query name=”findByName” query=”name like ‘%?1%'”
    * @ejb.finder
    * signature=”java.util.Collection findByName(String name)”
    * query=”SELECT OBJECT(e) FROM SimpleBeanEJB AS e where e.name like ‘%?1%'”
    * transaction-type=”Supports”

    The ejb.finder is working but the jboss.finder-query doesn’t seem to be processed. I recognise that the actual query may not yet be syntactically correct, but I’d have at least expected the @jboss.finder-query tag to put the query in so that I can get a message telling me this.

    Do I need to do anything further to tell XDoclet to process this tag, or have I missed something?

    Thanks for any help
    Nick

Viewing 9 posts - 1 through 9 (of 9 total)
Reply To: Problem with deployment descriptors [Closed]

You must be logged in to post in the forum log in