你在你的WEB.xml中把这个Entity Bean申明成EJB References了么?还有你的Entity Bean是CMP2的么?如果是你看看你的接口是Local的还是Remote的?

解决方案 »

  1.   

    哦,我忘记说了
    我用的是BMP
      

  2.   

    java.lang.OutOfMemoryError
    这个错误和程序没有关系吧???
    不知道...
      

  3.   

    是用JB7编译的
    程序在IE中运行,提交以后数据库中没有添家进去;是我程序那里错了吗?劳繁各位了BMP中的CREATE方法如下  public String ejbCreate(String ygid, String ygname, Integer age) throws CreateException {
        super.ejbCreate(ygid, ygname, age);
        try {
          //First see if the object already exists
          ejbFindByPrimaryKey(ygid);
          //If so, then we have to throw an exception
          throw new DuplicateKeyException("Primary key already exists");
        }
        catch(ObjectNotFoundException e) {
          //Otherwise we can go ahead and create it...
        }
        Connection connection = null;
        PreparedStatement statement = null;
        try {
          connection = dataSource.getConnection();
          statement = connection.prepareStatement("INSERT INTO yg (ygid, ygname, age) VALUES (?, ?, ?)");
          statement.setString(1, ygid);
          statement.setString(2, ygname);
          if (age == null) {
            statement.setNull(3, Types.INTEGER);
          }
          else {
            statement.setInt(3, age.intValue());
          }
          if (statement.executeUpdate() != 1) {
            throw new CreateException("Error adding row");
          }
          return ygid;
        }
        catch(SQLException e) {
          throw new EJBException("Error executing SQL INSERT INTO yg (ygid, ygname, age) VALUES (?, ?, ?): " + e.toString());
        }
        finally {
          closeConnection(connection, statement);
        }
      }
      

  4.   

    代码初看没问题,你得确认是ejb导致OutOfMemoryError ?
      

  5.   

    OutOfMemoryError感觉和你的程序没有关系!!可能是你的JB7的问题!
      

  6.   

    OutOfMemoryError我也遇见过,这和你的程序没有关系,一般是你的jboss出了问题,或者是你的操作系统出了问题,我原来是重装系统就解决了,但我也没有找到出现这个问题的原因!
      

  7.   

    问题已解决
    不是程序的问题,应该是jboss出错
    免费的性能真是。。
      

  8.   

    楼上的,jboss出了什么问题啊?我们公司用的也是它,可否告诉我一下?万一以后出现了同样的情况就不用烦了.