[jboss-user] [JBoss AOP] - Re: Exception to invoke remote object when upgrade to jboss-

avihaimar do-not-reply at jboss.com
Mon Mar 10 05:51:58 EDT 2008


Thanks for the answer.
i spent a lot of time on it.
Just take clean jboss4.2GA, run the ant script which provided by you in order to upgrade to aop2(CR4).

than i try to call to my stateless from a java client and it failed with the attach error.

I am suspecting that there is problem with the client classpath. I use with jbossall-client.jar , which located under jbooss/client ,to connect to the server. is there a chance that need to update it after upgrade aop in server?

please help!!!!!



Client::::

  | import java.util.Date;
  | import java.util.Properties;
  | 
  | import javax.naming.Context;
  | import javax.naming.InitialContext;
  | import javax.naming.NamingException;
  | 
  | import com.tikal.ejb3sample.model.Hotel;
  | import com.tikal.ejb3sample.service.HotelService;
  | import org.apache.log4j.Logger;
  | 
  | /**
  |  * @author hennebrueder
  |  *
  |  */
  | public class DemoTester {
  | 	private static Logger logger = Logger.getLogger(DemoTester.class);
  | 
  | 	/**
  | 	 * constants
  | 	 */
  | 	private static final String IIOP_NAMING_CONTEXT_FACTORY = "org.jnp.interfaces.NamingContextFactory";
  | 	private static final String IIOP_JNDI_FACTORY = "org.jboss.naming:org.jnp.interfaces";
  | 
  | 	private static String EAR_NAME = "application-1.0/";
  | 	private static String serviceName = "HotelServiceBean";
  | 
  | 	private Context context;
  | 
  | 	/**
  | 	 * c'tors
  | 	 * @throws NamingException
  | 	 */
  | 	public DemoTester() throws NamingException {
  | 		context = initContext();
  | 	}
  | 
  | 	private Context initContext() throws NamingException {
  | 		//init properties
  | 		Properties properties = new Properties();
  | 		properties.put(Context.INITIAL_CONTEXT_FACTORY, IIOP_NAMING_CONTEXT_FACTORY);
  | 		properties.put(Context.URL_PKG_PREFIXES, IIOP_JNDI_FACTORY);
  | 		properties.put(Context.PROVIDER_URL, "127.0.0.1:1099");
  | 		return new InitialContext(properties);
  | 
  | 	}
  | 
  | 	/**
  | 	 * @param args
  | 	 * @throws Exception
  | 	 */
  | 	public static void main(String[] args) throws Exception {
  | 
  | 		String date = "" + new Date(System.currentTimeMillis());
  | 		System.out.println("Test time  : " + date);
  | 		DemoTester tester = new DemoTester();
  | 
  | 		try {
  | 			tester.testSaveHotel();
  | 
  | 		}
  | 		catch( Exception e ) {
  | 			e.printStackTrace();
  | 		}
  | 
  | 	}
  | 
  | 
  | 	public void testSaveHotel() throws Exception {
  | 		logger.trace("test save hotel");
  | 		HotelService hotelService = (HotelService)context.lookup(EAR_NAME + serviceName + "/remote");
  | 		hotelService.doSomethingFunny();
  | 	}
  | 
  | }

Stateless:

  | import java.util.jar.Attributes;
  | import java.util.jar.Manifest;
  | 
  | import javax.ejb.EJB;
  | import javax.ejb.Local;
  | import javax.ejb.Remote;
  | import javax.ejb.Stateless;
  | 
  | import com.tikal.ejb3sample.dao.HotelDao;
  | import com.tikal.ejb3sample.model.Hotel;
  | import com.tikal.ejb3sample.model.Room;
  | import com.tikal.ejb3sample.model.TestAop;
  | import com.tikal.ejb3sample.service.HotelService;
  | 
  | @Stateless
  | @Local(HotelService.class)
  | @Remote(HotelService.class)
  | public class HotelServiceBean implements HotelService {
  | 
  | 	@EJB
  | 	private HotelDao hotelDao;
  | 
  | 	public void doSomethingFunny() {
  | 		System.out.println("yyyyyyyyyy");
  | 	}
  | 
  | }

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

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



More information about the jboss-user mailing list