0 Replies Latest reply on Jan 30, 2007 6:08 AM by R. K.

    Debug EJB3 component

    R. K. Newbie

      Hello, everybody.

      I am developing web-application that needs to access EJB3 component that is deployed to JBoss AS.
      This bean uses few 3rd party libs, that are packed into the same jar as bean is, under /lib path.
      In the JBoss console i see message:

      [EJBContainer] STARTED EJB: nuntia.ejb.CRFacadeBean ejbName: CRFacadeBean

      So, it looks like bean is deployed successfully.
      From web-app (from struts action actually) i try to get bean instance as follows:

      Properties properties = new Properties();
      properties.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
      properties.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
      properties.setProperty("java.naming.provider.url", "localhost:1099");
      CRFacade crFacade = (CRFacade) new InitialContext(properties).lookup("CRFacadeBean/local");

      Here, CRFacade is @Local interface, and CRFacadeBean is an implementation class (@Stateless bean).

      Instance seems to be successfully created (i see that while debugging), but as soon as first of its methods is called, i got an InvocationTargetException:

      [PropertiesFactoryBean] Loading properties file from class path resource [alfresco/domain/hibernate-cfg.properties]

      So it seems that there's some problem either in bean or in the way how libs are loaded (PropertiesFactoryBean class is actually part of spring.jar that is one of the libs i'm bundling with my bean's jar). Note, that class does his job well when used standalone (not as bean). So, i would like to debug bean to find out what the reason of failure is. I'm using Eclipse and JBossIDE, my project is configured properly, sources are attached to the classes, and i can navigate throuhg them, but still, i can't catch breakpoint that is set in the body of constructor of my bean, so it seems like debugging is not working this way...

      And, finally, questions:

      1) do i pack/deploy my EJB3 component correctly?
      2) is there any way to debug deployed EJB3 component?

      P.S. I am new to EJB3, so sorry for dumb questions (if any) ;)

      Thanks in advance!