This sounds like a bug to me. Which version of geronimo are you using? Are you only accessing the datasources from the web app with the dependendencies in the geronimo-web.xml and not from any other module in the ear? Just to be clear, you get a deployment error not a runtime error?

many thanks
david jencks

On Nov 29, 2006, at 5:29 AM, niteryder wrote:


Hi Lasantha,

I've already answered Guillaume's answer, it is deployed now. But i want to
ask a question about the structure.

First i created database pools from the console
then I deployed a war project with geronimo-web.xml in it

geronimo-web.xml
------------------------------

<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1";>
        <environment>
                <moduleId>
                        <artifactId>test-war</artifactId>
                </moduleId>
                <dependencies>
                        <dependency>
                                <groupId>console.dbpool</groupId>
                                <artifactId>TEST1</artifactId>
                        </dependency>
                        <dependency>
                                <groupId>console.dbpool</groupId>
                                <artifactId>TEST2</artifactId>
                        </dependency>
                </dependencies>
        </environment>
        <context-root>/test-war</context-root>
        <!-- define a reference name to the db pool-->
        <resource-ref>
                <ref-name>jdbc/TEST1</ref-name>
                <resource-link>TEST1</resource-link>
        </resource-ref>
        <resource-ref>
                <ref-name>jdbc/TEST2</ref-name>
                <resource-link>TEST2</resource-link>
        </resource-ref>
</web-app>

Later I want to put this war project into an ear and deploy to geronimo.
This time i had to prepare geronimo-application.xml
but I didn't realize that i have to put dependencies again to
geronimo-application.xml
I was expecting it to find from geronimo-web.xml (I put it also under a folder named 'deployment' in ear and referenced it with alt-dd under module)

<application xmlns="http://geronimo.apache.org/xml/ns/j2ee/ application-1.1"
xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1";
xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1";
application-name="test-ear">
  <sys:environment>
    <sys:moduleId>
      <sys:groupId>default</sys:groupId>
      <sys:artifactId>test-ear</sys:artifactId>
      <sys:version>1.0</sys:version>
      <sys:type>car</sys:type>
    </sys:moduleId>
    <sys:dependencies/>
  </sys:environment>
  <module>
    <web>test-war.war</web>
    <alt-dd>deployment/geronimo-web.xml</alt-dd>
  </module>
</application>

this was giving unable to resolve resource reference jdbc/TEST1

then i changed geronimo-application.xml like below and it is deployed

<application xmlns="http://geronimo.apache.org/xml/ns/j2ee/ application-1.1"
xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1";
xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1";
application-name="test-ear">
  <sys:environment>
    <sys:moduleId>
      <sys:groupId>default</sys:groupId>
      <sys:artifactId>test-ear</sys:artifactId>
      <sys:version>1.0</sys:version>
      <sys:type>car</sys:type>
    </sys:moduleId>
    <sys:dependencies>
      <sys:dependency>
        <sys:groupId>console.dbpool</sys:groupId>
        <sys:artifactId>TEST1</sys:artifactId>
        <sys:version>1.0</sys:version>
        <sys:type>rar</sys:type>
      </sys:dependency>
      <sys:dependency>
        <sys:groupId>console.dbpool</sys:groupId>
        <sys:artifactId>TEST2</sys:artifactId>
        <sys:version>1.0</sys:version>
        <sys:type>rar</sys:type>
      </sys:dependency>
    </sys:dependencies>
  </sys:environment>
  <module>
    <web>test-war.war</web>
    <alt-dd>deployment/geronimo-web.xml</alt-dd>
  </module>
</application>


But my question is how can i make these dependencies for only a project in ear. I mean only the web project have dependency to these datasources in ear
and i've already put these dependency in geronimo-web.xml
and if it gives this error that means it checks web.xml of war project so it
might also check geronimo-web.xml
because if i want only deploy war project (not in ear), it exactly does this right? it finds the dependencies from geronimo-web.xml so it successfully
deploys war project.

if this is the only way for ear should i remove the dependencies in
geronimo-web.xml ?

Thanks


Lasantha Ranaweera wrote:

Hi,

Could you be bit more specific on your situation? I might be able to
help you as the author of this sample application. :)

Thanks,
Lasantha Ranaweera
niteryder wrote:
Hi Guillaume,

Have you succeeded on this issue? I have similar problem, I can deploy
war
individually and I can use the database pools that I created with
Geronimo's
with this deployed war. But when i want to add this war to an ear and
deploy
it. I also take similar messages for my datasources.

Thanks


Guillaume Bilodeau wrote:

I agree it's a good sign that the data source is actually usable from
the
sample application. However from what I understand this application
does
not have a strict dependency to a specific data source like our
application - it instead discovers them programmatically.

The problem I'm describing is actually happening during the deployment phase: I open the "Deploy new" screen, select the application EAR, I
even
uncheck the "Start after install" option and finally click on Deploy. A
few instants later, Geronimo gives the following message:

Deployment failed: Unable to resolve resource reference
'jdbc/AuchanPromoDS' (Could not find resource 'AuchanPromoDS'. Perhaps
it
has not yet been configured, or your application does not have a
dependency declared for that resource module?)

AFAICT, the application wasn't started yet, so I presume it's more a
configuration issue than an application issue.  The problem is,
everything
seems to be configured according to the Geronimo usage page :)

The applicationContext.xml file is a configuration file for the Spring framework. In our application, this file isn't loaded right on startup
so
I doubt it's interfering with anything.

I didn't mention yet but the application runs fine on Glassfish and
Tomcat, so I suppose I'm not configuring Geronimo or access to it
correctly.

I'll have a look at the simple-database-access-sample- application and
let
you know if it's not too late - it's Friday after all :)

Thanks!
GB


Lasantha Ranaweera wrote:

Ok.. Then we can suspect problem is in your application.  :-)

I saw file called in "applicationConext.xml" one of your previous
mails.
What exactly that means?

To link a DBPool with your web application you need to add reference in your geronimo-web.xml file too. Then it should be linked with web.xml.
Have a look at

http://cwiki.apache.org/GMOxDOC11/simple-database-access-sample- application.html

Let us know your status too.

Thanks,
Lasantha Ranaweera


Guillaume Bilodeau wrote:

I've tested the pool before deploying it and it worked fine. I have
now
downloaded, built and deployed the dbtester sample application with
correct
results: my AuchanPromoDS pool is there, and I can list its tables and
their
content with no error whatsoever.

Everything looks fine, how come my application will not even deploy?
I'm at
a loss here :S

Thanks again,
GB


Lasantha Ranaweera wrote:


Since you have deployed DB pool using G console, have you tested it
before deploying?

Otherwise have a look at this sample application which help to find
out
your DB connection pools is working or not.

http://cwiki.apache.org/GMOxDOC11/db-pool-testing-sample- application.html

Thanks,
Lasantha Ranaweera

Guillaume Bilodeau wrote:


No it's a remote Oracle database.


Lasantha Ranaweera wrote:



What is the DB you are using? Is it Derby Embedded?

Thanks,
Lasantha Ranaweera

Guillaume Bilodeau wrote:



Hi David,

Not sure if that's what you mean, but I deployed the datasource
myself
using
the "Geronimo database pool wizard", not through a separate
deployment
plan.
Is that it?

Thanks,
GB


David Jencks wrote:




Everything you show looks ok to me, which makes me wonder if the
console-generated rar plan really has the connection factory
named
AuchanPromoDS.  Could you show the plan for deploying the
datasource?

thanks
david jencks

On Oct 26, 2006, at 11:03 PM, Guillaume Bilodeau wrote:





Ok let's try this again, without altering any names :)  I'm
using
Geronimo+Tomcat 1.1.1 on Java 5.

Error:
        
Deployment failed:
Unable to resolve resource reference 'jdbc/ AuchanPromoDS' (Could
not find
resource 'AuchanPromoDS'. Perhaps it has not yet been
configured,
or your
application does not have a dependency declared for that
resource
module?)

"Installed J2EE connectors" screen:
console.dbpool/AuchanPromoDS/1.0/rar running Stop
Restart         
Uninstall

web.xml:

<?xml version="1.0" encoding="UTF-8" ?>

<web-app xmlns="http://java.sun.com/xml/ns/j2ee";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
        version="2.4">
...
    <resource-ref>
        <res-ref-name>jdbc/AuchanPromoDS</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
        <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
...
</web-app>

geronimo-web.xml:

<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns="http://geronimo.apache.org/xml/ns/web";>
        <environment>
                <moduleId>
                        <artifactId>promo-war</artifactId>
                </moduleId>
                <dependencies>
                        <dependency>
                                <groupId>console.dbpool</groupId>
                                <artifactId>AuchanPromoDS</artifactId>
                        </dependency>
                </dependencies>
        </environment>

        <context-root>/auchan-promo</context-root>

        <resource-ref>
                <ref-name>jdbc/AuchanPromoDS</ref-name>
                <resource-link>AuchanPromoDS</resource-link>
        </resource-ref>
</web-app>

applicationContext.xml:

        <jee:jndi-lookup id="mainDataSource"
                jndi-name="java:comp/env/jdbc/AuchanPromoDS"
                proxy-interface="javax.sql.DataSource"
                lookup-on-startup="false" />

application.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application PUBLIC
        "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
        "http://java.sun.com/dtd/application_1_3.dtd";>
<application>
  <display-name>promo-ear</display-name>
<description>Promo Action Management System EAR</ description>
  <module>
    <web>
      <web-uri>promo-web-2.0.0-SNAPSHOT.war</web-uri>
      <context-root>/auchan-promo</context-root>
    </web>
  </module>
  <module>
    <ejb>promo-server-2.0.0-SNAPSHOT.jar</ejb>
  </module>
</application>

It seems to me that I followed what the usage screen suggests.
Is
this a
problem with dealing with EARs?

Thanks,
GB


On 10/26/06, Guillaume Bilodeau <[EMAIL PROTECTED]> wrote:




Yes actually that was a mistake in my post, I forgot to remove
all
references
to my current client :) All names are correct in my code, all
of
them
being
jdbc/<insertClientNameHere>PromoDS.

Any other idea?




Can you look in the database pool screen in the console, and
select
the usage link next to your database pool, and make sure that
all
the
names in the example there match the ones in your
geronimo-web.xml
file? It's hard to troubleshoot from the config files if you're
changing the important entries as you post them.  :)

Also, are you using Geronimo 1.0 or Geronimo 1.1?  The XML
namespaces
in the geronimo-web.xml file aren't really correct for Geronimo
1.1,
though it may auto-convert them. I'd try putting in the proper
values
(which you can get from here
http://geronimo.apache.org/schemas.html).

Thanks,
      Aaron

--
View this message in context:
http://www.nabble.com/Error-deploying-
EAR-because-of-DataSource-tf2513035.html#a7024975
Sent from the Apache Geronimo - Users mailing list archive at
Nabble.com.
































--
View this message in context: http://www.nabble.com/Error-deploying- EAR-because-of-DataSource-tf2513035.html#a7599290 Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Reply via email to