users@glassfish.java.net

RE: GlassFish 3.1 embedded and Java EE 6 DataSource definition

From: Martin Gainty <mgainty_at_hotmail.com>
Date: Sun, 16 May 2010 16:48:00 -0400

if you dont mind using spring.. you can use spring's ContextLoaderListener to load the first applicationContext.xml found on the classpath

 

 <web-app version="2.4" 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">
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:applicationContext.xml</param-value>
    </context-param>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>


hth
Martin Gainty
______________________________________________
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.



 

> Date: Sun, 16 May 2010 13:28:51 -0700
> From: glassfish_at_javadesktop.org
> To: users_at_glassfish.dev.java.net
> Subject: GlassFish 3.1 embedded and Java EE 6 DataSource definition
>
> Hi there,
>
> I have been able to successfully define a datasource using the new Java EE 6 features, defining it in web.xml using a data-source node. However, I would like this application to be compatible with other servers that do not implement Java EE 6 yet, and that complain that this node is not allowed in web.xml.
>
> So my question would be, is it possible to define this data-source node in another file that is not web.xml? I tried adding application.xml to META-INF but it is being ignored.
>
> I have tried adding it to sun-web.xml but it seems to be ignored there, as all I get is the same JNDI name not bound that I get if I define nothing.
>
> I know mixing servlet versions is not a good thing, but I could not find any other descriptor to get GlassFish embedded to define a datasource, all the other embeeded containers have their own custom descriptors to do that, so I'm simply trying to get the application to be compatible with all the containers.
>
> S!
> [Message sent by forum member 'greeneyed']
>
> http://forums.java.net/jive/thread.jspa?messageID=470061
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
                                               
_________________________________________________________________
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5