8 Replies Latest reply on Feb 29, 2008 3:29 PM by allanrj

    Jndi Datasource

    allanrj

      Hi guys,

      I have a problem to locate datasource, when I run a ejb a i got a error : UNKNOW SOURCE. I am doing any mistake ?

      DataSource ds = (DataSource) ic.lookup("java:jdbc/APAESP");


      mssql-ds.xml
      <datasources>
       <local-tx-datasource>
       <jndi-name>jdbc/APAESP</jndi-name>
       <use-java-context>false</use-java-context>
       <connection-url>jdbc:microsoft:sqlserver://dbdesenv:1433;DatabaseName=TEST</connection-url>
       <driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-class>
       <user-name>sa</user-name>
       <password></password>
       <metadata>
       <type-mapping>MSSQL2000</type-mapping>
       </metadata>
       </local-tx-datasource>
      </datasources>


        • 1. Re: Jndi Datasource
          peterj

          Please post the full stack trace for the exception you are getting.

          • 2. Re: Jndi Datasource
            allanrj

            Follow the stacktrace

            java.rmi.ServerException: EJBException:; nested exception is:
             javax.ejb.EJBException
             at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:365)
             at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:209)
             at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
             at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
             at org.jboss.ejb.Container.invoke(Container.java:960)
             at sun.reflect.GeneratedMethodAccessor99.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:597)
             at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
             at org.jboss.invocation.unified.server.UnifiedInvoker.invoke(UnifiedInvoker.java:231)
             at sun.reflect.GeneratedMethodAccessor98.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:597)
             at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
             at javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:288)
             at $Proxy16.invoke(Unknown Source)
             at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
             at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
             at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:387)
             at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
            Caused by: javax.ejb.EJBException
             at br.com.gcm.ejb.sb.SitesSBBean.makeConnection(Unknown Source)
             at br.com.gcm.ejb.sb.SitesSBBean.selectSite(Unknown Source)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:597)
             at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
             at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:237)
             at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)
             at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:169)
             at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
             at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
             at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
             at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
             at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
             at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
             at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
             at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
             at org.jboss.ejb.Container.invoke(Container.java:960)
             at sun.reflect.GeneratedMethodAccessor99.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:597)
             at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
             at org.jboss.invocation.unified.server.UnifiedInvoker.invoke(UnifiedInvoker.java:231)
             at sun.reflect.GeneratedMethodAccessor98.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:597)
             at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
             at javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:288)
             at $Proxy16.invoke(Unknown Source)
             at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
             at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
             at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:387)
             at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
             at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:163)
             at org.jboss.remoting.Client.invoke(Client.java:1634)
             at org.jboss.remoting.Client.invoke(Client.java:548)
             at org.jboss.invocation.unified.interfaces.UnifiedInvokerProxy.invoke(UnifiedInvokerProxy.java:183)
             at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:365)
             at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:197)
             at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
             at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
             at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:112)
             at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
             at $Proxy1.selectSite(Unknown Source)
             at br.com.gcm.proxy.SitesProxy.selectSite(SitesProxy.java:50)
             at teste.TesteSitesEJB.main(TesteSitesEJB.java:25)
            br.com.gcm.exceptions.ProxyCallException: EJBException:; nested exception is:
             javax.ejb.EJBException
             at br.com.gcm.proxy.SitesProxy.selectSite(SitesProxy.java:54)
             at teste.TesteSitesEJB.main(TesteSitesEJB.java:25)
            


            • 3. Re: Jndi Datasource
              peterj

              Funny, this stack trace does not mention anything about "UNKNOWN SOURCE", which is the error message you posted with your original post.

              Also, this looks like a stack trace from the client, not from the server, which is where the data source is located.

              Finally, the stack trace is about EJBs, not about JNDI.

              Please post the code for the SitesProxy.selectSite() method, and highlight lines 50 and 54.

              • 4. Re: Jndi Datasource
                allanrj

                Yes, this a client.

                About unknow source, the line was at

                br.com.gcm.ejb.sb.SitesSBBean.makeConnection(Unknown Source) br.com.gcm.proxy.SitesProxy.selectSite(SitesProxy.java:50)
                

                public SitesVO selectSite(String siteId) throws br.com.gcm.exceptions.ProxyCallException {
                
                 br.com.gcm.ejb.sb.SitesSBHome home;
                
                 br.com.gcm.ejb.sb.SitesSB remote;
                
                 SitesVO obj = null;
                
                 try {
                
                 home = (br.com.gcm.ejb.sb.SitesSBHome)br.com.gcm.servicelocator.ServiceLocator.getInstance().getRemoteHome(br.com.gcm.servicelocator.JndiNames.JNDI_EJB_SB_SITESSB, br.com.gcm.ejb.sb.SitesSBHome.class);
                
                 remote = home.create();
                
                LINE 50 obj = remote.selectSite(Integer.parseInt(siteId));
                LINE 51 }
                LINE 52 catch ( Exception ex ) {
                LINE 53 ex.printStackTrace();
                LINE 54 throw new br.com.gcm.exceptions.ProxyCallException(ex.getMessage());
                 }
                
                 remote = null;
                 home = null;
                
                 return obj;
                 }


                • 5. Re: Jndi Datasource
                  peterj

                  "unknown source" means that the code in question was not compiled with the debugging option, therefore a line number cannot be reported.

                  Are you seeing any exceptions on the server?

                  • 6. Re: Jndi Datasource
                    allanrj

                    Yes, follow part of exception when i run client

                    2008-02-29 14:21:57,034 DEBUG [org.jboss.remoting.transport.socket.ClientSocketWrapper] reset timeout: 60000
                    2008-02-29 14:21:57,050 ERROR [STDERR] javax.naming.NameNotFoundException: APAESP not bound
                    2008-02-29 14:21:57,050 ERROR [STDERR] at br.com.gcm.servicelocator.ServiceLocator.getDataSource(Unknown Source)
                    2008-02-29 14:21:57,050 ERROR [STDERR] at br.com.gcm.ejb.sb.SitesSBBean.makeConnection(Unknown Source)
                    2008-02-29 14:21:57,050 ERROR [STDERR] at br.com.gcm.ejb.sb.SitesSBBean.selectSite(Unknown Source)
                    2008-02-29 14:21:57,050 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                    2008-02-29 14:21:57,050 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                    2008-02-29 14:21:57,050 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                    2008-02-29 14:21:57,050 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
                    


                    • 7. Re: Jndi Datasource
                      peterj

                      Use the JMC console to get a listing of the jndi tree, and make sure htat the data source name appears as expected. See http://wiki.jboss.org/wiki/Wiki.jsp?page=DisplayTheJDNITreeWithTheJMXConsole

                      • 8. Re: Jndi Datasource
                        allanrj

                        Well i solve with this

                        DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/APAESP");


                        thankz 4 help