1 Reply Latest reply on Feb 24, 2003 4:48 PM by ABAZIOU

    Problems calling CMR-method

    Morten N Newbie

      HI..

      I have faced a problem calling a CMR-method from a servlet. I get a nasty Null exception, not explaining much. This is the servlet code, the deployment descripttion etc. I hope you can help me.


      ************** Servlet **************
      ..
      ..
      try {
      InitialContext jndi = new InitialContext();
      citizenHome = (CitizenHome) jndi.lookup("CitizenEJB");
      addressHome = (AddressHome) jndi.lookup("AddressEJB");
      } catch (NamingException ne) {
      out.println(ne.getMessage());
      }
      try {
      Collection col = citizenHome.findBySecurityID("0102230434");
      Address address = addressHome.findByPrimaryKey(new Integer(208));
      Iterator i = col.iterator();
      while(i.hasNext()) {
      Citizen c = (Citizen)i.next();
      printCitizenInfo(c, out);
      printAddressInfo(c.getAddress(), out); <-- This one i the one which calls the CMR-method and gets the error!
      }
      ..
      ..



      ************** EJB-JAR.xml **************
      ..
      <ejb-relation>
      <ejb-relation-name>Citizen-Address</ejb-relation-name>
      <ejb-relationship-role>
      <ejb-relationship-role-name>citizen-has-address</ejb-relationship-role-name>
      One
      <relationship-role-source>
      <ejb-name>CitizenEJB</ejb-name>
      </relationship-role-source>
      <cmr-field>
      <cmr-field-name>address</cmr-field-name>
      </cmr-field>
      </ejb-relationship-role>

      <ejb-relationship-role>
      <ejb-relationship-role-name>address-belongs-to-citizen</ejb-relationship-role-name>
      One
      <relationship-role-source>
      <ejb-name>AddressEJB</ejb-name>
      </relationship-role-source>
      <cmr-field>
      <cmr-field-name>citizen</cmr-field-name>
      </cmr-field>
      </ejb-relationship-role>
      </ejb-relation>
      ..
      ..



      ************** JBOSSCMP-JDBC.XML **************
      <ejb-relation>
      <ejb-relation-name>Citizen-Address</ejb-relation-name>
      <foreign-key-mapping/>
      <ejb-relationship-role>
      <ejb-relationship-role-name>citizen-has-address</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>ID</field-name>
      <column-name>ObjektId</column-name>
      </key-field>
      </key-fields>
      </ejb-relationship-role>

      <ejb-relationship-role>
      <ejb-relationship-role-name>address-belongs-to-citizen</ejb-relationship-role-name>
      <key-fields/>
      </ejb-relationship-role>
      </ejb-relation>




      ************** DB tables **************
      Borger (citizen)
      - ID (pk)
      - Name
      - Phone
      - ..

      Adresse (address)
      - ID (pk)
      - ObjektID (fk, to citizen)
      - Street
      - City
      - ..




      ************** Exception **************
      java.rmi.ServerException: null Embedded Exception null; nested exception is: javax.ejb.EJBException: null Embedded Exception null at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:119) at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:167) at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:61) at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:129) at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166) at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:493) at org.jboss.ejb.Container.invoke(Container.java:705) at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1055) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491) at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:98) at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:102) at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:73) at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:76) at org.jboss.proxy.ejb.EntityInterceptor.invoke(EntityInterceptor.java:116) at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76) at $Proxy71.getAddress(Unknown Source) at dme.homecare.web.MessageServlet.doGet(MessageServlet.java:35) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012) at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107) at java.lang.Thread.run(Thread.java:536) Caused by: javax.ejb.EJBException: null Embedded Exception null at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.getInstanceValue(JDBCCMRFieldBridge.java:589) at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.getValue(JDBCCMRFieldBridge.java:545) at org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler.invoke(EntityBridgeInvocationHandler.java:123) at org.jboss.proxy.compiler.Runtime.invoke(Runtime.java:59) at dme.homecare.ejb.entity.csc.CitizenBean$Proxy.getAddress() 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:324) at org.jboss.ejb.EntityContainer$ContainerInterceptor.invoke(EntityContainer.java:1197) at org.jboss.ejb.plugins.cmp.jdbc.JDBCRelationInterceptor.invoke(JDBCRelationInterceptor.java:190) at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:340) at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186) at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:193) at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:107) at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationInterceptor.java:69) at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:96) ... 48 more