Menu

#152 Exception in DTD generation

v2.2
closed-fixed
None
5
2008-08-17
2007-09-06
jondi
No

When trying to create a DTD with the construct:

FlatDtdDataSet.write(connection.createDataSet(), new FileOutputStream("add_core.dtd"));

I get the following exception:

06-Sep-2007 15:02:49 com.sun.enterprise.appclient.MainWithModuleSupport <init>
WARNING: ACC003: Application threw an exception.
org.dbunit.dataset.NoColumnsFoundException: XDB$ACL
at org.dbunit.database.DatabaseTableMetaData.getColumns(DatabaseTableMetaData.java:226)
at org.dbunit.dataset.xml.FlatDtdWriter.write(FlatDtdWriter.java:81)
at org.dbunit.dataset.xml.FlatDtdDataSet.write(FlatDtdDataSet.java:79)
at org.dbunit.dataset.xml.FlatDtdDataSet.write(FlatDtdDataSet.java:69)
at TestDbExport.main(TestDbExport.java:23)
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:597)
at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:232)
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:329)
at com.sun.enterprise.appclient.Main.main(Main.java:180)
Exception in thread "main" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:340)
at com.sun.enterprise.appclient.Main.main(Main.java:180)
Caused by: java.lang.reflect.InvocationTargetException
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:597)
at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:232)
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:329)
... 1 more
Caused by: org.dbunit.dataset.NoColumnsFoundException: XDB$ACL
at org.dbunit.database.DatabaseTableMetaData.getColumns(DatabaseTableMetaData.java:226)
at org.dbunit.dataset.xml.FlatDtdWriter.write(FlatDtdWriter.java:81)
at org.dbunit.dataset.xml.FlatDtdDataSet.write(FlatDtdDataSet.java:79)
at org.dbunit.dataset.xml.FlatDtdDataSet.write(FlatDtdDataSet.java:69)
at TestDbExport.main(TestDbExport.java:23)
... 7 more

In the dtd-file the generated data stops at a spesific table EMM_TARGETS like this:

<!ELEMENT EMM_TARGETS EMPTY>
<!ATTLIST EMM_TARGETS
ID CDATA #REQUIRED
VERSION CDATA #REQUI

The database is an oracle XE, and the creation-script used for this table is:

create table emm_targets(
id integer not null primary key,
version integer not null,
address integer not null unique,
emm_target_type varchar2(1) not null check(emm_target_type in ('A','G')),
a_kms_agent_group_id integer,
a_group_member_index integer check(a_group_member_index >= 0),
a_activated integer check(a_activated in (0,1)),
g_group_size integer check(g_group_size > 0),
unique(a_kms_agent_group_id,a_group_member_index),
check(emm_target_type <> 'A' or (a_kms_agent_group_id is not null and a_group_member_index is not null and a_activated is not null)),
check(emm_target_type <> 'G' or g_group_size is not null)
);

Can you please give some advice?

Discussion

  • Roberto Lo Giacco

    Logged In: YES
    user_id=57511
    Originator: NO

    can you please try the dtd generation again using the latest from repository and enabling the debug logging so we can have more informations to work on? and please attach the log instead of pasting it...

    thank you

     
  • matthias g

    matthias g - 2008-07-13

    TestDtdGeneration.java

     
  • matthias g

    matthias g - 2008-07-13

    Logged In: YES
    user_id=1803108
    Originator: NO

    Hi jondi, Roberto,

    I successfully tested it on an oracle XE having the schema name set in the DatabaseConnection constructor ("new DatabaseConnection(jdbcConn, "MYSCHEMA"). When I omit the schema name I can see the same exception as you do ("org.dbunit.dataset.NoColumnsFoundException: XDB$ACL").
    Moreover I can see a dbunit warning now: "WARNING - XDB$ACL.SYS_NC_ROWINFO$ data type (1111, 'XMLTYPE') not recognized and will be ignored. See FAQ for more information."

    So I think you can solve this by specifying the schema name. Please let me know if that works for you. I will look at the "NoColumnsFoundException" so that the export does not fail when a table does not have any columns. Perhaps we need some discussions about the "NoColumnsFoundException" and if this is a proper way to tell the user that dbunit did not find any columns for a table...

    Regards,
    mat
    File Added: TestDtdGeneration.java

     
  • matthias g

    matthias g - 2008-07-13

    Logged In: YES
    user_id=1803108
    Originator: NO

    I looked into this behaviour and found out that the "ITableMetaData.getColumns()" implementation in "DatabaseTableMetaData.getColumns()" does not behave consistently to all of the other implementations of this method. It throws a "NoColumnsFoundException" instead of just returning an empty array of columns. So basically the contract of this method is broken (whereas the contract's behaviour is not documented at all in the interface...). Does anybody know why this exception is thrown? It is in the explicitly checked in the unit test so there must have been a reason for this (I guess).

    Nevertheless I propose to change the implementation of "DatabaseTableMetaData.getColumns()" to simply return an empty array of columns if no column has been found (that is supported by dbunit). I would also like to add this information to the javadocs of the interface so that the contract is clearly defined.

    Please let me know your opinions on this.

    regards,
    mat

     
  • matthias g

    matthias g - 2008-07-14

    Logged In: YES
    user_id=1803108
    Originator: NO

    Hi all,

    I committed the bugfix (rev. 720/trunk) for this issue and changed the behaviour of method "DatabaseTableMetaData.getColumns()" which now returns an empty "Column[]" array if no columns have been detected for a table.

    Please let me know if you think that this might impact some other functionality that was based on the exception that was formerly thrown.

    Regards,
    mat

     
  • matthias g

    matthias g - 2008-07-14
    • status: open --> open-fixed
     
  • matthias g

    matthias g - 2008-08-02

    Logged In: YES
    user_id=1803108
    Originator: NO

    Set to pending. Still waiting for feedback. I suppose that it is resolved in 2.3.0 with the below mentioned commit.

     
  • matthias g

    matthias g - 2008-08-02
    • status: open-fixed --> pending-fixed
     
  • SourceForge Robot

    • status: pending-fixed --> closed-fixed
     
  • SourceForge Robot

    Logged In: YES
    user_id=1312539
    Originator: NO

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     

Log in to post a comment.

MongoDB Logo MongoDB