Hi all,

I have an Embedded Server and try to add a Resource to the globalnamingresources:

        ContextResource resource = new ContextResource();
        resource.setName("jdbc/db");
        resource.setAuth("Container");
        resource.setType("javax.sql.DataSource");
        resource.setScope("Sharable");
        resource.setProperty("driverClassName",
                "org.apache.derby.jdbc.EmbeddedDriver");
        resource.setProperty("url", "jdbc:derby:" + catalinaHome
                + File.separator + "db" + File.separator + "db");
        resource.setProperty("username", "user");
        resource.setProperty("password", "password");
        ServerFactory.getServer().getGlobalNamingResources().addResource(
                resource);

Then I have a war File, which represents my context. In this war file I have a META-INF/context.xml File:

<Context>
<ResourceLink name="jdbc/db" global="jdbc/db" type="javax.sql.DataSource" />
</Context>

I even tried to add the ResourceLink programmatically with:

ContextResourceLink contextResourceLink = new ContextResourceLink();
        contextResourceLink.setGlobal("jdbc/db");
        contextResourceLink.setName("jdbc/db");
        contextResourceLink.setType("javax.sql.DataSource");
        context.getNamingResources().addResourceLink(contextResourceLink);

Now I'm getting a Naming Exception when calling  the database.
When I'm adding the ContextResource directly to the Context the everything works fine:

Context context = createContext("", docBase.getAbsolutePath());
context.getNamingResources().addResource(resource);

So how do I get a resource link working in the context when programmatically adding global resources to
the Container.

Many thanks,
Michael

--
Michael Borchert

Project manager IT
****************************************************
CMPMedica - Medizinische Medien Informations GmbH
Am Forsthaus Gravenbruch 7
63263 Neu-Isenburg

Fon +49(0) 6102 502-201
Fax +49(0) 6102 502-243
Mob +49(0) 175 22 54 557

Geschäftsführer: Dr. Uwe A. Richter, Henry Elkington

Handelsregister beim Amtsgericht Offenbach/Main HRB 8014
Ust-IdNr. DE 113524692

******************************************************************
Diese E-Mail einschließlich ihrer Anhänge ist vertraulich.
Wir bitten eine fehlgeleitete E-Mail unverzüglich und vollständig
zu löschen und uns eine Nachricht zukommen zu lassen.
Wir haben die E-Mail vor dem Versenden auf Virenfreiheit geprüft.
Eine Haftung für Virenfreiheit schließen wir aus.

This e-mail message and all attachments transmitted with it are
intended solely for the use of the addressee and may contain
legally privileged and confidential information.
If the receiver of this message is not the intended recipient,
or an employee or agent responsible for delivering this message
to the intended recipient, you are hereby notified that any
dissemination,
distribution, copying, or other use of this message or its attachments
is strictly prohibited.
If you have received this message in error, please notify the sender
immediately by e-mail reply and please delete this message from your
computer.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to