0 Replies Latest reply on Jun 27, 2007 3:08 AM by ashutosh sri

    Problem in calling an enity bean from the Stateless bean

    ashutosh sri Newbie

      Hi All ,

      I am facing problem in calling a entity Bean from a Stateless Bean .The call flow goes like this:
      Jsp Page --> Servlet --> Stateless Bean --> Persisting the Data obtained from jsp page into entity bean .

      The jsp page & Servlet are deployed as a separate .war file on the Jboss server while the Stateless bean and the persistence unit is deployed as .ear file on the same Server . When I make a call to persist the values then it throws up an error at the runtime :

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

      Exception Description: Cannot acquire data source [java:/system].
      Internal Exception: javax.naming.InvalidNameException: Not a compound name: system
      12:19:00,984 ERROR [STDERR] at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:220)
      12:19:00,984 ERROR [STDERR] at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:78)
      12:19:00,984 ERROR [STDERR] at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:111)
      12:19:00,984 ERROR [STDERR] at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:105)
      12:19:00,984 ERROR [STDERR] at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:76)
      12:19:00,984 ERROR [STDERR] at src.FirstSessionBean.sayHello(FirstSessionBean.java:23)
      12:19:00,984 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      12:19:00,984 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      12:19:00,984 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      12:19:00,984 ERROR [STDERR] at java.lang.reflect.Method.invoke(Unknown Source)
      12:19:00,984 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
      12:19:00,984 ERROR [STDERR] at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
      12:19:00,984 ERROR [STDERR] at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
      12:19:00,984 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      12:19:00,984 ERROR [STDERR] at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
      12:19:00,984 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      12:19:01,000 ERROR [STDERR] at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)Exception Description: Cannot acquire data source [java:/system].
      Internal Exception: javax.naming.InvalidNameException: Not a compound name: system
      12:19:00,984 ERROR [STDERR] at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:220)
      12:19:00,984 ERROR [STDERR] at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:78)
      12:19:00,984 ERROR [STDERR] at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:111)
      12:19:00,984 ERROR [STDERR] at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:105)
      12:19:00,984 ERROR [STDERR] at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:76)
      12:19:00,984 ERROR [STDERR] at src.FirstSessionBean.sayHello(FirstSessionBean.java:23)
      12:19:00,984 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      12:19:00,984 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      12:19:00,984 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      12:19:00,984 ERROR [STDERR] at java.lang.reflect.Method.invoke(Unknown Source)
      12:19:00,984 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
      12:19:00,984 ERROR [STDERR] at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
      12:19:00,984 ERROR [STDERR] at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
      12:19:00,984 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      12:19:00,984 ERROR [STDERR] at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
      12:19:00,984 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      12:19:01,000 ERROR [STDERR] at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)

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


      The stateless bean call is working fine but the call from stateless bean to the entity bean throws up this error . The name of my data source is "system" and I have my persistence.xml file as this :

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

      <?xml version="1.0" encoding="UTF-8"?>
      <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
      <persistence-unit name="testApp" transaction-type="JTA">
      oracle.toplink.essentials.PersistenceProvider
      <jta-data-source>java:/system</jta-data-source>


      <!-- update to match database-->
      <!-- update to match database-->
      <!-- update to match database-->
      <!-- update to match database-->

      </persistence-unit>



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


      Please provide me some help to figure out the problem