You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Trevor Stevens <ts...@me.com> on 2013/07/02 19:29:46 UTC

Resource-link to global resource

In standard tomcat it is possible to link a global resource to an application specific name. I cannot seem to get similar functionality working in Tomee. I am currently placing a resource-link element in context.xml but should this be placed in resources.xml?


Standard tomcat
server.xml
<GlobalNamingResources >
  <Resource name="jdbc/global" auth="Container"
            type="javax.sql.DataSource"/>
</GlobalNamingResources>

Tomee
tomee.xml
    <Resource id="jdbc/global" type="DataSource">
        JdbcDriver org.hsqldb.jdbcDriver
        JdbcUrl jdbc:hsqldb:file:hsqldb
        UserName sa
        Password
        JtaManaged false
    </Resource>
tomcat & tomee
context.xml
<Context>
<ResourceLink name="jdbc/app" global="jdbc/global" type="javax.sql.DataSource" />
</Context>
web.xml
    <resource-ref>
            <res-ref-name>jdbc/app</res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Container</res-auth>
            <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
Is this possible? It will link properly in Tomee if a mapped-name (mapped-name>jdbc/global</mapped-name>) element is added to the web.xml but I would prefer to exclude deployment specific locations from my web.xml.

Thanks,
Trevor Stevens
tstevens@me.com



RE: @webservice security and JAAS

Posted by Romain Manni-Bucau <rm...@gmail.com>.
You can still implement a loginModule using spring security
Le 3 juil. 2013 18:37, "Patel, Sanjay" <Sa...@nemours.org> a écrit :

> I use spring security to secure my webapp. Not sure can I or should I
> combine spring-security and JAAS. I thought configuring jaas in tome and
> annotating ejb with @RolesAllowed will secure webservice.
>
> -----Original Message-----
> From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com]
> Sent: Wednesday, July 03, 2013 11:45 AM
> To: users@tomee.apache.org
> Subject: Re: @webservice security and JAAS
>
> yes if your webapp is secured this way
>
> *Romain Manni-Bucau*
> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> *Blog: **http://rmannibucau.wordpress.com/*<
> http://rmannibucau.wordpress.com/>
> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> *Github: https://github.com/rmannibucau*
>
>
>
> 2013/7/3 Patel, Sanjay <Sa...@nemours.org>
>
> >
> > So just for web-service security, passing correct username/password in
> > header should allow to access web-service from soap-ui or any other
> client?
> >
> > -----Original Message-----
> > From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com]
> > Sent: Wednesday, July 03, 2013 11:22 AM
> > To: users@tomee.apache.org
> > Subject: Re: @webservice security and JAAS
> >
> > the wsdl doesn't have the info about it, only the http layer
> >
> > this openejb-jar.xml config was before when we were deploying 1 "webapp"
> > by endpoint, now it just reuse your webapp security
> >
> > *Romain Manni-Bucau*
> > *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> > *Blog: **http://rmannibucau.wordpress.com/*<
> > http://rmannibucau.wordpress.com/>
> > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> > *Github: https://github.com/rmannibucau*
> >
> >
> >
> > 2013/7/3 Patel, Sanjay <Sa...@nemours.org>
> >
> > > I setup JAAS according to http://tomee.apache.org/tomee-jaas.html
> > > and everything works fine. I confirmed by accessing manager/html app
> > > and using username/password from users.properties.
> > >
> > > I annotated my EJB with @webservice annotation as below.
> > >
> > > @Stateless(name = NemoursDirectoryWebServiceBean.EJB_NAME,
> > > mappedName =
> > > NemoursDirectoryWebServiceBean.EJB_NAME)
> > > @WebService(serviceName = NemoursDirectoryWebService.SERVICE_NAME)
> > > @DeclareRoles(value = { "NemoursAdmin" }) public class
> > > NemoursDirectoryWebServiceBean implements NemoursDirectoryWebService
> > > {
> > >
> > >         public static final String EJB_NAME =
> > > "NemoursDirectoryService";
> > >
> > >         @Override
> > >         @RolesAllowed(value = { "NemoursAdmin" })
> > >         public String test() {
> > >                 return "Hello";
> > >         }
> > > }
> > >
> > > Now when I try to
> > >
> >
> http://localhost:8080/directory/webservices/NemoursDirectoryService?wsdlinbrowser,
> it does not prompt me for username/password.
> > > But if I try to access web-service using SOAP UI, I get
> > > Unauthorized Access by Principal Denied  error.
> > >
> > > Here is  my openejb-jar.xml
> > > <?xml version="1.0" encoding="UTF-8" standalone="no"?> <openejb-jar
> > > xmlns="http://openejb.apache.org/xml/ns/openejb-jar-2.2">
> > >         <enterprise-beans>
> > >                 <session>
> > >                         <ejb-name>NemoursDirectoryService</ejb-name>
> > >                         <web-service-security>
> > >                                 <security-realm-name />
> > >
> > > <transport-guarantee>NONE</transport-guarantee>
> > >                                 <auth-method>BASIC</auth-method>
> > >                         </web-service-security>
> > >                 </session>
> > >         </enterprise-beans>
> > > </openejb-jar>
> > >
> > > Do I need any more configuration?
> > >
> > > I was also expecting generated wsdl to contain some kind of
> > > AuthenticationInfo header.
> > >
> >
>

RE: @webservice security and JAAS

Posted by "Patel, Sanjay" <Sa...@nemours.org>.
I use spring security to secure my webapp. Not sure can I or should I combine spring-security and JAAS. I thought configuring jaas in tome and annotating ejb with @RolesAllowed will secure webservice.

-----Original Message-----
From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com] 
Sent: Wednesday, July 03, 2013 11:45 AM
To: users@tomee.apache.org
Subject: Re: @webservice security and JAAS

yes if your webapp is secured this way

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/7/3 Patel, Sanjay <Sa...@nemours.org>

>
> So just for web-service security, passing correct username/password in 
> header should allow to access web-service from soap-ui or any other client?
>
> -----Original Message-----
> From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com]
> Sent: Wednesday, July 03, 2013 11:22 AM
> To: users@tomee.apache.org
> Subject: Re: @webservice security and JAAS
>
> the wsdl doesn't have the info about it, only the http layer
>
> this openejb-jar.xml config was before when we were deploying 1 "webapp"
> by endpoint, now it just reuse your webapp security
>
> *Romain Manni-Bucau*
> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> *Blog: **http://rmannibucau.wordpress.com/*<
> http://rmannibucau.wordpress.com/>
> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> *Github: https://github.com/rmannibucau*
>
>
>
> 2013/7/3 Patel, Sanjay <Sa...@nemours.org>
>
> > I setup JAAS according to http://tomee.apache.org/tomee-jaas.html 
> > and everything works fine. I confirmed by accessing manager/html app 
> > and using username/password from users.properties.
> >
> > I annotated my EJB with @webservice annotation as below.
> >
> > @Stateless(name = NemoursDirectoryWebServiceBean.EJB_NAME, 
> > mappedName =
> > NemoursDirectoryWebServiceBean.EJB_NAME)
> > @WebService(serviceName = NemoursDirectoryWebService.SERVICE_NAME)
> > @DeclareRoles(value = { "NemoursAdmin" }) public class 
> > NemoursDirectoryWebServiceBean implements NemoursDirectoryWebService 
> > {
> >
> >         public static final String EJB_NAME = 
> > "NemoursDirectoryService";
> >
> >         @Override
> >         @RolesAllowed(value = { "NemoursAdmin" })
> >         public String test() {
> >                 return "Hello";
> >         }
> > }
> >
> > Now when I try to
> >
> http://localhost:8080/directory/webservices/NemoursDirectoryService?wsdlinbrowser, it does not prompt me for username/password.
> > But if I try to access web-service using SOAP UI, I get  
> > Unauthorized Access by Principal Denied  error.
> >
> > Here is  my openejb-jar.xml
> > <?xml version="1.0" encoding="UTF-8" standalone="no"?> <openejb-jar 
> > xmlns="http://openejb.apache.org/xml/ns/openejb-jar-2.2">
> >         <enterprise-beans>
> >                 <session>
> >                         <ejb-name>NemoursDirectoryService</ejb-name>
> >                         <web-service-security>
> >                                 <security-realm-name />
> >
> > <transport-guarantee>NONE</transport-guarantee>
> >                                 <auth-method>BASIC</auth-method>
> >                         </web-service-security>
> >                 </session>
> >         </enterprise-beans>
> > </openejb-jar>
> >
> > Do I need any more configuration?
> >
> > I was also expecting generated wsdl to contain some kind of 
> > AuthenticationInfo header.
> >
>

Re: @webservice security and JAAS

Posted by Romain Manni-Bucau <rm...@gmail.com>.
yes if your webapp is secured this way

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/7/3 Patel, Sanjay <Sa...@nemours.org>

>
> So just for web-service security, passing correct username/password in
> header should allow to access web-service from soap-ui or any other client?
>
> -----Original Message-----
> From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com]
> Sent: Wednesday, July 03, 2013 11:22 AM
> To: users@tomee.apache.org
> Subject: Re: @webservice security and JAAS
>
> the wsdl doesn't have the info about it, only the http layer
>
> this openejb-jar.xml config was before when we were deploying 1 "webapp"
> by endpoint, now it just reuse your webapp security
>
> *Romain Manni-Bucau*
> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> *Blog: **http://rmannibucau.wordpress.com/*<
> http://rmannibucau.wordpress.com/>
> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> *Github: https://github.com/rmannibucau*
>
>
>
> 2013/7/3 Patel, Sanjay <Sa...@nemours.org>
>
> > I setup JAAS according to http://tomee.apache.org/tomee-jaas.html and
> > everything works fine. I confirmed by accessing manager/html app and
> > using username/password from users.properties.
> >
> > I annotated my EJB with @webservice annotation as below.
> >
> > @Stateless(name = NemoursDirectoryWebServiceBean.EJB_NAME, mappedName
> > =
> > NemoursDirectoryWebServiceBean.EJB_NAME)
> > @WebService(serviceName = NemoursDirectoryWebService.SERVICE_NAME)
> > @DeclareRoles(value = { "NemoursAdmin" }) public class
> > NemoursDirectoryWebServiceBean implements NemoursDirectoryWebService {
> >
> >         public static final String EJB_NAME =
> > "NemoursDirectoryService";
> >
> >         @Override
> >         @RolesAllowed(value = { "NemoursAdmin" })
> >         public String test() {
> >                 return "Hello";
> >         }
> > }
> >
> > Now when I try to
> >
> http://localhost:8080/directory/webservices/NemoursDirectoryService?wsdlinbrowser, it does not prompt me for username/password.
> > But if I try to access web-service using SOAP UI, I get  Unauthorized
> > Access by Principal Denied  error.
> >
> > Here is  my openejb-jar.xml
> > <?xml version="1.0" encoding="UTF-8" standalone="no"?> <openejb-jar
> > xmlns="http://openejb.apache.org/xml/ns/openejb-jar-2.2">
> >         <enterprise-beans>
> >                 <session>
> >                         <ejb-name>NemoursDirectoryService</ejb-name>
> >                         <web-service-security>
> >                                 <security-realm-name />
> >
> > <transport-guarantee>NONE</transport-guarantee>
> >                                 <auth-method>BASIC</auth-method>
> >                         </web-service-security>
> >                 </session>
> >         </enterprise-beans>
> > </openejb-jar>
> >
> > Do I need any more configuration?
> >
> > I was also expecting generated wsdl to contain some kind of
> > AuthenticationInfo header.
> >
>

RE: @webservice security and JAAS

Posted by "Patel, Sanjay" <Sa...@nemours.org>.
So just for web-service security, passing correct username/password in header should allow to access web-service from soap-ui or any other client?

-----Original Message-----
From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com] 
Sent: Wednesday, July 03, 2013 11:22 AM
To: users@tomee.apache.org
Subject: Re: @webservice security and JAAS

the wsdl doesn't have the info about it, only the http layer

this openejb-jar.xml config was before when we were deploying 1 "webapp" by endpoint, now it just reuse your webapp security

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/7/3 Patel, Sanjay <Sa...@nemours.org>

> I setup JAAS according to http://tomee.apache.org/tomee-jaas.html and 
> everything works fine. I confirmed by accessing manager/html app and 
> using username/password from users.properties.
>
> I annotated my EJB with @webservice annotation as below.
>
> @Stateless(name = NemoursDirectoryWebServiceBean.EJB_NAME, mappedName 
> =
> NemoursDirectoryWebServiceBean.EJB_NAME)
> @WebService(serviceName = NemoursDirectoryWebService.SERVICE_NAME)
> @DeclareRoles(value = { "NemoursAdmin" }) public class 
> NemoursDirectoryWebServiceBean implements NemoursDirectoryWebService {
>
>         public static final String EJB_NAME = 
> "NemoursDirectoryService";
>
>         @Override
>         @RolesAllowed(value = { "NemoursAdmin" })
>         public String test() {
>                 return "Hello";
>         }
> }
>
> Now when I try to
> http://localhost:8080/directory/webservices/NemoursDirectoryService?wsdlin browser, it does not prompt me for username/password.
> But if I try to access web-service using SOAP UI, I get  Unauthorized 
> Access by Principal Denied  error.
>
> Here is  my openejb-jar.xml
> <?xml version="1.0" encoding="UTF-8" standalone="no"?> <openejb-jar 
> xmlns="http://openejb.apache.org/xml/ns/openejb-jar-2.2">
>         <enterprise-beans>
>                 <session>
>                         <ejb-name>NemoursDirectoryService</ejb-name>
>                         <web-service-security>
>                                 <security-realm-name />
>
> <transport-guarantee>NONE</transport-guarantee>
>                                 <auth-method>BASIC</auth-method>
>                         </web-service-security>
>                 </session>
>         </enterprise-beans>
> </openejb-jar>
>
> Do I need any more configuration?
>
> I was also expecting generated wsdl to contain some kind of 
> AuthenticationInfo header.
>

Re: @webservice security and JAAS

Posted by Romain Manni-Bucau <rm...@gmail.com>.
the wsdl doesn't have the info about it, only the http layer

this openejb-jar.xml config was before when we were deploying 1 "webapp" by
endpoint, now it just reuse your webapp security

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/7/3 Patel, Sanjay <Sa...@nemours.org>

> I setup JAAS according to http://tomee.apache.org/tomee-jaas.html and
> everything works fine. I confirmed by accessing manager/html app and using
> username/password from users.properties.
>
> I annotated my EJB with @webservice annotation as below.
>
> @Stateless(name = NemoursDirectoryWebServiceBean.EJB_NAME, mappedName =
> NemoursDirectoryWebServiceBean.EJB_NAME)
> @WebService(serviceName = NemoursDirectoryWebService.SERVICE_NAME)
> @DeclareRoles(value = { "NemoursAdmin" })
> public class NemoursDirectoryWebServiceBean implements
> NemoursDirectoryWebService {
>
>         public static final String EJB_NAME = "NemoursDirectoryService";
>
>         @Override
>         @RolesAllowed(value = { "NemoursAdmin" })
>         public String test() {
>                 return "Hello";
>         }
> }
>
> Now when I try to
> http://localhost:8080/directory/webservices/NemoursDirectoryService?wsdlin browser, it does not prompt me for username/password.
> But if I try to access web-service using SOAP UI, I get  Unauthorized
> Access by Principal Denied  error.
>
> Here is  my openejb-jar.xml
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <openejb-jar xmlns="http://openejb.apache.org/xml/ns/openejb-jar-2.2">
>         <enterprise-beans>
>                 <session>
>                         <ejb-name>NemoursDirectoryService</ejb-name>
>                         <web-service-security>
>                                 <security-realm-name />
>
> <transport-guarantee>NONE</transport-guarantee>
>                                 <auth-method>BASIC</auth-method>
>                         </web-service-security>
>                 </session>
>         </enterprise-beans>
> </openejb-jar>
>
> Do I need any more configuration?
>
> I was also expecting generated wsdl to contain some kind of
> AuthenticationInfo header.
>

@webservice security and JAAS

Posted by "Patel, Sanjay" <Sa...@nemours.org>.
I setup JAAS according to http://tomee.apache.org/tomee-jaas.html and everything works fine. I confirmed by accessing manager/html app and using username/password from users.properties.

I annotated my EJB with @webservice annotation as below.

@Stateless(name = NemoursDirectoryWebServiceBean.EJB_NAME, mappedName = NemoursDirectoryWebServiceBean.EJB_NAME)
@WebService(serviceName = NemoursDirectoryWebService.SERVICE_NAME)
@DeclareRoles(value = { "NemoursAdmin" })
public class NemoursDirectoryWebServiceBean implements NemoursDirectoryWebService {

	public static final String EJB_NAME = "NemoursDirectoryService";
	
	@Override
	@RolesAllowed(value = { "NemoursAdmin" })
	public String test() {
		return "Hello";
	}
}

Now when I try to http://localhost:8080/directory/webservices/NemoursDirectoryService?wsdl in browser, it does not prompt me for username/password.
But if I try to access web-service using SOAP UI, I get  Unauthorized Access by Principal Denied  error.

Here is  my openejb-jar.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<openejb-jar xmlns="http://openejb.apache.org/xml/ns/openejb-jar-2.2">
	<enterprise-beans>
		<session>
			<ejb-name>NemoursDirectoryService</ejb-name>
			<web-service-security>
				<security-realm-name />
				<transport-guarantee>NONE</transport-guarantee>
				<auth-method>BASIC</auth-method>
			</web-service-security>
		</session>
	</enterprise-beans>
</openejb-jar>

Do I need any more configuration?

I was also expecting generated wsdl to contain some kind of AuthenticationInfo header.

Re: Resource-link to global resource

Posted by Romain Manni-Bucau <rm...@gmail.com>.
No, you can use java:global iirc or openejb:Resource
Le 2 juil. 2013 20:51, "Trevor Stevens" <ts...@me.com> a écrit :

> Would the aliases be in the java:comp/env namespace? That is the situation
> when using the ResourceLink element inside META-INF/context.xml.
>
>
> Trevor Stevens
> tstevens@me.com
>
>
> On Jul 2, 2013, at 2:38 PM, Romain Manni-Bucau <rm...@gmail.com>
> wrote:
>
> > It is in the tag <Resource/> so tomee.xml or resources.xml depending
> where
> > you declare your resource.
> > Le 2 juil. 2013 20:16, "Trevor Stevens" <ts...@me.com> a écrit :
> >
> >> Would the alias configuration have to be on the definition inside
> >> tomee.xml or can it exist as an extension of that definition inside
> >> resources.xml? Basically add an alias to an existing resource definition
> >> defined elsewhere.
> >>
> >> Trevor Stevens
> >> tstevens@me.com
> >>
> >> On Jul 2, 2013, at 1:51 PM, Romain Manni-Bucau <rm...@gmail.com>
> >> wrote:
> >>
> >>> In fact on a respurce you can define aliases (the name of the tag). I
> >> think
> >>> it is pretty much the same feature.
> >>> Le 2 juil. 2013 19:38, "Trevor Stevens" <ts...@me.com> a écrit :
> >>>
> >>>> What is the format to create the link in resources.xml? I tried using
> >> the
> >>>> element from context.xml in resources.xml but I threw an exception at
> me
> >>>> `Caused by: java.lang.IllegalStateException: Unsupported Element:
> >>>> ResourceLink`.
> >>>>
> >>>>
> >>>> Trevor Stevens
> >>>> tstevens@me.com
> >>>>
> >>>>
> >>>> On Jul 2, 2013, at 1:33 PM, Romain Manni-Bucau <rmannibucau@gmail.com
> >
> >>>> wrote:
> >>>>
> >>>>> Resources.xml should do it
> >>>>> Le 2 juil. 2013 19:30, "Trevor Stevens" <ts...@me.com> a écrit :
> >>>>>
> >>>>>> In standard tomcat it is possible to link a global resource to an
> >>>>>> application specific name. I cannot seem to get similar
> functionality
> >>>>>> working in Tomee. I am currently placing a resource-link element in
> >>>>>> context.xml but should this be placed in resources.xml?
> >>>>>>
> >>>>>>
> >>>>>> Standard tomcat
> >>>>>> server.xml
> >>>>>> <GlobalNamingResources >
> >>>>>> <Resource name="jdbc/global" auth="Container"
> >>>>>>          type="javax.sql.DataSource"/>
> >>>>>> </GlobalNamingResources>
> >>>>>>
> >>>>>> Tomee
> >>>>>> tomee.xml
> >>>>>>  <Resource id="jdbc/global" type="DataSource">
> >>>>>>      JdbcDriver org.hsqldb.jdbcDriver
> >>>>>>      JdbcUrl jdbc:hsqldb:file:hsqldb
> >>>>>>      UserName sa
> >>>>>>      Password
> >>>>>>      JtaManaged false
> >>>>>>  </Resource>
> >>>>>> tomcat & tomee
> >>>>>> context.xml
> >>>>>> <Context>
> >>>>>> <ResourceLink name="jdbc/app" global="jdbc/global"
> >>>>>> type="javax.sql.DataSource" />
> >>>>>> </Context>
> >>>>>> web.xml
> >>>>>>  <resource-ref>
> >>>>>>          <res-ref-name>jdbc/app</res-ref-name>
> >>>>>>          <res-type>javax.sql.DataSource</res-type>
> >>>>>>          <res-auth>Container</res-auth>
> >>>>>>          <res-sharing-scope>Shareable</res-sharing-scope>
> >>>>>>  </resource-ref>
> >>>>>> Is this possible? It will link properly in Tomee if a mapped-name
> >>>>>> (mapped-name>jdbc/global</mapped-name>) element is added to the
> >> web.xml
> >>>> but
> >>>>>> I would prefer to exclude deployment specific locations from my
> >> web.xml.
> >>>>>>
> >>>>>> Thanks,
> >>>>>> Trevor Stevens
> >>>>>> tstevens@me.com
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>
> >>>>
> >>
> >>
>
>

Re: Resource-link to global resource

Posted by Trevor Stevens <ts...@me.com>.
Would the aliases be in the java:comp/env namespace? That is the situation when using the ResourceLink element inside META-INF/context.xml.
 

Trevor Stevens
tstevens@me.com


On Jul 2, 2013, at 2:38 PM, Romain Manni-Bucau <rm...@gmail.com> wrote:

> It is in the tag <Resource/> so tomee.xml or resources.xml depending where
> you declare your resource.
> Le 2 juil. 2013 20:16, "Trevor Stevens" <ts...@me.com> a écrit :
> 
>> Would the alias configuration have to be on the definition inside
>> tomee.xml or can it exist as an extension of that definition inside
>> resources.xml? Basically add an alias to an existing resource definition
>> defined elsewhere.
>> 
>> Trevor Stevens
>> tstevens@me.com
>> 
>> On Jul 2, 2013, at 1:51 PM, Romain Manni-Bucau <rm...@gmail.com>
>> wrote:
>> 
>>> In fact on a respurce you can define aliases (the name of the tag). I
>> think
>>> it is pretty much the same feature.
>>> Le 2 juil. 2013 19:38, "Trevor Stevens" <ts...@me.com> a écrit :
>>> 
>>>> What is the format to create the link in resources.xml? I tried using
>> the
>>>> element from context.xml in resources.xml but I threw an exception at me
>>>> `Caused by: java.lang.IllegalStateException: Unsupported Element:
>>>> ResourceLink`.
>>>> 
>>>> 
>>>> Trevor Stevens
>>>> tstevens@me.com
>>>> 
>>>> 
>>>> On Jul 2, 2013, at 1:33 PM, Romain Manni-Bucau <rm...@gmail.com>
>>>> wrote:
>>>> 
>>>>> Resources.xml should do it
>>>>> Le 2 juil. 2013 19:30, "Trevor Stevens" <ts...@me.com> a écrit :
>>>>> 
>>>>>> In standard tomcat it is possible to link a global resource to an
>>>>>> application specific name. I cannot seem to get similar functionality
>>>>>> working in Tomee. I am currently placing a resource-link element in
>>>>>> context.xml but should this be placed in resources.xml?
>>>>>> 
>>>>>> 
>>>>>> Standard tomcat
>>>>>> server.xml
>>>>>> <GlobalNamingResources >
>>>>>> <Resource name="jdbc/global" auth="Container"
>>>>>>          type="javax.sql.DataSource"/>
>>>>>> </GlobalNamingResources>
>>>>>> 
>>>>>> Tomee
>>>>>> tomee.xml
>>>>>>  <Resource id="jdbc/global" type="DataSource">
>>>>>>      JdbcDriver org.hsqldb.jdbcDriver
>>>>>>      JdbcUrl jdbc:hsqldb:file:hsqldb
>>>>>>      UserName sa
>>>>>>      Password
>>>>>>      JtaManaged false
>>>>>>  </Resource>
>>>>>> tomcat & tomee
>>>>>> context.xml
>>>>>> <Context>
>>>>>> <ResourceLink name="jdbc/app" global="jdbc/global"
>>>>>> type="javax.sql.DataSource" />
>>>>>> </Context>
>>>>>> web.xml
>>>>>>  <resource-ref>
>>>>>>          <res-ref-name>jdbc/app</res-ref-name>
>>>>>>          <res-type>javax.sql.DataSource</res-type>
>>>>>>          <res-auth>Container</res-auth>
>>>>>>          <res-sharing-scope>Shareable</res-sharing-scope>
>>>>>>  </resource-ref>
>>>>>> Is this possible? It will link properly in Tomee if a mapped-name
>>>>>> (mapped-name>jdbc/global</mapped-name>) element is added to the
>> web.xml
>>>> but
>>>>>> I would prefer to exclude deployment specific locations from my
>> web.xml.
>>>>>> 
>>>>>> Thanks,
>>>>>> Trevor Stevens
>>>>>> tstevens@me.com
>>>>>> 
>>>>>> 
>>>>>> 
>>>> 
>>>> 
>> 
>> 


Re: Resource-link to global resource

Posted by Romain Manni-Bucau <rm...@gmail.com>.
It is in the tag <Resource/> so tomee.xml or resources.xml depending where
you declare your resource.
Le 2 juil. 2013 20:16, "Trevor Stevens" <ts...@me.com> a écrit :

> Would the alias configuration have to be on the definition inside
> tomee.xml or can it exist as an extension of that definition inside
> resources.xml? Basically add an alias to an existing resource definition
> defined elsewhere.
>
> Trevor Stevens
> tstevens@me.com
>
> On Jul 2, 2013, at 1:51 PM, Romain Manni-Bucau <rm...@gmail.com>
> wrote:
>
> > In fact on a respurce you can define aliases (the name of the tag). I
> think
> > it is pretty much the same feature.
> > Le 2 juil. 2013 19:38, "Trevor Stevens" <ts...@me.com> a écrit :
> >
> >> What is the format to create the link in resources.xml? I tried using
> the
> >> element from context.xml in resources.xml but I threw an exception at me
> >> `Caused by: java.lang.IllegalStateException: Unsupported Element:
> >> ResourceLink`.
> >>
> >>
> >> Trevor Stevens
> >> tstevens@me.com
> >>
> >>
> >> On Jul 2, 2013, at 1:33 PM, Romain Manni-Bucau <rm...@gmail.com>
> >> wrote:
> >>
> >>> Resources.xml should do it
> >>> Le 2 juil. 2013 19:30, "Trevor Stevens" <ts...@me.com> a écrit :
> >>>
> >>>> In standard tomcat it is possible to link a global resource to an
> >>>> application specific name. I cannot seem to get similar functionality
> >>>> working in Tomee. I am currently placing a resource-link element in
> >>>> context.xml but should this be placed in resources.xml?
> >>>>
> >>>>
> >>>> Standard tomcat
> >>>> server.xml
> >>>> <GlobalNamingResources >
> >>>> <Resource name="jdbc/global" auth="Container"
> >>>>           type="javax.sql.DataSource"/>
> >>>> </GlobalNamingResources>
> >>>>
> >>>> Tomee
> >>>> tomee.xml
> >>>>   <Resource id="jdbc/global" type="DataSource">
> >>>>       JdbcDriver org.hsqldb.jdbcDriver
> >>>>       JdbcUrl jdbc:hsqldb:file:hsqldb
> >>>>       UserName sa
> >>>>       Password
> >>>>       JtaManaged false
> >>>>   </Resource>
> >>>> tomcat & tomee
> >>>> context.xml
> >>>> <Context>
> >>>> <ResourceLink name="jdbc/app" global="jdbc/global"
> >>>> type="javax.sql.DataSource" />
> >>>> </Context>
> >>>> web.xml
> >>>>   <resource-ref>
> >>>>           <res-ref-name>jdbc/app</res-ref-name>
> >>>>           <res-type>javax.sql.DataSource</res-type>
> >>>>           <res-auth>Container</res-auth>
> >>>>           <res-sharing-scope>Shareable</res-sharing-scope>
> >>>>   </resource-ref>
> >>>> Is this possible? It will link properly in Tomee if a mapped-name
> >>>> (mapped-name>jdbc/global</mapped-name>) element is added to the
> web.xml
> >> but
> >>>> I would prefer to exclude deployment specific locations from my
> web.xml.
> >>>>
> >>>> Thanks,
> >>>> Trevor Stevens
> >>>> tstevens@me.com
> >>>>
> >>>>
> >>>>
> >>
> >>
>
>

Re: Resource-link to global resource

Posted by Trevor Stevens <ts...@me.com>.
Would the alias configuration have to be on the definition inside tomee.xml or can it exist as an extension of that definition inside resources.xml? Basically add an alias to an existing resource definition defined elsewhere.

Trevor Stevens
tstevens@me.com

On Jul 2, 2013, at 1:51 PM, Romain Manni-Bucau <rm...@gmail.com> wrote:

> In fact on a respurce you can define aliases (the name of the tag). I think
> it is pretty much the same feature.
> Le 2 juil. 2013 19:38, "Trevor Stevens" <ts...@me.com> a écrit :
> 
>> What is the format to create the link in resources.xml? I tried using the
>> element from context.xml in resources.xml but I threw an exception at me
>> `Caused by: java.lang.IllegalStateException: Unsupported Element:
>> ResourceLink`.
>> 
>> 
>> Trevor Stevens
>> tstevens@me.com
>> 
>> 
>> On Jul 2, 2013, at 1:33 PM, Romain Manni-Bucau <rm...@gmail.com>
>> wrote:
>> 
>>> Resources.xml should do it
>>> Le 2 juil. 2013 19:30, "Trevor Stevens" <ts...@me.com> a écrit :
>>> 
>>>> In standard tomcat it is possible to link a global resource to an
>>>> application specific name. I cannot seem to get similar functionality
>>>> working in Tomee. I am currently placing a resource-link element in
>>>> context.xml but should this be placed in resources.xml?
>>>> 
>>>> 
>>>> Standard tomcat
>>>> server.xml
>>>> <GlobalNamingResources >
>>>> <Resource name="jdbc/global" auth="Container"
>>>>           type="javax.sql.DataSource"/>
>>>> </GlobalNamingResources>
>>>> 
>>>> Tomee
>>>> tomee.xml
>>>>   <Resource id="jdbc/global" type="DataSource">
>>>>       JdbcDriver org.hsqldb.jdbcDriver
>>>>       JdbcUrl jdbc:hsqldb:file:hsqldb
>>>>       UserName sa
>>>>       Password
>>>>       JtaManaged false
>>>>   </Resource>
>>>> tomcat & tomee
>>>> context.xml
>>>> <Context>
>>>> <ResourceLink name="jdbc/app" global="jdbc/global"
>>>> type="javax.sql.DataSource" />
>>>> </Context>
>>>> web.xml
>>>>   <resource-ref>
>>>>           <res-ref-name>jdbc/app</res-ref-name>
>>>>           <res-type>javax.sql.DataSource</res-type>
>>>>           <res-auth>Container</res-auth>
>>>>           <res-sharing-scope>Shareable</res-sharing-scope>
>>>>   </resource-ref>
>>>> Is this possible? It will link properly in Tomee if a mapped-name
>>>> (mapped-name>jdbc/global</mapped-name>) element is added to the web.xml
>> but
>>>> I would prefer to exclude deployment specific locations from my web.xml.
>>>> 
>>>> Thanks,
>>>> Trevor Stevens
>>>> tstevens@me.com
>>>> 
>>>> 
>>>> 
>> 
>> 


Re: Resource-link to global resource

Posted by Romain Manni-Bucau <rm...@gmail.com>.
In fact on a respurce you can define aliases (the name of the tag). I think
it is pretty much the same feature.
Le 2 juil. 2013 19:38, "Trevor Stevens" <ts...@me.com> a écrit :

> What is the format to create the link in resources.xml? I tried using the
> element from context.xml in resources.xml but I threw an exception at me
> `Caused by: java.lang.IllegalStateException: Unsupported Element:
> ResourceLink`.
>
>
> Trevor Stevens
> tstevens@me.com
>
>
> On Jul 2, 2013, at 1:33 PM, Romain Manni-Bucau <rm...@gmail.com>
> wrote:
>
> > Resources.xml should do it
> > Le 2 juil. 2013 19:30, "Trevor Stevens" <ts...@me.com> a écrit :
> >
> >> In standard tomcat it is possible to link a global resource to an
> >> application specific name. I cannot seem to get similar functionality
> >> working in Tomee. I am currently placing a resource-link element in
> >> context.xml but should this be placed in resources.xml?
> >>
> >>
> >> Standard tomcat
> >> server.xml
> >> <GlobalNamingResources >
> >>  <Resource name="jdbc/global" auth="Container"
> >>            type="javax.sql.DataSource"/>
> >> </GlobalNamingResources>
> >>
> >> Tomee
> >> tomee.xml
> >>    <Resource id="jdbc/global" type="DataSource">
> >>        JdbcDriver org.hsqldb.jdbcDriver
> >>        JdbcUrl jdbc:hsqldb:file:hsqldb
> >>        UserName sa
> >>        Password
> >>        JtaManaged false
> >>    </Resource>
> >> tomcat & tomee
> >> context.xml
> >> <Context>
> >> <ResourceLink name="jdbc/app" global="jdbc/global"
> >> type="javax.sql.DataSource" />
> >> </Context>
> >> web.xml
> >>    <resource-ref>
> >>            <res-ref-name>jdbc/app</res-ref-name>
> >>            <res-type>javax.sql.DataSource</res-type>
> >>            <res-auth>Container</res-auth>
> >>            <res-sharing-scope>Shareable</res-sharing-scope>
> >>    </resource-ref>
> >> Is this possible? It will link properly in Tomee if a mapped-name
> >> (mapped-name>jdbc/global</mapped-name>) element is added to the web.xml
> but
> >> I would prefer to exclude deployment specific locations from my web.xml.
> >>
> >> Thanks,
> >> Trevor Stevens
> >> tstevens@me.com
> >>
> >>
> >>
>
>

Re: Resource-link to global resource

Posted by Trevor Stevens <ts...@me.com>.
What is the format to create the link in resources.xml? I tried using the element from context.xml in resources.xml but I threw an exception at me `Caused by: java.lang.IllegalStateException: Unsupported Element: ResourceLink`.


Trevor Stevens
tstevens@me.com


On Jul 2, 2013, at 1:33 PM, Romain Manni-Bucau <rm...@gmail.com> wrote:

> Resources.xml should do it
> Le 2 juil. 2013 19:30, "Trevor Stevens" <ts...@me.com> a écrit :
> 
>> In standard tomcat it is possible to link a global resource to an
>> application specific name. I cannot seem to get similar functionality
>> working in Tomee. I am currently placing a resource-link element in
>> context.xml but should this be placed in resources.xml?
>> 
>> 
>> Standard tomcat
>> server.xml
>> <GlobalNamingResources >
>>  <Resource name="jdbc/global" auth="Container"
>>            type="javax.sql.DataSource"/>
>> </GlobalNamingResources>
>> 
>> Tomee
>> tomee.xml
>>    <Resource id="jdbc/global" type="DataSource">
>>        JdbcDriver org.hsqldb.jdbcDriver
>>        JdbcUrl jdbc:hsqldb:file:hsqldb
>>        UserName sa
>>        Password
>>        JtaManaged false
>>    </Resource>
>> tomcat & tomee
>> context.xml
>> <Context>
>> <ResourceLink name="jdbc/app" global="jdbc/global"
>> type="javax.sql.DataSource" />
>> </Context>
>> web.xml
>>    <resource-ref>
>>            <res-ref-name>jdbc/app</res-ref-name>
>>            <res-type>javax.sql.DataSource</res-type>
>>            <res-auth>Container</res-auth>
>>            <res-sharing-scope>Shareable</res-sharing-scope>
>>    </resource-ref>
>> Is this possible? It will link properly in Tomee if a mapped-name
>> (mapped-name>jdbc/global</mapped-name>) element is added to the web.xml but
>> I would prefer to exclude deployment specific locations from my web.xml.
>> 
>> Thanks,
>> Trevor Stevens
>> tstevens@me.com
>> 
>> 
>> 


Re: Resource-link to global resource

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Resources.xml should do it
Le 2 juil. 2013 19:30, "Trevor Stevens" <ts...@me.com> a écrit :

> In standard tomcat it is possible to link a global resource to an
> application specific name. I cannot seem to get similar functionality
> working in Tomee. I am currently placing a resource-link element in
> context.xml but should this be placed in resources.xml?
>
>
> Standard tomcat
> server.xml
> <GlobalNamingResources >
>   <Resource name="jdbc/global" auth="Container"
>             type="javax.sql.DataSource"/>
> </GlobalNamingResources>
>
> Tomee
> tomee.xml
>     <Resource id="jdbc/global" type="DataSource">
>         JdbcDriver org.hsqldb.jdbcDriver
>         JdbcUrl jdbc:hsqldb:file:hsqldb
>         UserName sa
>         Password
>         JtaManaged false
>     </Resource>
> tomcat & tomee
> context.xml
> <Context>
> <ResourceLink name="jdbc/app" global="jdbc/global"
> type="javax.sql.DataSource" />
> </Context>
> web.xml
>     <resource-ref>
>             <res-ref-name>jdbc/app</res-ref-name>
>             <res-type>javax.sql.DataSource</res-type>
>             <res-auth>Container</res-auth>
>             <res-sharing-scope>Shareable</res-sharing-scope>
>     </resource-ref>
> Is this possible? It will link properly in Tomee if a mapped-name
> (mapped-name>jdbc/global</mapped-name>) element is added to the web.xml but
> I would prefer to exclude deployment specific locations from my web.xml.
>
> Thanks,
> Trevor Stevens
> tstevens@me.com
>
>
>