Details

      Description

      Using a simple producer bean like this

      @ManagedBean
      public class SimpleProducerBean {
      
          @Resource(name = "java:jboss/datasources/ExampleDS")
          DataSource dataSource;
      
          @Produces
          public String getDriverName() {
              try {
                  Connection con = dataSource.getConnection();
                  try {
                      return con.getMetaData().getDriverName();
                  } finally {
                      con.close();
                  }
              } catch (SQLException ex) {
                  return ex.toString();
              }
          }
      }
      

      I get

      10:09:18,782 INFO  [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/simple]] (http-/127.0.0.1:8080-1) Marking servlet SimpleBeanServlet as unavailable
      10:09:18,783 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/simple].[SimpleBeanServlet]] (http-/127.0.0.1:8080-1) Allocate exception for servlet SimpleBeanServlet: javax.naming.NameNotFoundException: env/java:jboss/datasources/ExampleDS -- service jboss.naming.context.java.module.simple.simple.env.java:jboss.datasources.ExampleDS
      	at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:97)
      	at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:179)
      	at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:129)
      	at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:215)
      	at javax.naming.InitialContext.lookup(InitialContext.java:392) [rt.jar:1.6.0_33]
      	at org.jboss.weld.injection.spi.helpers.AbstractResourceServices.resolveResource(AbstractResourceServices.java:47) [weld-spi-1.1.Final.jar:20110112-1536]
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                thomas.diesler Thomas Diesler
                Reporter:
                thomas.diesler Thomas Diesler
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: