Announcement Announcement Module
Collapse
No announcement yet.
Accessing-EJB-SSL Err:javax.naming.NoInitialContextExceptio Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Accessing-EJB-SSL Err:javax.naming.NoInitialContextExceptio


    Hi All ,

    While Trying to Access the Deployed StaelessSession Bean I am gettig Error like this

    INFO: Creating shared instance of singleton bean 'echoService'
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'echoService' defined in resource loaded through InputStream: Initialization of bean failed; nested exception is javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    at javax.naming.spi.NamingManager.getInitialContext(U nknown Source)
    at javax.naming.InitialContext.getDefaultInitCtx(Unkn own Source)
    at javax.naming.InitialContext.getURLOrDefaultInitCtx (Unknown Source)
    at javax.naming.InitialContext.lookup(Unknown Source)
    at org.springframework.jndi.JndiTemplate$1.doInContex t(JndiTemplate.java:123)
    at org.springframework.jndi.JndiTemplate.execute(Jndi Template.java:85)
    at org.springframework.jndi.JndiTemplate.lookup(JndiT emplate.java:121)
    at org.springframework.jndi.JndiLocatorSupport.lookup (JndiLocatorSupport.java:71)
    at org.springframework.jndi.JndiObjectLocator.lookup( JndiObjectLocator.java:85)
    at org.springframework.ejb.access.AbstractSlsbInvoker Interceptor.refreshHome(AbstractSlsbInvokerInterce ptor.java:102)
    at org.springframework.ejb.access.AbstractSlsbInvoker Interceptor.afterPropertiesSet(AbstractSlsbInvoker Interceptor.java:90)
    at org.springframework.ejb.access.SimpleRemoteStatele ssSessionProxyFactoryBean.afterPropertiesSet(Simpl eRemoteStatelessSessionProxyFactoryBean.java:95)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1065)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:343)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:260)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:221)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:145)
    at Executor.main(Executor.java:40)



    THINGS I HAVE DONE




    I Have Deployed a StateLessSessionBean in
    jboss-3.0.4_tomcat-4.1.12 with
    Spring1.1.4 while deploying it is showing the Following


    Bean : EchoServiceEJB
    Method : public abstract EchoServiceRemote create() throws CreateException
    Section: 6.10.6
    Warning: The method return values in the home interface must be of valid types for RMI/IIOP.

    18:14:41,468 INFO [EJBDeployer]
    Bean : EchoServiceEJB
    Method : public abstract EchoServiceRemote create() throws CreateException
    Section: 6.10.6
    Warning: The methods in the home interface must include java.rmi.RemoteException in their throws clause.

    18:14:41,468 INFO [EJBDeployer]
    Bean : EchoServiceEJB
    Method : public abstract String echo(String)
    Section: 6.10.5
    Warning: The methods in the remote interface must include java.rmi.RemoteException in their throws clause.


    But it is Showing that the bean is bean is been deployed and started.

    Files the JarFile Contains Are :
    EchoService Interface
    EchoServiceImpl Class

    EchoServiceRemote Interface
    EchoServceHome Interface
    EchoServiceEJB Class

    WEB-INF/applicationContext.xml
    -------------------------------------

    <bean id="EchoServiceImpl" class="spn.EchoServiceImpl" />
    <bean id="EchoServiceEJB" class="spn.EchoServiceEJB">
    <property name="service">
    <ref local="EchoServiceImpl" />
    </property>
    </bean>

    META-INF/ejb-jar.xml
    --------------------------
    <ejb-jar>
    <enterprise-beans>
    <session>
    <ejb-name>EchoServiceEJB</ejb-name>
    <home>spn.EchoServiceHome</home>
    <remote>spn.EchoServiceRemote</remote>
    <ejb-class>spn.EchoServiceEJB</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    <env-entry>
    <env-entry-name>ejb/BeanFactoryPath</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>applicationContext.xml</env-entry-value>
    </env-entry>
    </session>
    </enterprise-beans>

    <assembly-descriptor>
    <container-transaction>
    <method>
    <ejb-name>EchoServiceEJB</ejb-name>
    <method-intf>Remote</method-intf>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>


    META-INF/jboss.xml
    -----------------------
    <jboss>
    <enterprise-beans>
    <session>
    <ejb-name>EchoServiceEJB</ejb-name>
    <jndi-name>ejb/echoService</jndi-name>
    </session>
    </enterprise-beans>
    </jboss>




    IN The Client Side:
    ---------------------

    BeanCofig.xml
    -----------------
    <bean id="echoService" class="org.springframework.ejb.access.SimpleRemote StatelessSessionProxyFactoryBean">
    <property name="jndiName">
    <value>ejb/echoService</value>
    </property>
    <property name="resourceRef">
    <value>true</value>
    </property>
    <property name="businessInterface">
    <value>spn.EchoService</value>
    </property>
    </bean>
    MainProgramm Accessign the bean From where the Err is thrown
    ---------------------------------------------------------------------------

    InputStream beanConfigFile = new FileInputStream("C:\\SpringPersist\\BeanConfigFile .xml");
    BeanFactory factory =(BeanFactory) new XmlBeanFactory(beanConfigFile);
    EchoService remoteBean=(EchoService)factory.getBean("echoServi ce");
    System.out.println(remoteBean);

    IS THERE ANY SOLUTION TO THIS ?????

  • #2
    You have to set the "jndiTemplate" or "jndiEnvironment" property of your factory bean. Otherwise spring cannot find out how to create an InitialContext to contact the server.

    Besides that you have to make available to JBoss client jars to your application.

    Regards,
    Andreas

    Comment


    • #3
      Addition: When accessing your bean from outside the container, you should set "resourceRef" to false.

      Regards,
      Andreas

      Comment


      • #4
        Thanx Can u Give me a Sample

        Hi Andreas

        Thanx for the help

        Can u give me an sample for this.

        I think this jndiTemplate should be inserted into this piece of XML ,is that right ?
        .

        <bean id="echoService" class="org.springframework.ejb.access.SimpleRemote StatelessSessionProxyFactoryBean">
        <property name="jndiName">
        <value>ejb/echoService</value>
        </property>
        <property name="resourceRef">
        <value>true</value>
        </property>
        <property name="businessInterface">
        <value>spn.EchoService</value>
        </property>
        </bean>

        That is in the client side , Am i right ? if not please specify where to add the jndiTemplate??with a smaple.
        I am NOT using any LDAP .

        Than for your patience.

        Comment


        • #5
          Re: Thanx Can u Give me a Sample

          Code:
              <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
                  <property name="environment">
                      <value>
                      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
                      java.naming.provider.url=localhost&#58;1099
                      java.naming.factory.url.pkgs=org.jboss.naming
                      </value>
                  </property>
              </bean>
          
          <bean id="echoService" class="org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean">
          		   <property name="jndiName">
          				<value>ejb/echoService</value>
          		   </property>
          		   <property name="jndiTemplate">
          				<ref local="jndiTemplate"/>
          		   </property>
          		   <property name="businessInterface">
          				<value>spn.EchoService</value>
          		   </property>
          	</bean>
          In the example a local server on port 1099 is assumed. You may have to adjust that to your environment. For the jars required by your client please refer to the JBoss reference.

          That is in the client side , Am i right ?
          Yes, you are.

          Regards,
          Andreas

          Comment


          • #6
            Thanx. ProxyOBJ Got But Not able to invoke methods.


            Hi Andreas , Thanx.

            Ive got the proxy session object and ive printed the object i have got
            EchoService remoteBean=(EchoService)factory.getBean("echoServi ce");
            System.out.println(remoteBean);

            it is showing "ejb/echoService:Stateless"

            but when i try to invoke the echo method on this remoteBean object as
            remoteBean.echo("Hi All");


            I am getting error on server side as follows :




            20:31:26,078 ERROR [LogInterceptor] EJBException, causedBy:
            org.springframework.beans.factory.BeanDefinitionSt oreException: IOException parsing XML document from class path resource [applicationContext.xml]; nested exception is java.io.FileNotFoundException: Could not open class path resource [applicationContext.xml]
            java.io.FileNotFoundException: Could not open class path resource [applicationContext.xml]
            at org.springframework.core.io.ClassPathResource.getI nputStream(ClassPathResource.java:109)
            at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:129)
            at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:83)
            at org.springframework.context.support.AbstractXmlApp licationContext.loadBeanDefinitions(AbstractXmlApp licationContext.java:101)
            at org.springframework.context.support.AbstractXmlApp licationContext.loadBeanDefinitions(AbstractXmlApp licationContext.java:69)
            at org.springframework.context.support.AbstractRefres hableApplicationContext.refreshBeanFactory(Abstrac tRefreshableApplicationContext.java:87)
            at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:262)
            at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:80)
            at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:65)
            at org.springframework.context.access.ContextJndiBean FactoryLocator.createBeanFactory(ContextJndiBeanFa ctoryLocator.java:40)
            at org.springframework.beans.factory.access.JndiBeanF actoryLocator.useBeanFactory(JndiBeanFactoryLocato r.java:68)
            at org.springframework.ejb.support.AbstractEnterprise Bean.loadBeanFactory(AbstractEnterpriseBean.java:1 15)
            at org.springframework.ejb.support.AbstractStatelessS essionBean.ejbCreate(AbstractStatelessSessionBean. java:63)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at org.jboss.ejb.StatelessSessionEnterpriseContext.<i nit>(StatelessSessionEnterpriseContext.java:52)
            at org.jboss.ejb.plugins.StatelessSessionInstancePool .create(StatelessSessionInstancePool.java:61)
            at org.jboss.ejb.plugins.AbstractInstancePool.get(Abs tractInstancePool.java:209)
            at org.jboss.ejb.plugins.StatelessSessionInstanceInte rceptor.invoke(StatelessSessionInstanceInterceptor .java:63)
            at org.jboss.ejb.plugins.AbstractTxInterceptor.invoke Next(AbstractTxInterceptor.java:107)
            at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTran sactions(TxInterceptorCMT.java:178)
            at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxIn terceptorCMT.java:60)
            at org.jboss.ejb.plugins.SecurityInterceptor.invoke(S ecurityInterceptor.java:130)
            at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInt erceptor.java:204)
            at org.jboss.ejb.StatelessSessionContainer.invoke(Sta telessSessionContainer.java:313)
            at org.jboss.ejb.Container.invoke(Container.java:712)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanSe rverImpl.java:517)
            at org.jboss.invocation.jrmp.server.JRMPInvoker.invok e(JRMPInvoker.java:382)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at sun.rmi.server.UnicastServerRef.dispatch(UnicastSe rverRef.java:261)
            at sun.rmi.transport.Transport$1.run(Transport.java:1 48)
            at java.security.AccessController.doPrivileged(Native Method)
            at sun.rmi.transport.Transport.serviceCall(Transport. java:144)
            at sun.rmi.transport.tcp.TCPTransport.handleMessages( TCPTransport.java:460)
            at sun.rmi.transport.tcp.TCPTransport$ConnectionHandl er.run(TCPTransport.java:701)
            at java.lang.Thread.run(Thread.java:536)
            20:31:26,140 INFO [ContextJndiBeanFactoryLocator] BeanFactoryPath from JNDI is [applicationContext.xml]
            20:31:26,140 INFO [XmlBeanDefinitionReader] Loading XML bean definitions from class path resource [applicationContext.xml]
            20:31:26,171 ERROR [LogInterceptor] EJBException, causedBy:
            org.springframework.beans.factory.BeanDefinitionSt oreException: IOException parsing XML document from class path resource [applicationContext.xml]; nested exception is java.io.FileNotFoundException: Could not open class path resource [applicationContext.xml]
            java.io.FileNotFoundException: Could not open class path resource [applicationContext.xml]
            at org.springframework.core.io.ClassPathResource.getI nputStream(ClassPathResource.java:109)
            at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:129)
            at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:83)
            at org.springframework.context.support.AbstractXmlApp licationContext.loadBeanDefinitions(AbstractXmlApp licationContext.java:101)


            And In The Client Side as





            java.lang.reflect.UndeclaredThrowableException
            at $Proxy2.echo(Unknown Source)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at org.springframework.remoting.rmi.RmiClientIntercep torUtils.doInvoke(RmiClientInterceptorUtils.java:9 8)
            at org.springframework.ejb.access.SimpleRemoteSlsbInv okerInterceptor.doInvoke(SimpleRemoteSlsbInvokerIn terceptor.java:75)
            at org.springframework.ejb.access.AbstractRemoteSlsbI nvokerInterceptor.invoke(AbstractRemoteSlsbInvoker Interceptor.java:78)
            at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :144)
            at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:174)
            at $Proxy1.echo(Unknown Source)
            at Executor.main(Executor.java:42)
            Caused by: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
            java.rmi.ServerException: EJBException:; nested exception is:
            javax.ejb.EJBException: nested exception is: org.springframework.beans.factory.BeanDefinitionSt oreException: IOException parsing XML document from class path resource [applicationContext.xml]; nested exception is java.io.FileNotFoundException: Could not open class path resource [applicationContext.xml]
            at sun.rmi.server.UnicastServerRef.dispatch(UnicastSe rverRef.java:292)
            at sun.rmi.transport.Transport$1.run(Transport.java:1 48)
            at java.security.AccessController.doPrivileged(Native Method)
            at sun.rmi.transport.Transport.serviceCall(Transport. java:144)
            at sun.rmi.transport.tcp.TCPTransport.handleMessages( TCPTransport.java:460)
            at sun.rmi.transport.tcp.TCPTransport$ConnectionHandl er.run(TCPTransport.java:701)
            at java.lang.Thread.run(Thread.java:536)
            at sun.rmi.transport.StreamRemoteCall.exceptionReceiv edFromServer(Unknown Source)
            at sun.rmi.transport.StreamRemoteCall.executeCall(Unk nown Source)
            at sun.rmi.server.UnicastRef.invoke(Unknown Source)
            at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub. invoke(Unknown Source)
            at org.jboss.invocation.jrmp.interfaces.JRMPInvokerPr oxy.invoke(JRMPInvokerProxy.java:138)
            at org.jboss.invocation.InvokerInterceptor.invoke(Inv okerInterceptor.java:108)
            at org.jboss.proxy.TransactionInterceptor.invoke(Tran sactionInterceptor.java:77)
            at org.jboss.proxy.SecurityInterceptor.invoke(Securit yInterceptor.java:80)
            at org.jboss.proxy.ejb.StatelessSessionInterceptor.in voke(StatelessSessionInterceptor.java:111)
            at org.jboss.proxy.ClientContainer.invoke(ClientConta iner.java:76)
            ... 12 more
            Caused by: java.rmi.ServerException: EJBException:; nested exception is:
            javax.ejb.EJBException: nested exception is: org.springframework.beans.factory.BeanDefinitionSt oreException: IOException parsing XML document from class path resource [applicationContext.xml]; nested exception is java.io.FileNotFoundException: Could not open class path resource [applicationContext.xml]
            at org.jboss.ejb.plugins.LogInterceptor.handleExcepti on(LogInterceptor.java:357)
            at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInt erceptor.java:208)
            at org.jboss.ejb.StatelessSessionContainer.invoke(Sta telessSessionContainer.java:313)
            at org.jboss.ejb.Container.invoke(Container.java:712)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanSe rverImpl.java:517)
            at org.jboss.invocation.jrmp.server.JRMPInvoker.invok e(JRMPInvoker.java:382)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at sun.rmi.server.UnicastServerRef.dispatch(UnicastSe rverRef.java:261)
            at sun.rmi.transport.Transport$1.run(Transport.java:1 48)
            at java.security.AccessController.doPrivileged(Native Method)
            at sun.rmi.transport.Transport.serviceCall(Transport. java:144)
            at sun.rmi.transport.tcp.TCPTransport.handleMessages( TCPTransport.java:460)
            at sun.rmi.transport.tcp.TCPTransport$ConnectionHandl er.run(TCPTransport.java:701)
            at java.lang.Thread.run(Thread.java:536)
            Caused by: javax.ejb.EJBException: nested exception is: org.springframework.beans.factory.BeanDefinitionSt oreException: IOException parsing XML document from class path resource [applicationContext.xml]; nested exception is java.io.FileNotFoundException: Could not open class path resource [applicationContext.xml]
            at org.jboss.ejb.StatelessSessionEnterpriseContext.<i nit>(StatelessSessionEnterpriseContext.java:59)
            at org.jboss.ejb.plugins.StatelessSessionInstancePool .create(StatelessSessionInstancePool.java:61)
            at org.jboss.ejb.plugins.AbstractInstancePool.get(Abs tractInstancePool.java:209)
            at org.jboss.ejb.plugins.StatelessSessionInstanceInte rceptor.invoke(StatelessSessionInstanceInterceptor .java:63)
            at org.jboss.ejb.plugins.AbstractTxInterceptor.invoke Next(AbstractTxInterceptor.java:107)
            at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTran sactions(TxInterceptorCMT.java:178)
            at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxIn terceptorCMT.java:60)
            at org.jboss.ejb.plugins.SecurityInterceptor.invoke(S ecurityInterceptor.java:130)
            at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInt erceptor.java:204)
            ... 15 more




            My applicationContext.xml entry is :
            -----------------------------------------
            <?xml version="1.0" encoding="UTF-8"?>
            <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
            <beans default-autowire="autodetect">
            <bean id="EchoServiceImpl" class="spn.EchoServiceImpl" />
            <bean id="EchoServiceEJB" class="spn.EchoServiceEJB">
            <property name="service">
            <ref local="EchoServiceImpl" />
            </property>
            </bean>
            </beans>

            I have placed this applicationContext.xml in WEB-INF

            How do i solve this .??Please help.Thanx.

            Comment


            • #7
              Is the Problem due to this

              Hi Andreas ,

              While deploying , in the server i see this ,



              20:30:55,125 INFO [EJBDeployer]
              Bean : EchoServiceEJB
              Method : public abstract EchoServiceRemote create() throws CreateException
              Section: 6.10.6
              Warning: The method return values in the home interface must be of valid types for RMI/IIOP.

              20:30:55,125 INFO [EJBDeployer]
              Bean : EchoServiceEJB
              Method : public abstract EchoServiceRemote create() throws CreateException
              Section: 6.10.6
              Warning: The methods in the home interface must include java.rmi.RemoteException in their throws clause.

              20:30:55,125 INFO [EJBDeployer]
              Bean : EchoServiceEJB
              Method : public abstract String echo(String)
              Section: 6.10.5
              Warning: The methods in the remote interface must include java.rmi.RemoteException in their throws clause.

              20:30:55,140 INFO [EjbModule] Creating
              20:30:55,140 INFO [EjbModule] Deploying EchoServiceEJB
              20:30:55,156 INFO [EjbModule] Created
              20:30:55,156 INFO [EjbModule] Starting


              Is the Error whic i have mentioned earlier is due to this ???

              thanx.sathya.

              Comment


              • #8
                It seems like your applicationContext.xml file is not in your classpath.

                Regards,
                Andreas

                Comment


                • #9
                  The warnings you encounter indicate that your methods do not declare to throw RemoteException as is required by the EJB specification.
                  I recommend to have a look at some documentation/tutorial concerning EJBs for more details on EJB requirements. A good starting point would be at java.sun.com.

                  Regards,
                  Andreas

                  Comment


                  • #10
                    Those Errors Corrected.I am aware of EJB's.


                    Hi Andreas ,i've put my applicationontext.xml in the classpath and added the throw clause.Now i am getting an error like this in the server side .please guide me.


                    Code:
                    21&#58;39&#58;35,562 INFO  &#91;DefaultListableBeanFactory&#93; Creating shared instance of singleton bean 'EchoServiceEJB'
                    21&#58;39&#58;35,593 ERROR &#91;LogInterceptor&#93; EJBException, causedBy&#58;
                    org.springframework.beans.factory.NoSuchBeanDefinitionException&#58; No bean named 'echoService' is defined&#58; org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans &#91;EchoServiceImpl,EchoServiceEJB&#93;; root of BeanFactory hierarchy
                            at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition&#40;DefaultListableBeanFactory.java&#58;356&#41;
                            at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition&#40;AbstractBeanFactory.java&#58;583&#41;
                            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean&#40;AbstractBeanFactory.java&#58;193&#41;
                            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean&#40;AbstractBeanFactory.java&#58;145&#41;
                            at org.springframework.context.support.AbstractApplicationContext.getBean&#40;AbstractApplicationContext.java&#58;504&#41;
                            at spn.EchoServiceEJB.onEjbCreate&#40;EchoServiceEJB.java&#58;34&#41;
                            at org.springframework.ejb.support.AbstractStatelessSessionBean.ejbCreate&#40;AbstractStatelessSessionBean.java&#58;64&#41;
                            at sun.reflect.NativeMethodAccessorImpl.invoke0&#40;Native Method&#41;
                            at sun.reflect.NativeMethodAccessorImpl.invoke&#40;NativeMethodAccessorImpl.java&#58;39&#41;
                            at sun.reflect.DelegatingMethodAccessorImpl.invoke&#40;DelegatingMethodAccessorImpl.java&#58;25&#41;
                            at java.lang.reflect.Method.invoke&#40;Method.java&#58;324&#41;
                            at org.jboss.ejb.StatelessSessionEnterpriseContext.<init>&#40;StatelessSessionEnterpriseContext.java&#58;52&#41;
                            at org.jboss.ejb.plugins.StatelessSessionInstancePool.create&#40;StatelessSessionInstancePool.java&#58;61&#41;
                            at org.jboss.ejb.plugins.AbstractInstancePool.get&#40;AbstractInstancePool.java&#58;209&#41;
                            at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke&#40;StatelessSessionInstanceInterceptor.java&#58;63&#41;
                            at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext&#40;AbstractTxInterceptor.java&#58;107&#41;
                            at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions&#40;TxInterceptorCMT.java&#58;178&#41;
                            at org.jboss.ejb.plugins.TxInterceptorCMT.invoke&#40;TxInterceptorCMT.java&#58;60&#41;
                            at org.jboss.ejb.plugins.SecurityInterceptor.invoke&#40;SecurityInterceptor.java&#58;130&#41;
                            at org.jboss.ejb.plugins.LogInterceptor.invoke&#40;LogInterceptor.java&#58;204&#41;
                            at org.jboss.ejb.StatelessSessionContainer.invoke&#40;StatelessSessionContainer.java&#58;313&#41;
                            at org.jboss.ejb.Container.invoke&#40;Container.java&#58;712&#41;
                            at org.jboss.mx.server.MBeanServerImpl.invoke&#40;MBeanServerImpl.java&#58;517&#41;
                            at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke&#40;JRMPInvoker.java&#58;382&#41;
                            at sun.reflect.NativeMethodAccessorImpl.invoke0&#40;Native Method&#41;
                            at sun.reflect.NativeMethodAccessorImpl.invoke&#40;NativeMethodAccessorImpl.java&#58;39&#41;
                            at sun.reflect.DelegatingMethodAccessorImpl.invoke&#40;DelegatingMethodAccessorImpl.java&#58;25&#41;
                            at java.lang.reflect.Method.invoke&#40;Method.java&#58;324&#41;
                            at sun.rmi.server.UnicastServerRef.dispatch&#40;UnicastServerRef.java&#58;261&#41;
                            at sun.rmi.transport.Transport$1.run&#40;Transport.java&#58;148&#41;
                            at java.security.AccessController.doPrivileged&#40;Native Method&#41;
                            at sun.rmi.transport.Transport.serviceCall&#40;Transport.java&#58;144&#41;
                            at sun.rmi.transport.tcp.TCPTransport.handleMessages&#40;TCPTransport.java&#58;460&#41;
                            at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run&#40;TCPTransport.java&#58;701&#41;
                            at java.lang.Thread.run&#40;Thread.java&#58;536&#41;
                    21&#58;39&#58;35,687 INFO  &#91;ContextJndiBeanFactoryLocator&#93; BeanFactoryPath from JNDI is &#91;applicationContext.xml&#93;
                    21&#58;39&#58;35,687 INFO  &#91;XmlBeanDefinitionReader&#93; Loading XML bean definitions from class path resource &#91;applicationContext.xml&#93;
                    21&#58;39&#58;35,687 INFO  &#91;ClassPathXmlApplicationContext&#93; Bean factory for application context &#91;org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=15911276&#93;&#58; org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans &#91;EchoServiceImpl,EchoServiceEJB&#93;; root of BeanFactory hierarchy
                    21&#58;39&#58;35,687 INFO  &#91;ClassPathXmlApplicationContext&#93; 2 beans defined in application context &#91;org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=15911276&#93;
                    21&#58;39&#58;35,687 INFO  &#91;ClassPathXmlApplicationContext&#93; Unable to locate MessageSource with name 'messageSource'&#58; using default &#91;org.springframework.context.support.StaticMessageSource&#58; &#123;&#125;&#93;
                    21&#58;39&#58;35,687 INFO  &#91;ClassPathXmlApplicationContext&#93; Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster'&#58; using default &#91;org.springframework.context.event.SimpleApplicationEventMulticaster@1e9f5cc&#93;
                    21&#58;39&#58;35,687 INFO  &#91;DefaultListableBeanFactory&#93; Pre-instantiating singletons in factory &#91;org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans &#91;EchoServiceImpl,EchoServiceEJB&#93;; root of BeanFactory hierarchy&#93;
                    21&#58;39&#58;35,687 INFO  &#91;DefaultListableBeanFactory&#93; Creating shared instance of singleton bean 'EchoServiceImpl'
                    21&#58;39&#58;35,703 INFO  &#91;DefaultListableBeanFactory&#93; Creating shared instance of singleton bean 'EchoServiceEJB'
                    21&#58;39&#58;35,718 ERROR &#91;LogInterceptor&#93; EJBException, causedBy&#58;
                    In the client side as

                    Code:
                    java.lang.reflect.UndeclaredThrowableException
                    	at $Proxy2.echo&#40;Unknown Source&#41;
                    	at sun.reflect.NativeMethodAccessorImpl.invoke0&#40;Native Method&#41;
                    	at sun.reflect.NativeMethodAccessorImpl.invoke&#40;Unknown Source&#41;
                    	at sun.reflect.DelegatingMethodAccessorImpl.invoke&#40;Unknown Source&#41;
                    	at java.lang.reflect.Method.invoke&#40;Unknown Source&#41;
                    	at org.springframework.remoting.rmi.RmiClientInterceptorUtils.doInvoke&#40;RmiClientInterceptorUtils.java&#58;98&#41;
                    	at org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.doInvoke&#40;SimpleRemoteSlsbInvokerInterceptor.java&#58;75&#41;
                    	at org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor.invoke&#40;AbstractRemoteSlsbInvokerInterceptor.java&#58;78&#41;
                    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed&#40;ReflectiveMethodInvocation.java&#58;144&#41;
                    	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke&#40;JdkDynamicAopProxy.java&#58;174&#41;
                    	at $Proxy1.echo&#40;Unknown Source&#41;
                    	at Executor.main&#40;Executor.java&#58;42&#41;
                    Caused by&#58; java.rmi.ServerException&#58; RemoteException occurred in server thread; nested exception is&#58; 
                    	java.rmi.ServerException&#58; EJBException&#58;; nested exception is&#58; 
                    	javax.ejb.EJBException&#58; nested exception is&#58; org.springframework.beans.factory.NoSuchBeanDefinitionException&#58; No bean named 'echoService' is defined&#58; org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans &#91;EchoServiceImpl,EchoServiceEJB&#93;; root of BeanFactory hierarchy
                    	at sun.rmi.server.UnicastServerRef.dispatch&#40;UnicastServerRef.java&#58;292&#41;
                    	at sun.rmi.transport.Transport$1.run&#40;Transport.java&#58;148&#41;
                    	at java.security.AccessController.doPrivileged&#40;Native Method&#41;
                    	at sun.rmi.transport.Transport.serviceCall&#40;Transport.java&#58;144&#41;
                    	at sun.rmi.transport.tcp.TCPTransport.handleMessages&#40;TCPTransport.java&#58;460&#41;
                    	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run&#40;TCPTransport.java&#58;701&#41;
                    	at java.lang.Thread.run&#40;Thread.java&#58;536&#41;
                    	at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer&#40;Unknown Source&#41;
                    	at sun.rmi.transport.StreamRemoteCall.executeCall&#40;Unknown Source&#41;
                    	at sun.rmi.server.UnicastRef.invoke&#40;Unknown Source&#41;
                    	at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke&#40;Unknown Source&#41;
                    	at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke&#40;JRMPInvokerProxy.java&#58;138&#41;
                    	at org.jboss.invocation.InvokerInterceptor.invoke&#40;InvokerInterceptor.java&#58;108&#41;
                    	at org.jboss.proxy.TransactionInterceptor.invoke&#40;TransactionInterceptor.java&#58;77&#41;
                    	at org.jboss.proxy.SecurityInterceptor.invoke&#40;SecurityInterceptor.java&#58;80&#41;
                    	at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke&#40;StatelessSessionInterceptor.java&#58;111&#41;
                    	at org.jboss.proxy.ClientContainer.invoke&#40;ClientContainer.java&#58;76&#41;
                    	... 12 more

                    Comment


                    • #11
                      HI please get me through this .

                      Hi Andreas ,i've put my applicationontext.xml in the classpath and added the throw clause.Now i am getting an error like this in the server side .please guide me.


                      Code:

                      21:39:35,562 INFO [DefaultListableBeanFactory] Creating shared instance of singleton bean 'EchoServiceEJB'
                      21:39:35,593 ERROR [LogInterceptor] EJBException, causedBy:
                      org.springframework.beans.factory.NoSuchBeanDefini tionException: No bean named 'echoService' is defined: org.springframework.beans.factory.support.DefaultL istableBeanFactory defining beans [EchoServiceImpl,EchoServiceEJB]; root of BeanFactory hierarchy
                      at org.springframework.beans.factory.support.DefaultL istableBeanFactory.getBeanDefinition(DefaultListab leBeanFactory.java:356)
                      at org.springframework.beans.factory.support.Abstract BeanFactory.getMergedBeanDefinition(AbstractBeanFa ctory.java:583)
                      at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:193)
                      at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:145)
                      at org.springframework.context.support.AbstractApplic ationContext.getBean(AbstractApplicationContext.ja va:504)
                      at spn.EchoServiceEJB.onEjbCreate(EchoServiceEJB.java :34)
                      at org.springframework.ejb.support.AbstractStatelessS essionBean.ejbCreate(AbstractStatelessSessionBean. java:64)
                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
                      at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
                      at java.lang.reflect.Method.invoke(Method.java:324)
                      at org.jboss.ejb.StatelessSessionEnterpriseContext.<i nit>(StatelessSessionEnterpriseContext.java:52)
                      at org.jboss.ejb.plugins.StatelessSessionInstancePool .create(StatelessSessionInstancePool.java:61)
                      at org.jboss.ejb.plugins.AbstractInstancePool.get(Abs tractInstancePool.java:209)
                      at org.jboss.ejb.plugins.StatelessSessionInstanceInte rceptor.invoke(StatelessSessionInstanceInterceptor .java:63)
                      at org.jboss.ejb.plugins.AbstractTxInterceptor.invoke Next(AbstractTxInterceptor.java:107)
                      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTran sactions(TxInterceptorCMT.java:178)
                      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxIn terceptorCMT.java:60)
                      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(S ecurityInterceptor.java:130)
                      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInt erceptor.java:204)
                      at org.jboss.ejb.StatelessSessionContainer.invoke(Sta telessSessionContainer.java:313)
                      at org.jboss.ejb.Container.invoke(Container.java:712)
                      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanSe rverImpl.java:517)
                      at org.jboss.invocation.jrmp.server.JRMPInvoker.invok e(JRMPInvoker.java:382)
                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
                      at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
                      at java.lang.reflect.Method.invoke(Method.java:324)
                      at sun.rmi.server.UnicastServerRef.dispatch(UnicastSe rverRef.java:261)
                      at sun.rmi.transport.Transport$1.run(Transport.java:1 48)
                      at java.security.AccessController.doPrivileged(Native Method)
                      at sun.rmi.transport.Transport.serviceCall(Transport. java:144)
                      at sun.rmi.transport.tcp.TCPTransport.handleMessages( TCPTransport.java:460)
                      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandl er.run(TCPTransport.java:701)
                      at java.lang.Thread.run(Thread.java:536)
                      21:39:35,687 INFO [ContextJndiBeanFactoryLocator] BeanFactoryPath from JNDI is [applicationContext.xml]
                      21:39:35,687 INFO [XmlBeanDefinitionReader] Loading XML bean definitions from class path resource [applicationContext.xml]
                      21:39:35,687 INFO [ClassPathXmlApplicationContext] Bean factory for application context [org.springframework.context.support.ClassPathXmlAp plicationContext;hashCode=15911276]: org.springframework.beans.factory.support.DefaultL istableBeanFactory defining beans [EchoServiceImpl,EchoServiceEJB]; root of BeanFactory hierarchy
                      21:39:35,687 INFO [ClassPathXmlApplicationContext] 2 beans defined in application context [org.springframework.context.support.ClassPathXmlAp plicationContext;hashCode=15911276]
                      21:39:35,687 INFO [ClassPathXmlApplicationContext] Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.StaticMessageS ource: {}]
                      21:39:35,687 INFO [ClassPathXmlApplicationContext] Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicatio nEventMulticaster@1e9f5cc]
                      21:39:35,687 INFO [DefaultListableBeanFactory] Pre-instantiating singletons in factory [org.springframework.beans.factory.support.DefaultL istableBeanFactory defining beans [EchoServiceImpl,EchoServiceEJB]; root of BeanFactory hierarchy]
                      21:39:35,687 INFO [DefaultListableBeanFactory] Creating shared instance of singleton bean 'EchoServiceImpl'
                      21:39:35,703 INFO [DefaultListableBeanFactory] Creating shared instance of singleton bean 'EchoServiceEJB'
                      21:39:35,718 ERROR [LogInterceptor] EJBException, causedBy:


                      In the client side as

                      Code:


                      java.lang.reflect.UndeclaredThrowableException
                      at $Proxy2.echo(Unknown Source)
                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
                      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
                      at java.lang.reflect.Method.invoke(Unknown Source)
                      at org.springframework.remoting.rmi.RmiClientIntercep torUtils.doInvoke(RmiClientInterceptorUtils.java:9 8)
                      at org.springframework.ejb.access.SimpleRemoteSlsbInv okerInterceptor.doInvoke(SimpleRemoteSlsbInvokerIn terceptor.java:75)
                      at org.springframework.ejb.access.AbstractRemoteSlsbI nvokerInterceptor.invoke(AbstractRemoteSlsbInvoker Interceptor.java:78)
                      at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :144)
                      at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:174)
                      at $Proxy1.echo(Unknown Source)
                      at Executor.main(Executor.java:42)
                      Caused by: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
                      java.rmi.ServerException: EJBException:; nested exception is:
                      javax.ejb.EJBException: nested exception is: org.springframework.beans.factory.NoSuchBeanDefini tionException: No bean named 'echoService' is defined: org.springframework.beans.factory.support.DefaultL istableBeanFactory defining beans [EchoServiceImpl,EchoServiceEJB]; root of BeanFactory hierarchy
                      at sun.rmi.server.UnicastServerRef.dispatch(UnicastSe rverRef.java:292)
                      at sun.rmi.transport.Transport$1.run(Transport.java:1 48)
                      at java.security.AccessController.doPrivileged(Native Method)
                      at sun.rmi.transport.Transport.serviceCall(Transport. java:144)
                      at sun.rmi.transport.tcp.TCPTransport.handleMessages( TCPTransport.java:460)
                      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandl er.run(TCPTransport.java:701)
                      at java.lang.Thread.run(Thread.java:536)
                      at sun.rmi.transport.StreamRemoteCall.exceptionReceiv edFromServer(Unknown Source)
                      at sun.rmi.transport.StreamRemoteCall.executeCall(Unk nown Source)
                      at sun.rmi.server.UnicastRef.invoke(Unknown Source)
                      at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub. invoke(Unknown Source)
                      at org.jboss.invocation.jrmp.interfaces.JRMPInvokerPr oxy.invoke(JRMPInvokerProxy.java:138)
                      at org.jboss.invocation.InvokerInterceptor.invoke(Inv okerInterceptor.java:108)
                      at org.jboss.proxy.TransactionInterceptor.invoke(Tran sactionInterceptor.java:77)
                      at org.jboss.proxy.SecurityInterceptor.invoke(Securit yInterceptor.java:80)
                      at org.jboss.proxy.ejb.StatelessSessionInterceptor.in voke(StatelessSessionInterceptor.java:111)
                      at org.jboss.proxy.ClientContainer.invoke(ClientConta iner.java:76)
                      ... 12 more

                      Comment


                      • #12
                        I kindly advise you to consult some documentation about the basics of EJB and Spring. As a starting point, you might have a look here.

                        The described application seems to resemble to what you are trying to achieve. Hope it is useful for you.

                        Regards,
                        Andreas

                        Comment


                        • #13
                          Thanx Mr.Andreas , I am done with the bean.

                          Thanx Mr.Andreas , I am done with the bean.

                          Comment

                          Working...
                          X