I use a client to connect to JBoss 4.0.3SP1 using sun jdk 1.5. 

I retrieve a stateless bean and it's ok (stateless is a jboss proxy) but when 

I try to create an entity using this bean manager, a ClassNotFoundException is 
thrown because the returned object is not a proxy, it's the entity bean class, 
not the remote interface. 

The interfaces : 

@Remote
  | public interface ICityManager extends IDataManager<ICity> {
  |   public ICity create(String name, String code, String country) throws 
RemoteException;
  | }
  | 
  | @Remote
  | public interface ICity extends INamed {
  |   public String getCode() throws RemoteException;
  |   public void setCode(String s) throws RemoteException;
  |   public String getCountry() throws RemoteException;
  |   public void setCountry(String o) throws RemoteException;
  | }

The concrete classes : 

@Stateless
  | @Remote(ICityManager.class)
  | public class CityManagerBean extends AbstractManagerBean<ICity> implements 
ICityManager {
  | ...
  |   public ICity create(String name, String code, String country) throws 
RemoteException {
  |     ICity o = new City();
  |     o.setName(name);
  |     o.setCode(code);
  |     o.setCountry(country);
  |     manager.persist(o);
  | 
  |     return o;
  | }
  | 
  | @Entity(access = AccessType.PROPERTY)
  | @Table(name = "CITIES", uniqueConstraints = { @UniqueConstraint( 
columnNames = { INamed.NAME, ICity.CODE, ICity.COUNTRY } 
  | ) } )
  | @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
  | @Remote(ICity.class)
  | public class City extends AbstractNamedEntity implements ICity {
  |   private String code;
  |   private String country;
  | 
  |   public City() { }
  | ...
  |   @Id(generate = GeneratorType.IDENTITY)
  |   @Column(name = ID, nullable = false, unique = true)
  |   public long getPrimaryKey() { return id; }
  | ...
  | }

The client : 

public static void main(String[] args) {
  |   try {
  |     if (System.getSecurityManager() == null) {
  |       System.setSecurityManager(new AllPermissionsManager());
  |     }
  | 
  |     DataManagerFactory factory = DataManagerFactory.getInstance();
  |     ICityManager cityManager = factory.get(ICityManager.class);
  |     cityManager.removeAll();
  | 
  |     System.out.print("city creation =>");
  |     System.out.println(cityManager.getClass().getName());
  |     System.out.println("cities : " + cityManager.size());
  |     ICity city = cityManager.create("Paris", "75000", "fra");  
//ClassNotFoundException appears here
  | ...
  | }

I don't understand, I need to put my concrete entity class on the class path of 
the client or it's not necessary (proxy or not) ?

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3907105#3907105

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3907105


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to