2 Replies Latest reply on Jul 2, 2015 8:55 AM by Wolfgang Mayer

    Help ! java.sql.SQLException: Not a wrapper for: ?

    Jose Sofhack Newbie

      I need to resolve this error!@





      Data Source Pool

       

      public static  Connection getConnectionDato() throws SQLException{

       

        DataSource datasource=null;

       

        try {

       

        InitialContext cxt = new InitialContext();

        datasource = (DataSource) cxt.lookup("java:jboss/testing");

        

        

       

        } catch (Exception e) {

        // TODO: handle exception

        e.printStackTrace();

        }

        return datasource.getConnection();

       

       

        }

       

       

       

      ------------------------------------------------------------------

      public void test() throws NamingException {

        try {

        conexion = getConnectionDato();

        ConTest test=conexion.unwrap(ConTest.class);//Error

       

      } catch (SQLException e) {

        // TODO Auto-generated catch blockso

        System.out.println("*****");

        e.printStackTrace();

        }finally{

        if (conexion!=null) {

        try {

        conexion.close();

        } catch (SQLException e) {

        // NO-OP

        }

        }

       

        }

       

       

        }

       




       

      03:06:06,345 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) java.sql.SQLException: Not a wrapper for: Pruebas.ConTest

      03:06:06,346 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.jboss.jca.adapters.jdbc.JBossWrapper.unwrap(JBossWrapper.java:82)

      03:06:06,346 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at com.pruebas.BeanDepartamento.test(BeanDepartamento.java:55)

      03:06:06,347 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      03:06:06,347 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

      03:06:06,347 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      03:06:06,348 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at java.lang.reflect.Method.invoke(Method.java:622)

      03:06:06,348 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.apache.el.parser.AstValue.invoke(AstValue.java:262)

      03:06:06,353 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)

      03:06:06,354 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)

      03:06:06,355 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)

      03:06:06,359 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)

      03:06:06,362 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at javax.faces.component.UICommand.broadcast(UICommand.java:315)

      03:06:06,363 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)

      03:06:06,363 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)

      03:06:06,364 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)

      03:06:06,364 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)

      03:06:06,365 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)

      03:06:06,365 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)

      03:06:06,365 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)

      03:06:06,366 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

      03:06:06,366 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)

      03:06:06,367 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)

      03:06:06,367 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)

      03:06:06,368 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)

      03:06:06,369 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

      03:06:06,369 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

      03:06:06,370 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)

      03:06:06,370 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)

      03:06:06,371 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)

      03:06:06,372 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)

      03:06:06,373 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at java.lang.Thread.run(Thread.java:701)