users@glassfish.java.net

Re: orm.xml not being used? (either ignored or ValidationException)

From: Sanjeeb Kumar Sahoo <Sanjeeb.Sahoo_at_Sun.COM>
Date: Wed, 31 Jan 2007 13:31:46 +0530

Hi Tom,

Can you check if there are multiple mapping files by that name? The
error message seem to suggest that. You can check by writing something
like
Thread.getContextClassLoader().getResources("/META-INF/mappings.xml")
and seeing how many values are returned.
I also think there is another issue here. I don't think you should be
using /META-INF/mappings.xml as the <mapping-file>. It should be
META-INF/persistence (without the leading '/'). So, there may be another
bug here.

Thanks,
Sahoo

Marina Vatkina wrote:
> It can be part of this bug:
> https://glassfish.dev.java.net/issues/show_bug.cgi?id=1234
>
> The mapping descriptors are read using getResourceAsStream (as per the
> spec requirement) so if there are more than one file name
> META-INF/mappings.xml on your classpath, the provider doesn't know
> which one to use, and reports a problem.
>
> thanks,
> -marina
>
> Gordon Yorke wrote:
>> Hello Tom,
>> Have you attempted any other settings, perhaps updating the table
>> name of one of the entities to determine if it is a problem with
>> TopLink finding the orm.xml or if it is a problem with the default
>> schema name specifically. The XML appears correct, please file a bug
>> report.
>> --Gordon
>>
>> -----Original Message-----
>> From: Tom Mutdosch [mailto:tommut_at_gmail.com]On Behalf Of Tom Mutdosch
>> Sent: Tuesday, January 30, 2007 9:15 AM
>> To: users_at_glassfish.dev.java.net
>> Subject: orm.xml not being used? (either ignored or ValidationException)
>>
>>
>> Hi all,
>>
>> I am having a problem with my orm.xml not being found in a JSF web
>> application running on Glassfish (glassfish-installer-v2-b32.jar).
>>
>> I have entities that I am persisting to a DB2 database, and I want to
>> set the default schema. Rather than setting the schema annotation on
>> every Java entity, I want to specify it in the orm.xml file. The path
>> is /META-INF/orm.xml (next to persistence.xml) and it looks like:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>
>> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm
>> orm_1_0.xsd"
>> version="1.0">
>> <persistence-unit-metadata>
>> <persistence-unit-defaults>
>> <schema>ADMINISTRATOR</schema>
>> </persistence-unit-defaults>
>> </persistence-unit-metadata>
>> </entity-mappings>
>>
>> However when I try to execute a query on my entity, I get a DB2 error as
>> it is still incorrectly using the default DB2 schema, and not the one I
>> specified:
>> com.ibm.db2.jcc.c.SqlException: DB2 SQL error: SQLCODE: -204, SQLSTATE:
>> 42704, SQLERRMC: DB2ADMIN.DEPARTMENT
>>
>> I then tried to place the mapping information in a separate
>> /META-INF/mappings.xml and pointed to it from my persistence.xml:
>> <mapping-file>/META-INF/mappings.xml</mapping-file>
>>
>> In this case, when I run on the server I get the following exception:
>> Exception [TOPLINK-7252] (Oracle TopLink Essentials - 9.1 (Build b32)):
>> oracle.toplink.essentials.exceptions.ValidationException
>> Exception Description: There are multiple mapping files called
>> [/META-INF/mappings.xml] in classpath for persistence unit named [ pu ].
>>
>> Does anyone know what might be causing this?
>>
>> Thanks
>> Tom
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>