I'm getting this on HEAD and Branch_3_0 when I try to call a method (not 
a CMP accessor) on a simple CMP bean I have (enclosed) deployed with no 
problems.

The Bean is meant to be a simple example of how to plug a persistent 
layer into my new pluggable HttpSessionManager for Jetty/JBoss. The 
trouble is, because of this, it does not work !

Is this a JBoss problem, or is my bean rubbish - If my bean is rubbish 
could we have a more helpful exception?


Cheers,


Jules

P.S.

All dds are generated by xdoclet from the Bean's src.
I run xdoclet from Ant thus:

     <ejbdoclet
       sourcepath="${top.dir}/src"
       destdir="${top.dir}/output/ejb/src"
       ejbspec="2.0"
       excludedtags="@version,@author"
 
classpath="./src:./output/ejb:./lib/jboss-j2ee.jar:./lib/xdoclet.jar:lib/ant.jar:lib/log4j.jar"
     >
       <fileset dir="${top.dir}/src">
         <include name="**/session/ejb/*Bean.java" />
       </fileset>
       <packageSubstitution packages="ejb" substituteWith="interfaces"/>
<!--
       <dataobject/>
  -->
       <remoteinterface/>
       <localinterface/>
       <homeinterface/>
       <localhomeinterface/>
       <entitypk/>
       <entitycmp/>
       <session/>
       <deploymentdescriptor
         xmlencoding ="UTF-8"
        destdir="${top.dir}/output/ejb/META-INF"
       />
       <jboss version="3.0"
              xmlencoding="UTF-8"
              typemapping="Hypersonic SQL"
              datasource="java:/DefaultDS"
              destdir="${top.dir}/output/ejb/META-INF"
       />
     </ejbdoclet>

     <!-- build ejb classes -->
     <javac
       srcdir="${top.dir}/src;${top.dir}/output/ejb/src"
       destdir="${top.dir}/output/ejb/"
       debug="${debug}"
     >
       <classpath refid="ejb-classpath" />
       <include name="**/session/ejb/*.java" />
       <include name="**/session/interfaces/*.java" />
     </javac>

   </target>

P.P.S.

Feel free to abuse me - I know very little about EJBs....




java.rmi.ServerException: null; CausedByException is:
        null; nested exception is:
        javax.ejb.EJBException: null; CausedByException is:
        null
        at 
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:119)
        at 
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:176)
        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:183)
        at 
org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:156)
        at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:482)
        at org.jboss.ejb.Container.invoke(Container.java:687)
        at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1024)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
        at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:100)
        at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:88)
        at 
org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:51)
        at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:48)
        at org.jboss.proxy.ejb.EntityInterceptor.invoke(EntityInterceptor.java:112)
        at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:82)
        at $Proxy29.setAttribute(Unknown Source)
        at org.jboss.jetty.session.StateInterceptor.setAttribute(Manager.java:162)
        at 
org.jboss.jetty.session.NotificationInterceptor.setAttribute(Manager.java:219)
        at org.jboss.jetty.session.StateInterceptor.setAttribute(Manager.java:162)
        at 
org.jboss.jetty.session.AttributeCheckingInterceptor.setAttribute(Manager.java:465)
        at org.jboss.jetty.session.StateAdaptor.setAttribute(StateAdaptor.java:227)
        at org.jboss.jetty.session.test.Servlet.testSession(Servlet.java:98)
        at org.jboss.jetty.session.test.Servlet.service(Servlet.java:64)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:371)
        at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:613)
        at org.mortbay.http.HttpContext.handle(HttpContext.java:1387)
        at org.mortbay.http.HttpContext.handle(HttpContext.java:1326)
        at org.mortbay.http.HttpServer.service(HttpServer.java:757)
        at org.jboss.jetty.Jetty.service(Jetty.java:527)
        at org.mortbay.http.HttpConnection.service(HttpConnection.java:748)
        at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:921)
        at org.mortbay.http.HttpConnection.handle(HttpConnection.java:763)
        at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:151)
        at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:287)
        at org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:715)
        at java.lang.Thread.run(Thread.java:536)
Caused by: javax.ejb.EJBException: null; CausedByException is:
        null
        at 
org.jboss.ejb.Container$AbstractContainerInterceptor.rethrow(Container.java:1223)
        at 
org.jboss.ejb.EntityContainer$ContainerInterceptor.invoke(EntityContainer.java:1099)
        at 
org.jboss.ejb.plugins.cmp.jdbc.JDBCRelationInterceptor.invoke(JDBCRelationInterceptor.java:95)
        at 
org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:308)
        at 
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
        at 
org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:152)
        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)
        ... 37 more
package org.jboss.jetty.session.ejb;

import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Map;
import javax.ejb.CreateException;
import javax.ejb.EntityBean;
import javax.ejb.EntityContext;
import javax.ejb.RemoveException;
import org.apache.log4j.Category;

/**
 * The Entity bean represents an HttpSession.
 *
 * @author [EMAIL PROTECTED]
 * @version $Revision: 1.4 $
 *
 *   @ejb:bean name="CMPState" type="CMP" jndi-name="jetty/CMPState" primkey-field="id"
 *   @ejb:interface remote-class="org.jboss.jetty.session.interfaces.CMPState" 
extends="javax.ejb.EJBObject, org.jboss.jetty.session.State"
 *   @ejb:pk class="java.lang.String"
 *
 *   @jboss:table-name "httpsession"
 *   @jboss:create-table "true"
 *   @jboss:remove-table "true"
 *   @jboss:tuned-updates "false"
 *   @jboss:read-only "false"
 **/

public abstract class CMPStateEntityBean
  implements EntityBean, org.jboss.jetty.session.State
{
  Category _log=Category.getInstance(getClass().getName());

  //----------------------------------------
  // Home
  //----------------------------------------

  //   /**
  //    * Transfer money
  //    *
  //    * @ejb:home-method
  //    */
  //   public void ejbHomeTransfer(HttpSession from, HttpSession to, float amount)
  //   {
  //     try
  //     {
  //       from.withdraw(amount);
  //       to.deposit(amount);
  //     } catch (java.rmi.RemoteException e)
  //     {
  //       throw new EJBException(e);
  //     }
  //   }

  // this should locate all sessions that have timed out and return
  // their ids. The Store that made the call should ensure that they
  // are all loaded and then invalidate them all within the same
  // transaction as the query was made...

  public String[]
    findTimedOut(long time)
  {
    return null;                // TODO
  }

  //----------------------------------------
  // Lifecycle
  //----------------------------------------

  /**
   * Create httpSession.
   *
   * @ejb:create-method
   * @ejb:permission role-name="Administrator"
   */
  public String ejbCreate(String id)
    throws CreateException
  {
    _log.info("ejbCreate("+id+")");

    setId(id);

    return null;
  }

  /**
   * Create httpSession.
   *
   */
  public void ejbPostCreate(String id)
    throws CreateException
  {
    //    _log.info("ejbPostCreate("+id+")");
  }

//   public void
//     setEntityContext(EntityContext ctx)
//   {
//     //    _log.info("setEntityContext("+ctx+")");
//   }
//
//   public void
//     ejbLoad()
//   {
//     //    _log.info("ejbLoad()");
//   }
//
//   public void
//     ejbActivate()
//   {
//     //    _log.info("ejbActivate()");
//   }
//
//   public void
//     ejbPassivate()
//   {
//     //    _log.info("ejbPassivate()");
//   }
//
//   public void
//     ejbStore()
//   {
//     //    _log.info("ejbStore()");
//   }
//
//   public void
//     unsetEntityContext()
//   {
//     //    _log.info("unsetEntityContext()");
//   }

  /**
   * @ejb:transaction type="Mandatory"
   */
  public void
    ejbRemove()
    throws RemoveException
  {
    _log.info("ejbRemove("+getId()+")");
  }

  //----------------------------------------
  // Accessors
  //----------------------------------------
  // Id

  /**
   * @ejb:pk-field
   * @ejb:persistent-field
   *
   * @jboss:column-name "pk"
   */
  public abstract String getId();

  /**
   * @ejb:pk-field
   * @ejb:persistent-field
   *
   * @jboss:column-name "pk"
   */
  public abstract void setId(String id);

  //----------------------------------------
  // Attributes

  /**
   * @ejb:interface-method
   * @ejb:persistent-field
   * @ejb:transaction type="Required"
   */
  public abstract Map getAttributes();

  /**
   * @ejb:interface-method
   * @ejb:persistent-field
   * @ejb:transaction type="Required"
   */
  public abstract void setAttributes(Map attributes);


  /**
   * @ejb:interface-method
   * @ejb:transaction type="Required"
   */
  public Object
    getAttribute(String name)
  {
    return getAttributes().get(name);
  }

  /**
   * @ejb:interface-method
   * @ejb:transaction type="Required"
   */
  public Object
    setAttribute(String name, Object value)
  {
    Map attrs=getAttributes();
    Object tmp=attrs.put(name, value);
    setAttributes(attrs);

    _log.info(getId()+": set attribute - "+name+":"+value);

    return tmp;
  }

  /**
   * @ejb:interface-method
   * @ejb:transaction type="Required"
   */
  public Object
    removeAttribute(String name)
  {
    Map attrs=getAttributes();
    Object tmp=attrs.remove(name);
    if (tmp!=null)
      setAttributes(attrs);

    _log.info(getId()+": removed attribute - "+name);

    return tmp;
  }

  /**
   * @ejb:interface-method
   * @ejb:persistent-field
   * @ejb:transaction type="Required"
   */
  public abstract long getCreationTime();

  /**
   * @ejb:interface-method
   * @ejb:persistent-field
   * @ejb:transaction type="Required"
   */
  public abstract void setLastAccessedTime(long time);

  /**
   * @ejb:interface-method
   * @ejb:persistent-field
   * @ejb:transaction type="Required"
   */
  public abstract long getLastAccessedTime();

  /**
   * @ejb:interface-method
   * @ejb:persistent-field
   * @ejb:transaction type="Required"
   */
  public abstract void setMaxInactiveInterval(int interval);

  /**
   * @ejb:interface-method
   * @ejb:persistent-field
   * @ejb:transaction type="Required"
   */
  public abstract int getMaxInactiveInterval();

  /**
   * @ejb:interface-method
   * @ejb:transaction type="Required"
   */
  public Enumeration
    getAttributeNameEnumeration()
  {
    return Collections.enumeration(getAttributes().keySet());
  }

  /**
   * @ejb:interface-method
   * @ejb:transaction type="Required"
   */
  public String[]
    getAttributeNameStringArray()
  {
    Map attrs=getAttributes();
    return (String[])attrs.keySet().toArray(new String[attrs.size()]);
  }
}

Reply via email to