Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002588 [Resin] minor always 04-09-08 10:43 04-09-08 18:52
Reporter emil View Status public  
Assigned To ferg
Priority normal Resolution fixed  
Status closed   Product Version 3.1.6
Summary 0002588: Servlet loads class before amber
Description (Reported by Riccardo Cohen)

A servlet that uses a persisted class is loading the class before amber can. This has not been replicated on Linux, but Mac OS X with Java 1.5.0_13 seems to exhibit the problem. See the attached war file.
Additional Information Additional info by Riccardo:

I found something interesting : if you comment the code where Ejbuser is
used in Adlservice (see file joined) then the illegual instance class error
disappear, even if in the last function there is a List<Ejbuser> that does
not seem to be a problem.
It seems that it happens only when an object has to be used in my code...

package adlhessian;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.transaction.UserTransaction;
import javax.webbeans.In;

import com.caucho.hessian.server.HessianServlet;

public class Adlservice extends HessianServlet
{
  @PersistenceContext(name="adlhessian") private EntityManager m_manager;
  @In private UserTransaction m_ut;
  
  //@TransactionAttribute
  public boolean setusername(int userid,String newname)
  {
    boolean success=false;
    try
    {
      m_ut.begin(); // must be called before find() or createQuery()
      /*
      Ejbuser user=m_manager.find(Ejbuser.class,userid);
      if (user!=null)
      {
        user.setName(newname);
        success=true;
      }
      */
    }
    catch(Exception ex)
      {ex.printStackTrace();}
    finally
    {
      try{m_ut.commit();}catch(Exception ex){ex.printStackTrace();}
    }
    return(success);
  }

  public Ejbuser getuser(int userid)
  {
    Ejbuser ret=null;
    try
    {
      /*
      Ejbuser user=(Ejbuser)m_manager.find(Ejbuser.class,userid);
      if (user!=null)
        ret=user;
        */
    }
    catch(Exception ex)
      {ex.printStackTrace();}
    return ret;
  }

  public boolean adduser(Ejbuser newuser)
  {
    boolean success=false;
    try
    {
      m_ut.begin(); // must be called before find() or createQuery()
      /*
      Ejbuser user=new Ejbuser();
      user=newuser;
      m_manager.persist(user);
      */
    }
    catch(Exception ex)
      {ex.printStackTrace();}
    finally
    {
      try{m_ut.commit();}catch(Exception ex){ex.printStackTrace();}
    }
    return(success);
  }

  public List<String> getallusers()
  {
    List<String> ret=new ArrayList<String>();
    try
    {
      javax.persistence.Query hqr=m_manager.createQuery("select h from Ejbuser h");
      List<Ejbuser> list=(List<Ejbuser>)hqr.getResultList();
      int idx;
      for (idx=0;idx<list.size();idx++)
        ret.add(list.get(idx).getName());
    }
    catch(Exception ex)
      {ex.printStackTrace();}
    return(ret);
  }

}
Attached Files  amber.war [^] (677,869 bytes) 04-09-08 10:43

- Relationships

- Notes
(0002954)
ferg
04-09-08 18:52

jpa/0032
 

- Issue History
Date Modified Username Field Change
04-09-08 10:43 emil New Issue
04-09-08 10:43 emil File Added: amber.war
04-09-08 18:52 ferg Note Added: 0002954
04-09-08 18:52 ferg Assigned To  => ferg
04-09-08 18:52 ferg Status new => closed
04-09-08 18:52 ferg Resolution open => fixed
04-09-08 18:52 ferg Fixed in Version  => 3.1.6


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
30 total queries executed.
26 unique queries executed.
Powered by Mantis Bugtracker