Hi
Did you try the snapshot? (1.6.0-snapshot)
Le 6 avr. 2013 20:18, "[email protected]" <[email protected]>
a écrit :
> I am using TomEE as the Application Server. TomEE uses Tomcat 7. I have the
> following code:
>
> package com.jndi;
>
> import java.util.Hashtable;
> import javax.naming.Context;
> import javax.naming.Name;
> import javax.naming.NamingException;
> import javax.naming.RefAddr;
> import javax.naming.Reference;
> import javax.naming.spi.ObjectFactory;
>
>
> public class GitObjectFactory implements ObjectFactory {
>
> public GitObjectFactory() {
>
> }
>
> public Object getObjectInstance(Object obj, Name name, Context
> nameCtx,
> Hashtable environment) throws NamingException {
> GitConnection gitConnection = new GitConnection();
> // Customize the bean properties from our attributes
> Reference ref = (Reference) obj;
> RefAddr refAddr = ref.get("gitLocation");
> String value = (String) refAddr.getContent();
> gitConnection.setGitLocation(value);
> return gitConnection;
> }
> }
>
> public class GitConnection {
>
> private String gitLocation;
>
> public GitConnection() {
>
> }
>
> public String getGitLocation() {
> return gitLocation;
> }
>
> public void setGitLocation(String gitLocation) {
> this.gitLocation = gitLocation;
> }
> }
>
> in context.xml
> <Context>
>
>
> <WatchedResource>WEB-INF/web.xml</WatchedResource>
> <Resource name='git/GitConnectionFactory' auth='Container'
> type='com.jndi.GitConnection'
> factory='com.jndi.GitObjectFactory'
> gitLocation='C:\jGitClone\.git'/>
>
> in web.xml
> <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_5.xsd"
> version="2.5">
>
> <context-param>
>
>
> /WEB-INF/spring/email.xml
> </context-param>
>
> <listener>
>
>
>
> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> </listener>
>
> <servlet>
> <servlet-name>i</servlet-name>
>
>
> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
> <load-on-startup>1</load-on-startup>
> </servlet>
>
> <servlet-mapping>
> <servlet-name>i</servlet-name>
> <url-pattern>/</url-pattern>
> </servlet-mapping>
>
> <welcome-file-list>
> <welcome-file>index.jsp</welcome-file>
> </welcome-file-list>
>
> <resource-env-ref>
> <description>Object Factory for GitConnection
> instances.</description>
>
> <resource-env-ref-name>git/GitConnectionFactory</resource-env-ref-name>
>
> <resource-env-ref-type>com.jndi.GitConnection</resource-env-ref-type>
> </resource-env-ref>
> </web-app>
>
> When I load Tomcat, I can see successfully that the resource
> git/GitConnectionFactory is registered:
>
> INFO: Configuring Service(id=git/GitConnectionFactory, type=Resource,
> provider-id=ProvidedByTomcat)
> 06-Apr-2013 17:54:25 org.apache.openejb.assembler.classic.Assembler
> createRecipe
>
> As soon as I deploy the application I get the following Exception:
>
> org.apache.openejb.OpenEJBException: No provider available for
> resource-env-ref 'git/GitConnectionFactory' of type
> 'com.jndi.GitConnection'
> for 'i'.
>
> Any ideas where the problem is?
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/TomEE-Tomat-7-Resources-deployed-tp4662050.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>