Discussion:
[Middlegen-user] deployment fails (bad jbosscmp-jdbc.xml?)
Ta'id Holmes
2002-04-07 08:36:03 UTC
Permalink
Hello!

I would like to use Middlegen for educational purposes so that students can
concentrate on writing Session-Beans and EJB-Clients - and so far I am very
satisfied with what Middlegen together with the help of XDoclet already does,
so the generated Java-sourcecode should be all right for our purposes with the
latest CVS version of Middlegen!

However, there seems to be a problem with the generated jbosscmp-jdbc.xml
and/or ejb-jar.xml as the following exception occurs while deploying
2002-04-07 10:55:42,353 ERROR [org.jboss.ejb.EntityContainer] Exception in
service lifecyle operation: create
org.jboss.deployment.DeploymentException: Role: onetable-has-anothertable
with multiplicity many using foreign-key mapping is not allowed to have
key-fields
I did not have a detailed look where the problem might be, but just to make
a guess: could the order of the two <ejb-relationship-role> containers just
simply be messed up?
It would be nothing but just fantastic if this remaining bug could be fixed.
Thanks for the great tool!

Greetings,
...
Ta'id
`-Ž
P.S.: If you need some more information (f.i. the SQL-Script (for PostgreSQL))
just contact me!
--
email: ***@swt.tuwien.ac.at
homepage: http://taid.holmes.at/
PGP Public-Key: https://taid.holmes.at/tholmes.public.gpg
Aslak Hellesøy
2002-04-07 10:24:02 UTC
Permalink
Hi Ta'id,

(cc'ed to xdoclet-user)

Although Middlegen has support for JBoss (by including @jboss:blabla tags in
the generated sourcecode), it relies on XDoclet to generate proper
JBoss-specific deployment descriptors. I'm not a JBoss user myself (I
currently only work with WebLogic Server for EJBs), so I haven't tested that
Middlegen generated stuff deploys on JBoss.

I have successfully deployed quite complex stuff with all kinds of
combinations of cardinality and directionality on WebLogic Server, so I'm
quite confident that the ejb-jar.xml is OK.

The problem here is that XDoclet's JBoss code is not thoroughly tested, and
there is little I can do about that as I'm not familiar with JBoss. I only
looked at the @jboss docs in XDoclet and make Middlegen generate code that
seems OK according to those docs.

Here is a proposed strategy to make Middlegen/XDoclet work with JBoss. (I'm
not planning to do it though. Someone else will have to).
1) Consult the JBoss docs (and mailing lists) and find out the exact reason
why JBoss chokes. The XDoclet generated jbosscmp-jdbc.xml is probably wrong.
2) Try to edit the generated jbosscmp-jdbc.xml manually until your code
deploys properly.

Now you have identified what XDoclet does wrong.

3) Post your EJB with the @jboss tags to xdoclet-***@lists.sourceforge.net
(or the XDoclet SF bug/patches page if you feel that's more appropriate)
along with a description about what's wrong, and how it should be. If you
have a clue about XDoclet internals and an idea about where the bug is,
we'll be happy if you suggest a fix. If not, it will probably take some more
time before the bug gets fixed.

It is of course possible that Middlegen generates bad @jboss tags, and that
the jbosscmp-jdbc.xml is wrong because of this, but I think that there are
problems with JBoss CMP/CMR in XDoclet anyway (from what I have seen on the
lists).

Hope this helps,
Aslak
-----Original Message-----
Holmes
Sent: 7. april 2002 12:35
Subject: [Middlegen-user] deployment fails (bad jbosscmp-jdbc.xml?)
Hello!
I would like to use Middlegen for educational purposes so that
students can
concentrate on writing Session-Beans and EJB-Clients - and so far
I am very
satisfied with what Middlegen together with the help of XDoclet
already does,
so the generated Java-sourcecode should be all right for our
purposes with the
latest CVS version of Middlegen!
However, there seems to be a problem with the generated jbosscmp-jdbc.xml
and/or ejb-jar.xml as the following exception occurs while deploying
2002-04-07 10:55:42,353 ERROR [org.jboss.ejb.EntityContainer]
Exception in
service lifecyle operation: create
onetable-has-anothertable
with multiplicity many using foreign-key mapping is not
allowed to have
key-fields
I did not have a detailed look where the problem might be, but
just to make
a guess: could the order of the two <ejb-relationship-role>
containers just
simply be messed up?
It would be nothing but just fantastic if this remaining bug
could be fixed.
Thanks for the great tool!
Greetings,
...
Ta'id
`-´
P.S.: If you need some more information (f.i. the SQL-Script (for
PostgreSQL))
just contact me!
--
homepage: http://taid.holmes.at/
PGP Public-Key: https://taid.holmes.at/tholmes.public.gpg
Steve Knight
2002-04-07 13:13:06 UTC
Permalink
I believe the problem is that JBoss relation stuff has changed (again!)
since the last version of Middlegen came out. You will have to check the
latest DTD for jbosscmp-jdbc.xml to see what needs to be changed (ie.
foreign-key mapping, key-fields, etc.)

Steve


----- Original Message -----
From: "Ta'id Holmes" <tholmes+***@iaeste.or.at>
To: <middlegen-***@lists.sourceforge.net>
Sent: Sunday, April 07, 2002 6:35 AM
Subject: [Middlegen-user] deployment fails (bad jbosscmp-jdbc.xml?)
Aslak Hellesøy
2002-04-07 13:35:04 UTC
Permalink
I think it's XDoclet who's guilty of generating bad jbosscmp-jdbc.xml. I'm
not familiar with JBoss, nor the XDoclet code that generates JBoss stuff, so
someone please fix this. The I believe the JBoss community is the biggest
XDoclet customer, so someone please keep up with them. David, Dim?

I don't see that Middlegen is the problem here (unless it's insering bad
@jboss:relation tags). The current Middlegen CVS version inserts
@jboss:relation tags according to the current docs for @jboss:relation in
CVS. I can't do anything better than that.

(cc is sent to xdoclet-devel and David and Dim who implemented XDoclet's
JBoss support)

Aslak
-----Original Message-----
Knight
Sent: 7. april 2002 17:15
Subject: Re: [Middlegen-user] deployment fails (bad jbosscmp-jdbc.xml?)
I believe the problem is that JBoss relation stuff has changed (again!)
since the last version of Middlegen came out. You will have to check the
latest DTD for jbosscmp-jdbc.xml to see what needs to be changed (ie.
foreign-key mapping, key-fields, etc.)
Steve
----- Original Message -----
Sent: Sunday, April 07, 2002 6:35 AM
Subject: [Middlegen-user] deployment fails (bad jbosscmp-jdbc.xml?)
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
Ta'id Holmes
2002-04-13 06:10:14 UTC
Permalink
Hello everyone!

I am very glad to report that I might have great news for you and our
Middlegen/XDoclet/JBoss users (emphasising on the last part) out there
as I think I did some steps forward (also in our quest for Middlegen 1.1 :-)).

First let me say that I am working with
a Middlegen (incl. XDoclet) CVS version not older than one week
the latest JBoss 3.0.0beta2 from CVS
PostgreSQL 7.1.3 with JDBC-Driver 7.2-1

I analysed the DTD with the jbosscmp-jdbc.xml generated by
XDoclet; compared it with the (known to be correct) ejb-jar.xml and
played around for myself till it deployed!

Here is an example for an <ejb-relation> container in jbosscmp-jdbc.xml
generated by XDoclet (which causes the jar not to deploy):

<ejb-relation>
<ejb-relation-name>contact-person</ejb-relation-name>
<foreign-key-mapping/>
<ejb-relationship-role>
<ejb-relationship-role-name>person-has-contact</ejb-relationship-role-name>
<key-fields>
<key-field>
<field-name>firstname,lastname</field-name>
<column-name>firstname,lastname</column-name>
</key-field>
</key-fields>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>contact-has-person</ejb-relationship-role-name>
<fk-constraint>true</fk-constraint>
</key-fields>
</ejb-relationship-role>
</ejb-relation>


And here is what I created out of it (one nasty thing: both are valid
structures regarding the latest DTD - although you could easily guess what to
do with the comma-separated field-names):

<ejb-relation>
<ejb-relation-name>contact-person</ejb-relation-name>
<foreign-key-mapping/>
<ejb-relationship-role>
<ejb-relationship-role-name>person-has-contact</ejb-relationship-role-name>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>contact-has-person</ejb-relationship-role-name>
<fk-constraint>true</fk-constraint>
<key-fields>
<key-field>
<field-name>firstname</field-name>
<column-name>firstname</column-name>
</key-field>
<key-field>
<field-name>lastname</field-name>
<column-name>lastname</column-name>
</key-field>
</key-fields>
</ejb-relationship-role>
</ejb-relation>

So the key-fields moved to the second <ejb-relationship-role> (I _had_ such
a feeling in the beginning, didn't I?).

So far so good.
After trying again however new exceptions popped up (_this_ might be JBoss'
fault - I had not a look at EJB-QL in detail):

[org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.Person.findAll]
EJB-QL: SELECT DISTINCT OBJECT(o) FROM Person
[org.jboss.ejb.EntityContainer]
Exception in service lifecyle operation: start
org.jboss.deployment.DeploymentException: Error compiling ejbql; -
nested throwable is: org.jboss.ejb.plugins.cmp.ejbql.ParseException:
Encountered "<EOF>" at line 1, column 37.
Was expecting one of:
"AS" ...
<IDENTIFIER> ...


To make life easier I deleted all <query> parts in ejb-jar.xml and _then_
everything deployed fine. I also made some small tests with an EJB-Client.
CMP 2.0 does work! (also the find-methods - as this is done by JBoss)

So far a report from my side. Now it's up to you ;-) :
XDoclet-Developers:
create a patch for writing correct <ejb-relation> (*)
Middlegen-Developers:
have a nice weekend :-)
(after that you might want to have a look at the EJB-Queries)

Hope to have served the community. Thanks again for your hard work!

Greetings,
...
Ta'id
`-Ž
(*) my try does work - although it's guessed empiric . If you are able
to find some real specification (the closed source one might be the only
chance) on this subject use that - however I was not even able to find any
(up to date) documentation from any third party on the net.
--
email: ***@users.sourceforge.net
homepage: http://taid.holmes.at/
PGP Public-Key: write any mail to taid+***@holmes.at or get it at
https://taid.holmes.at/tholmes.public.gpg
Loading...