You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Andrey Tedeev <te...@hotmail.com> on 2008/03/30 09:17:05 UTC
complex geronimo-web.xml problem
Hello y'all.
Here is a standalone geronimo-web.xml I 'm using to deploy my web app.
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns='http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1'>
<dep:environment
xmlns:dep='http://geronimo.apache.org/xml/ns/deployment-1.2'>
<dep:moduleId>
<dep:groupId>ssi.web</dep:groupId>
<dep:artifactId>equipment-aaf</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>war</dep:type>
</dep:moduleId>
<dep:dependencies>
<dep:dependency>
<dep:groupId>com.ibm</dep:groupId>
<dep:artifactId>jtopen</dep:artifactId>
<dep:version>6.1</dep:version>
<dep:type>jar</dep:type>
</dep:dependency>
<dep:dependency>
<dep:groupId>org.apache.openjpa</dep:groupId>
<dep:artifactId>openjpa</dep:artifactId>
<dep:version>1.0.2</dep:version>
<dep:type>jar</dep:type>
</dep:dependency>
<!--
<dep:dependency>
<dep:groupId>ssi</dep:groupId>
<dep:artifactId>ssi-api</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>jar</dep:type>
</dep:dependency>
-->
<dep:dependency>
<dep:groupId>console.dbpool</dep:groupId>
<dep:artifactId>jdbc%2FAAF</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>rar</dep:type>
</dep:dependency>
</dep:dependencies>
</dep:environment>
<context-root>/aaf/equipment</context-root>
<security-realm-name>realm-SSLIB</security-realm-name>
<security xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0">
<default-principal realm-name="realm-SSLIB">
<principal name="anonymous"
class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal"/>
</default-principal>
<role-mappings>
<role role-name="equipment-user">
<realm realm-name="realm-SSLIB">
<principal name="ADMIN"
class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"/>
</realm>
<realm realm-name="realm-SSLIB">
<principal name="AAF"
class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"/>
</realm>
</role>
</role-mappings>
</security>
<nam:resource-ref xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
<nam:ref-name>jdbc/ds</nam:ref-name>
<nam:resource-link>jdbc/AAF</nam:resource-link>
</nam:resource-ref>
<jpa:persistence version="1.0"
xmlns:jpa='http://java.sun.com/xml/ns/persistence'>
<jpa:persistence-unit name="equipment-pu" transaction-type="JTA">
<jpa:provider>org.apache.openjpa.persistence.PersistenceProviderImpl</jpa:provider>
<jpa:jta-data-source>jdbc%2FAAF</jpa:jta-data-source>
<jpa:non-jta-data-source>jdbc%2FAAF</jpa:non-jta-data-source>
<jpa:class>ssi.api.jpa.company.Description</jpa:class>
<jpa:class>ssi.api.jpa.company.Equipment</jpa:class>
<jpa:class>ssi.api.jpa.company.EquipmentMaintanence</jpa:class>
<jpa:class>ssi.api.jpa.company.EquipmentMaintanenceType</jpa:class>
<jpa:class>ssi.api.jpa.company.EquipmentType</jpa:class>
<jpa:exclude-unlisted-classes>true</jpa:exclude-unlisted-classes>
<jpa:properties>
<jpa:property name="openjpa.Log" value="DefaultLevel=TRACE, Tool=INFO,
SQL=TRACE"/>
<jpa:property name="openjpa.jdbc.DBDictionary"
value="ssi.api.jpa.AS400Dictionary"/>
<!--
<jpa:property name="openjpa.jdbc.SynchronizeMappings" value="validate"/>
<jpa:property name="openjpa.jdbc.TransactionIsolation" value="none"/>
<jpa:property name="openjpa.LockManager" value="none"/>
<jpa:property name="openjpa.ConnectionRetainMode" value="always"/>
<jpa:property name="openjpa.FlushBeforeQueries" value="true"/>
-->
</jpa:properties>
</jpa:persistence-unit>
</jpa:persistence>
</web-app>
Deployimg it using geronimo-maven-plugin and having this error (cut a part
of maven log)
error: cvc-complex-type.2.4a: Expected elements
'service@http://geronimo.apache.org/xml/ns/deployment-1.2
persistence@http://java.sun.com/xml/ns/persistence' instead of
'security-realm-name@http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1'
here
error: cvc-complex-type.2.4a: Expected elements
'service@http://geronimo.apache.org/xml/ns/deployment-1.2
persistence@http://java.sun.com/xml/ns/persistence' instead of
'security@http://geronimo.apache.org/xml/ns/security-2.0' here
Descriptor:
<xml-fragment
xmlns:tom="http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1">
<dep:environment
xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
<dep:moduleId>
<dep:groupId>ssi.web</dep:groupId>
<dep:artifactId>equipment-aaf</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>war</dep:type>
</dep:moduleId>
<dep:dependencies>
<dep:dependency>
<dep:groupId>com.ibm</dep:groupId>
<dep:artifactId>jtopen</dep:artifactId>
<dep:version>6.1</dep:version>
<dep:type>jar</dep:type>
</dep:dependency>
<dep:dependency>
<dep:groupId>org.apache.openjpa</dep:groupId>
<dep:artifactId>openjpa</dep:artifactId>
<dep:version>1.0.2</dep:version>
<dep:type>jar</dep:type>
</dep:dependency>
<!--<dep:dependency>
<dep:groupId>ssi</dep:groupId>
<dep:artifactId>ssi-api</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>jar</dep:type>
</dep:dependency>-->
<dep:dependency>
<dep:groupId>console.dbpool</dep:groupId>
<dep:artifactId>jdbc%2FAAF</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>rar</dep:type>
</dep:dependency>
</dep:dependencies>
</dep:environment>
<tom:context-root>/aaf/equipment</tom:context-root>
<nam:resource-ref
xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
<nam:ref-name>jdbc/ds</nam:ref-name>
<nam:resource-link>jdbc/AAF</nam:resource-link>
</nam:resource-ref>
<jpa:persistence version="1.0"
xmlns:jpa="http://java.sun.com/xml/ns/persistence">
<jpa:persistence-unit name="equipment-pu" transaction-type="JTA">
<jpa:provider>org.apache.openjpa.persistence.PersistenceProviderImpl</jpa:provider>
<jpa:jta-data-source>jdbc%2FAAF</jpa:jta-data-source>
<jpa:non-jta-data-source>jdbc%2FAAF</jpa:non-jta-data-source>
<jpa:class>ssi.api.jpa.company.Description</jpa:class>
<jpa:class>ssi.api.jpa.company.Equipment</jpa:class>
<jpa:class>ssi.api.jpa.company.EquipmentMaintanence</jpa:class>
<jpa:class>ssi.api.jpa.company.EquipmentMaintanenceType</jpa:class>
<jpa:class>ssi.api.jpa.company.EquipmentType</jpa:class>
<jpa:exclude-unlisted-classes>true</jpa:exclude-unlisted-classes>
<jpa:properties>
<jpa:property name="openjpa.Log" value="DefaultLevel=TRACE,
Tool=INFO, SQL=TRACE"/>
<jpa:property name="openjpa.jdbc.DBDictionary"
value="ssi.api.jpa.AS400Dictionary"/>
<!--<jpa:property name="openjpa.jdbc.SynchronizeMappings"
value="validate"/>
<jpa:property name="openjpa.jdbc.TransactionIsolation" value="none"/>
<jpa:property name="openjpa.LockManager" value="none"/>
<jpa:property name="openjpa.ConnectionRetainMode" value="always"/>
<jpa:property name="openjpa.FlushBeforeQueries" value="true"/>-->
</jpa:properties>
</jpa:persistence-unit>
</jpa:persistence>
<tom:security-realm-name>realm-SSLIB</tom:security-realm-name>
<sec:security xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0">
<sec:role-mappings>
<sec:role role-name="equipment-user">
<sec:principal name="ADMIN"
class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"/>
<sec:principal name="AAF"
class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"/>
</sec:role>
</sec:role-mappings>
</sec:security>
</xml-fragment>
I tried the same with schema validation (posting just header of same xml
above):
<?xml version="1.0" encoding="UTF-8"?>
<web:web-app xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:web='http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1'
xmlns:nam='http://geronimo.apache.org/xml/ns/naming-1.2'
xmlns:app='http://geronimo.apache.org/xml/ns/j2ee/application-2.0'
xmlns:dep='http://geronimo.apache.org/xml/ns/deployment-1.2'
xmlns:jpa='http://java.sun.com/xml/ns/persistence'
xsi:schemaLocation='http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1
http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1
http://geronimo.apache.org/xml/ns/naming-1.2
http://geronimo.apache.org/xml/ns/naming-1.2
http://geronimo.apache.org/xml/ns/j2ee/application-2.0
http://geronimo.apache.org/xml/ns/j2ee/application-2.0
http://geronimo.apache.org/xml/ns/deployment-1.2
http://geronimo.apache.org/xml/ns/deployment-1.2
http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd'>
..........
The same result - don't validate.
And looks like problem is that in schema @
http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1
it is declared that resource-ref and persistence should go at the end of
file. AFTER security tags declaration. So i really did in my xml. But if you
look at maven log you'll see that on deploy
those parts just changed (by deploy?????) and don't validate.
I marked parts we are interested in bold.
Any thoughts how to solve it?
--
View this message in context: http://www.nabble.com/complex-geronimo-web.xml-problem-tp16379211s134p16379211.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
Re: complex geronimo-web.xml problem
Posted by David Jencks <da...@yahoo.com>.
In regards to the original issue of this post, I've opened
GERONIMO-3944
to track fixing it.
thanks
david jencks
On Mar 30, 2008, at 11:18 AM, Andrey Tedeev wrote:
>
> Thanks for reply. G-mo 2.1 is used. Unfortunately I have to put
> persistence
> unit into geronimo-web.xml . In our company each customer has their
> own
> schema on AS400 becasue
> of security issues. So I have bunch of different datasources
> pointing to
> appropriate schema.
> Layout of database is the same in each case. I tried to use
> resource-ref but
> geronimo returnserror about JTA datasource like in this post:
>
> http://www.nabble.com/Problem-with-persistence.xml-%28how-to-use-
> data-source-%29-td16380414s134.html
>
>
>
>
>
> djencks wrote:
>>
>> This is definitely a bug in geronimo that we need to fix before the
>> next release. Can you tell us which geronimo version you are using?
>> There's a slight chance it has been fixed already and I've forgotten
>> about it.
>>
>> As a workaround I think you can just include all the persistence
>> information in a persistence.xml file at an appropriate location in
>> your app.
>>
>> BTW, you need different datasources for jta-datasource and non-jta-
>> datasource. The jta-datasource should have <local-transaction/> or
>> <xa-transaction><transaction-caching/></xa-transaction> and the non-
>> jta-datasource should have <no-transaction/>
>>
>> I can't get derby to work without 2 datasources. I don't know about
>> other databases, but using the same transactional datasource for non-
>> jta-datasource is almost certain to lead to trouble.
>> Can you suggest some way of documenting this so people are likely to
>> find it? Maybe we should refuse to accept the same datasource for
>> both....
>>
>> thanks
>> david jencks
>> On Mar 30, 2008, at 12:57 AM, Andrey Tedeev wrote:
>>
>>>
>>> Also I need to add that same xml works just fine if I do one of the
>>> following:
>>>
>>> 1. Delete part describing security -realm and security
>>> but leave resource-ref and jpa alone
>>>
>>> 2. Delete resourse-ref and jpa declaration but leave security alone.
>>>
>>>
>>> So problem rises when I try to use all of those together.
>>>
>>>
>>> --
>>> View this message in context: http://www.nabble.com/complex-
>>> geronimo-web.xml-problem-tp16379211s134p16379399.html
>>> Sent from the Apache Geronimo - Users mailing list archive at
>>> Nabble.com.
>>>
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/complex-
> geronimo-web.xml-problem-tp16379211s134p16385215.html
> Sent from the Apache Geronimo - Users mailing list archive at
> Nabble.com.
>
Re: complex geronimo-web.xml problem
Posted by David Jencks <da...@yahoo.com>.
On Mar 30, 2008, at 2:58 PM, Andrey Tedeev wrote:
>
> oops. It was deploying only because I accidentally put it into WEB-INF
> instead of META-INF.
> So persistence unit was not just found. As soon as i put it in
> right place
> META-INF/persistence.xml
> it will produce same error Unable to resolve reference
> "JtaDataSourceWrapper".
> So this way doesn't work either.
>
>
I didn't think it would :-)
In geronimo the jta-datasource and non-jta-datasource don't have
anything to do with jndi, so a resource-ref element won't help
resolve them. They directly relate to the name in the datasource plan.
So with your resource ref element I think you have some datasources
named
jdbc-jta-AAF
jdbc-non-jta-AAF
Your persistence.xml (in META-INF) ought to work if it contains these
names:
<jta-data-source>jdbc-jta-AAF</jta-data-source
<non-jta-data-source> jdbc-non-jta-AAF </non-jta-data-source>
You don't need the resource-ref elements at all for the jpa stuff.
Hope this gets it working :-)
david jencks
>
>
> Andrey Tedeev wrote:
>>
>> OK. I have found a WORKING solution (at least application deploys
>> without
>> any errors)
>>
>> I cut persistence block from geronimo-web.xml and paste it into
>> WEB-INF/persistence.xml
>>
>> It looks not like this (interested parts in bold)
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/
>> persistence"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
>> http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
>> <persistence-unit name="equipment-pu">
>>
>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</
>> provider>
>> <jta-data-source>jdbc-jta-ds</jta-data-source>
>> <non-jta-data-source>jdbc-non-jta-ds</non-jta-data-source>
>> <!-- ssi.api.jpa.company -->
>> <class>ssi.api.jpa.company.Description</class>
>> <class>ssi.api.jpa.company.Equipment</class>
>> <class>ssi.api.jpa.company.EquipmentMaintanence</class>
>> <class>ssi.api.jpa.company.EquipmentMaintanenceType</class>
>> <class>ssi.api.jpa.company.EquipmentType</class>
>> <properties>
>> <property name="openjpa.Log" value="DefaultLevel=TRACE,
>> Tool=TRACE,
>> SQL=INFO"/>
>> <property name="openjpa.jdbc.DBDictionary"
>> value="ssi.api.jpa.AS400Dictionary"/>
>> </properties>
>> </persistence-unit>
>> </persistence>
>>
>>
>> Then in geronimo-web.xml I have this references :
>>
>> <nam:resource-ref
>> xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
>> <nam:ref-name>jdbc-jta-ds</nam:ref-name>
>> <nam:resource-link>jdbc-jta-AAF</nam:resource-link>
>> </nam:resource-ref>
>>
>> <nam:resource-ref
>> xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
>> <nam:ref-name>jdbc-non-jta-ds</nam:ref-name>
>> <nam:resource-link>jdbc-non-jta-AAF</nam:resource-link>
>> </nam:resource-ref>
>>
>> Now it seems to be deploying. though i did not test real work yet
>> using
>> @PersistenceContext
>>
>> I hope it will be helpfull to guys having same problem as
>>
>> http://www.nabble.com/Problem-with-persistence.xml-%28how-to-use-
>> data-source-%29-td16380414s134.html
>>
>>
>> Really that was the point where i went to inserting persistence
>> unit into
>> geronimo-web.xml
>>
>>
>> djencks wrote:
>>>
>>> I don't have time to explain in detail right now but you may be able
>>> to use the "datasource-switching" idea as in the roller plugin to
>>> use
>>> the same persistence.xml for everyone and a different separately
>>> deployed datasource.
>>>
>>> more later
>>> david jencks
>>>
>>> On Mar 30, 2008, at 11:18 AM, Andrey Tedeev wrote:
>>>
>>>>
>>>> Thanks for reply. G-mo 2.1 is used. Unfortunately I have to put
>>>> persistence
>>>> unit into geronimo-web.xml . In our company each customer has their
>>>> own
>>>> schema on AS400 becasue
>>>> of security issues. So I have bunch of different datasources
>>>> pointing to
>>>> appropriate schema.
>>>> Layout of database is the same in each case. I tried to use
>>>> resource-ref but
>>>> geronimo returnserror about JTA datasource like in this post:
>>>>
>>>> http://www.nabble.com/Problem-with-persistence.xml-%28how-to-use-
>>>> data-source-%29-td16380414s134.html
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> djencks wrote:
>>>>>
>>>>> This is definitely a bug in geronimo that we need to fix before
>>>>> the
>>>>> next release. Can you tell us which geronimo version you are
>>>>> using?
>>>>> There's a slight chance it has been fixed already and I've
>>>>> forgotten
>>>>> about it.
>>>>>
>>>>> As a workaround I think you can just include all the persistence
>>>>> information in a persistence.xml file at an appropriate
>>>>> location in
>>>>> your app.
>>>>>
>>>>> BTW, you need different datasources for jta-datasource and non-
>>>>> jta-
>>>>> datasource. The jta-datasource should have <local-transaction/
>>>>> > or
>>>>> <xa-transaction><transaction-caching/></xa-transaction> and the
>>>>> non-
>>>>> jta-datasource should have <no-transaction/>
>>>>>
>>>>> I can't get derby to work without 2 datasources. I don't know
>>>>> about
>>>>> other databases, but using the same transactional datasource
>>>>> for non-
>>>>> jta-datasource is almost certain to lead to trouble.
>>>>> Can you suggest some way of documenting this so people are
>>>>> likely to
>>>>> find it? Maybe we should refuse to accept the same datasource for
>>>>> both....
>>>>>
>>>>> thanks
>>>>> david jencks
>>>>> On Mar 30, 2008, at 12:57 AM, Andrey Tedeev wrote:
>>>>>
>>>>>>
>>>>>> Also I need to add that same xml works just fine if I do one
>>>>>> of the
>>>>>> following:
>>>>>>
>>>>>> 1. Delete part describing security -realm and security
>>>>>> but leave resource-ref and jpa alone
>>>>>>
>>>>>> 2. Delete resourse-ref and jpa declaration but leave security
>>>>>> alone.
>>>>>>
>>>>>>
>>>>>> So problem rises when I try to use all of those together.
>>>>>>
>>>>>>
>>>>>> --
>>>>>> View this message in context: http://www.nabble.com/complex-
>>>>>> geronimo-web.xml-problem-tp16379211s134p16379399.html
>>>>>> Sent from the Apache Geronimo - Users mailing list archive at
>>>>>> Nabble.com.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context: http://www.nabble.com/complex-
>>>> geronimo-web.xml-problem-tp16379211s134p16385215.html
>>>> Sent from the Apache Geronimo - Users mailing list archive at
>>>> Nabble.com.
>>>>
>>>
>>>
>>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/complex-
> geronimo-web.xml-problem-tp16379211s134p16388126.html
> Sent from the Apache Geronimo - Users mailing list archive at
> Nabble.com.
>
Re: complex geronimo-web.xml problem
Posted by Andrey Tedeev <te...@hotmail.com>.
oops. It was deploying only because I accidentally put it into WEB-INF
instead of META-INF.
So persistence unit was not just found. As soon as i put it in right place
META-INF/persistence.xml
it will produce same error Unable to resolve reference
"JtaDataSourceWrapper".
So this way doesn't work either.
Andrey Tedeev wrote:
>
> OK. I have found a WORKING solution (at least application deploys without
> any errors)
>
> I cut persistence block from geronimo-web.xml and paste it into
> WEB-INF/persistence.xml
>
> It looks not like this (interested parts in bold)
>
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
> http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
> <persistence-unit name="equipment-pu">
>
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
> <jta-data-source>jdbc-jta-ds</jta-data-source>
> <non-jta-data-source>jdbc-non-jta-ds</non-jta-data-source>
> <!-- ssi.api.jpa.company -->
> <class>ssi.api.jpa.company.Description</class>
> <class>ssi.api.jpa.company.Equipment</class>
> <class>ssi.api.jpa.company.EquipmentMaintanence</class>
> <class>ssi.api.jpa.company.EquipmentMaintanenceType</class>
> <class>ssi.api.jpa.company.EquipmentType</class>
> <properties>
> <property name="openjpa.Log" value="DefaultLevel=TRACE, Tool=TRACE,
> SQL=INFO"/>
> <property name="openjpa.jdbc.DBDictionary"
> value="ssi.api.jpa.AS400Dictionary"/>
> </properties>
> </persistence-unit>
> </persistence>
>
>
> Then in geronimo-web.xml I have this references :
>
> <nam:resource-ref
> xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
> <nam:ref-name>jdbc-jta-ds</nam:ref-name>
> <nam:resource-link>jdbc-jta-AAF</nam:resource-link>
> </nam:resource-ref>
>
> <nam:resource-ref
> xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
> <nam:ref-name>jdbc-non-jta-ds</nam:ref-name>
> <nam:resource-link>jdbc-non-jta-AAF</nam:resource-link>
> </nam:resource-ref>
>
> Now it seems to be deploying. though i did not test real work yet using
> @PersistenceContext
>
> I hope it will be helpfull to guys having same problem as
>
> http://www.nabble.com/Problem-with-persistence.xml-%28how-to-use-
> data-source-%29-td16380414s134.html
>
>
> Really that was the point where i went to inserting persistence unit into
> geronimo-web.xml
>
>
> djencks wrote:
>>
>> I don't have time to explain in detail right now but you may be able
>> to use the "datasource-switching" idea as in the roller plugin to use
>> the same persistence.xml for everyone and a different separately
>> deployed datasource.
>>
>> more later
>> david jencks
>>
>> On Mar 30, 2008, at 11:18 AM, Andrey Tedeev wrote:
>>
>>>
>>> Thanks for reply. G-mo 2.1 is used. Unfortunately I have to put
>>> persistence
>>> unit into geronimo-web.xml . In our company each customer has their
>>> own
>>> schema on AS400 becasue
>>> of security issues. So I have bunch of different datasources
>>> pointing to
>>> appropriate schema.
>>> Layout of database is the same in each case. I tried to use
>>> resource-ref but
>>> geronimo returnserror about JTA datasource like in this post:
>>>
>>> http://www.nabble.com/Problem-with-persistence.xml-%28how-to-use-
>>> data-source-%29-td16380414s134.html
>>>
>>>
>>>
>>>
>>>
>>> djencks wrote:
>>>>
>>>> This is definitely a bug in geronimo that we need to fix before the
>>>> next release. Can you tell us which geronimo version you are using?
>>>> There's a slight chance it has been fixed already and I've forgotten
>>>> about it.
>>>>
>>>> As a workaround I think you can just include all the persistence
>>>> information in a persistence.xml file at an appropriate location in
>>>> your app.
>>>>
>>>> BTW, you need different datasources for jta-datasource and non-jta-
>>>> datasource. The jta-datasource should have <local-transaction/> or
>>>> <xa-transaction><transaction-caching/></xa-transaction> and the non-
>>>> jta-datasource should have <no-transaction/>
>>>>
>>>> I can't get derby to work without 2 datasources. I don't know about
>>>> other databases, but using the same transactional datasource for non-
>>>> jta-datasource is almost certain to lead to trouble.
>>>> Can you suggest some way of documenting this so people are likely to
>>>> find it? Maybe we should refuse to accept the same datasource for
>>>> both....
>>>>
>>>> thanks
>>>> david jencks
>>>> On Mar 30, 2008, at 12:57 AM, Andrey Tedeev wrote:
>>>>
>>>>>
>>>>> Also I need to add that same xml works just fine if I do one of the
>>>>> following:
>>>>>
>>>>> 1. Delete part describing security -realm and security
>>>>> but leave resource-ref and jpa alone
>>>>>
>>>>> 2. Delete resourse-ref and jpa declaration but leave security alone.
>>>>>
>>>>>
>>>>> So problem rises when I try to use all of those together.
>>>>>
>>>>>
>>>>> --
>>>>> View this message in context: http://www.nabble.com/complex-
>>>>> geronimo-web.xml-problem-tp16379211s134p16379399.html
>>>>> Sent from the Apache Geronimo - Users mailing list archive at
>>>>> Nabble.com.
>>>>>
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context: http://www.nabble.com/complex-
>>> geronimo-web.xml-problem-tp16379211s134p16385215.html
>>> Sent from the Apache Geronimo - Users mailing list archive at
>>> Nabble.com.
>>>
>>
>>
>>
>
>
--
View this message in context: http://www.nabble.com/complex-geronimo-web.xml-problem-tp16379211s134p16388126.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
Re: complex geronimo-web.xml problem
Posted by Andrey Tedeev <te...@hotmail.com>.
OK. I have found a WORKING solution (at least application deploys without any
errors)
I cut persistence block from geronimo-web.xml and paste it into
WEB-INF/persistence.xml
It looks not like this (interested parts in bold)
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="equipment-pu">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<jta-data-source>jdbc-jta-ds</jta-data-source>
<non-jta-data-source>jdbc-non-jta-ds</non-jta-data-source>
<!-- ssi.api.jpa.company -->
<class>ssi.api.jpa.company.Description</class>
<class>ssi.api.jpa.company.Equipment</class>
<class>ssi.api.jpa.company.EquipmentMaintanence</class>
<class>ssi.api.jpa.company.EquipmentMaintanenceType</class>
<class>ssi.api.jpa.company.EquipmentType</class>
<properties>
<property name="openjpa.Log" value="DefaultLevel=TRACE, Tool=TRACE,
SQL=INFO"/>
<property name="openjpa.jdbc.DBDictionary"
value="ssi.api.jpa.AS400Dictionary"/>
</properties>
</persistence-unit>
</persistence>
Then in geronimo-web.xml I have this references :
<nam:resource-ref xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
<nam:ref-name>jdbc-jta-ds</nam:ref-name>
<nam:resource-link>jdbc-jta-AAF</nam:resource-link>
</nam:resource-ref>
<nam:resource-ref xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
<nam:ref-name>jdbc-non-jta-ds</nam:ref-name>
<nam:resource-link>jdbc-non-jta-AAF</nam:resource-link>
</nam:resource-ref>
Now it seems to be deploying. though i did not test real work yet using
@PersistenceContext
I hope it will be helpfull to guys having same problem as
http://www.nabble.com/Problem-with-persistence.xml-%28how-to-use-
data-source-%29-td16380414s134.html
Really that was the point where i went to inserting persistence unit into
geronimo-web.xml
djencks wrote:
>
> I don't have time to explain in detail right now but you may be able
> to use the "datasource-switching" idea as in the roller plugin to use
> the same persistence.xml for everyone and a different separately
> deployed datasource.
>
> more later
> david jencks
>
> On Mar 30, 2008, at 11:18 AM, Andrey Tedeev wrote:
>
>>
>> Thanks for reply. G-mo 2.1 is used. Unfortunately I have to put
>> persistence
>> unit into geronimo-web.xml . In our company each customer has their
>> own
>> schema on AS400 becasue
>> of security issues. So I have bunch of different datasources
>> pointing to
>> appropriate schema.
>> Layout of database is the same in each case. I tried to use
>> resource-ref but
>> geronimo returnserror about JTA datasource like in this post:
>>
>> http://www.nabble.com/Problem-with-persistence.xml-%28how-to-use-
>> data-source-%29-td16380414s134.html
>>
>>
>>
>>
>>
>> djencks wrote:
>>>
>>> This is definitely a bug in geronimo that we need to fix before the
>>> next release. Can you tell us which geronimo version you are using?
>>> There's a slight chance it has been fixed already and I've forgotten
>>> about it.
>>>
>>> As a workaround I think you can just include all the persistence
>>> information in a persistence.xml file at an appropriate location in
>>> your app.
>>>
>>> BTW, you need different datasources for jta-datasource and non-jta-
>>> datasource. The jta-datasource should have <local-transaction/> or
>>> <xa-transaction><transaction-caching/></xa-transaction> and the non-
>>> jta-datasource should have <no-transaction/>
>>>
>>> I can't get derby to work without 2 datasources. I don't know about
>>> other databases, but using the same transactional datasource for non-
>>> jta-datasource is almost certain to lead to trouble.
>>> Can you suggest some way of documenting this so people are likely to
>>> find it? Maybe we should refuse to accept the same datasource for
>>> both....
>>>
>>> thanks
>>> david jencks
>>> On Mar 30, 2008, at 12:57 AM, Andrey Tedeev wrote:
>>>
>>>>
>>>> Also I need to add that same xml works just fine if I do one of the
>>>> following:
>>>>
>>>> 1. Delete part describing security -realm and security
>>>> but leave resource-ref and jpa alone
>>>>
>>>> 2. Delete resourse-ref and jpa declaration but leave security alone.
>>>>
>>>>
>>>> So problem rises when I try to use all of those together.
>>>>
>>>>
>>>> --
>>>> View this message in context: http://www.nabble.com/complex-
>>>> geronimo-web.xml-problem-tp16379211s134p16379399.html
>>>> Sent from the Apache Geronimo - Users mailing list archive at
>>>> Nabble.com.
>>>>
>>>
>>>
>>>
>>
>> --
>> View this message in context: http://www.nabble.com/complex-
>> geronimo-web.xml-problem-tp16379211s134p16385215.html
>> Sent from the Apache Geronimo - Users mailing list archive at
>> Nabble.com.
>>
>
>
>
--
View this message in context: http://www.nabble.com/complex-geronimo-web.xml-problem-tp16379211s134p16385938.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
Re: complex geronimo-web.xml problem
Posted by David Jencks <da...@yahoo.com>.
I don't have time to explain in detail right now but you may be able
to use the "datasource-switching" idea as in the roller plugin to use
the same persistence.xml for everyone and a different separately
deployed datasource.
more later
david jencks
On Mar 30, 2008, at 11:18 AM, Andrey Tedeev wrote:
>
> Thanks for reply. G-mo 2.1 is used. Unfortunately I have to put
> persistence
> unit into geronimo-web.xml . In our company each customer has their
> own
> schema on AS400 becasue
> of security issues. So I have bunch of different datasources
> pointing to
> appropriate schema.
> Layout of database is the same in each case. I tried to use
> resource-ref but
> geronimo returnserror about JTA datasource like in this post:
>
> http://www.nabble.com/Problem-with-persistence.xml-%28how-to-use-
> data-source-%29-td16380414s134.html
>
>
>
>
>
> djencks wrote:
>>
>> This is definitely a bug in geronimo that we need to fix before the
>> next release. Can you tell us which geronimo version you are using?
>> There's a slight chance it has been fixed already and I've forgotten
>> about it.
>>
>> As a workaround I think you can just include all the persistence
>> information in a persistence.xml file at an appropriate location in
>> your app.
>>
>> BTW, you need different datasources for jta-datasource and non-jta-
>> datasource. The jta-datasource should have <local-transaction/> or
>> <xa-transaction><transaction-caching/></xa-transaction> and the non-
>> jta-datasource should have <no-transaction/>
>>
>> I can't get derby to work without 2 datasources. I don't know about
>> other databases, but using the same transactional datasource for non-
>> jta-datasource is almost certain to lead to trouble.
>> Can you suggest some way of documenting this so people are likely to
>> find it? Maybe we should refuse to accept the same datasource for
>> both....
>>
>> thanks
>> david jencks
>> On Mar 30, 2008, at 12:57 AM, Andrey Tedeev wrote:
>>
>>>
>>> Also I need to add that same xml works just fine if I do one of the
>>> following:
>>>
>>> 1. Delete part describing security -realm and security
>>> but leave resource-ref and jpa alone
>>>
>>> 2. Delete resourse-ref and jpa declaration but leave security alone.
>>>
>>>
>>> So problem rises when I try to use all of those together.
>>>
>>>
>>> --
>>> View this message in context: http://www.nabble.com/complex-
>>> geronimo-web.xml-problem-tp16379211s134p16379399.html
>>> Sent from the Apache Geronimo - Users mailing list archive at
>>> Nabble.com.
>>>
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/complex-
> geronimo-web.xml-problem-tp16379211s134p16385215.html
> Sent from the Apache Geronimo - Users mailing list archive at
> Nabble.com.
>
Re: complex geronimo-web.xml problem
Posted by Andrey Tedeev <te...@hotmail.com>.
Thanks for reply. G-mo 2.1 is used. Unfortunately I have to put persistence
unit into geronimo-web.xml . In our company each customer has their own
schema on AS400 becasue
of security issues. So I have bunch of different datasources pointing to
appropriate schema.
Layout of database is the same in each case. I tried to use resource-ref but
geronimo returnserror about JTA datasource like in this post:
http://www.nabble.com/Problem-with-persistence.xml-%28how-to-use-data-source-%29-td16380414s134.html
djencks wrote:
>
> This is definitely a bug in geronimo that we need to fix before the
> next release. Can you tell us which geronimo version you are using?
> There's a slight chance it has been fixed already and I've forgotten
> about it.
>
> As a workaround I think you can just include all the persistence
> information in a persistence.xml file at an appropriate location in
> your app.
>
> BTW, you need different datasources for jta-datasource and non-jta-
> datasource. The jta-datasource should have <local-transaction/> or
> <xa-transaction><transaction-caching/></xa-transaction> and the non-
> jta-datasource should have <no-transaction/>
>
> I can't get derby to work without 2 datasources. I don't know about
> other databases, but using the same transactional datasource for non-
> jta-datasource is almost certain to lead to trouble.
> Can you suggest some way of documenting this so people are likely to
> find it? Maybe we should refuse to accept the same datasource for
> both....
>
> thanks
> david jencks
> On Mar 30, 2008, at 12:57 AM, Andrey Tedeev wrote:
>
>>
>> Also I need to add that same xml works just fine if I do one of the
>> following:
>>
>> 1. Delete part describing security -realm and security
>> but leave resource-ref and jpa alone
>>
>> 2. Delete resourse-ref and jpa declaration but leave security alone.
>>
>>
>> So problem rises when I try to use all of those together.
>>
>>
>> --
>> View this message in context: http://www.nabble.com/complex-
>> geronimo-web.xml-problem-tp16379211s134p16379399.html
>> Sent from the Apache Geronimo - Users mailing list archive at
>> Nabble.com.
>>
>
>
>
--
View this message in context: http://www.nabble.com/complex-geronimo-web.xml-problem-tp16379211s134p16385215.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
Re: complex geronimo-web.xml problem
Posted by David Jencks <da...@yahoo.com>.
This is definitely a bug in geronimo that we need to fix before the
next release. Can you tell us which geronimo version you are using?
There's a slight chance it has been fixed already and I've forgotten
about it.
As a workaround I think you can just include all the persistence
information in a persistence.xml file at an appropriate location in
your app.
BTW, you need different datasources for jta-datasource and non-jta-
datasource. The jta-datasource should have <local-transaction/> or
<xa-transaction><transaction-caching/></xa-transaction> and the non-
jta-datasource should have <no-transaction/>
I can't get derby to work without 2 datasources. I don't know about
other databases, but using the same transactional datasource for non-
jta-datasource is almost certain to lead to trouble.
Can you suggest some way of documenting this so people are likely to
find it? Maybe we should refuse to accept the same datasource for
both....
thanks
david jencks
On Mar 30, 2008, at 12:57 AM, Andrey Tedeev wrote:
>
> Also I need to add that same xml works just fine if I do one of the
> following:
>
> 1. Delete part describing security -realm and security
> but leave resource-ref and jpa alone
>
> 2. Delete resourse-ref and jpa declaration but leave security alone.
>
>
> So problem rises when I try to use all of those together.
>
>
> --
> View this message in context: http://www.nabble.com/complex-
> geronimo-web.xml-problem-tp16379211s134p16379399.html
> Sent from the Apache Geronimo - Users mailing list archive at
> Nabble.com.
>
Re: complex geronimo-web.xml problem
Posted by Andrey Tedeev <te...@hotmail.com>.
Also I need to add that same xml works just fine if I do one of the
following:
1. Delete part describing security -realm and security
but leave resource-ref and jpa alone
2. Delete resourse-ref and jpa declaration but leave security alone.
So problem rises when I try to use all of those together.
--
View this message in context: http://www.nabble.com/complex-geronimo-web.xml-problem-tp16379211s134p16379399.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.