0 Replies Latest reply on Jan 24, 2007 10:13 AM by earniedyke

    Strange problem

    earniedyke

      Greetings,

      I have a strange problem I hope someone can help me with. I have a java app that runs on a server separate from my JBoss 4.0.1sp1 instance. This app connects and tries to get a stateless EJB from JBoss. The lookup works fine but when I do home.create the method ends without an exception. It just right to the finally method without executing any code after the create. Anyone run into this before?

      Thanks in advance for any and all help.

      Earnie!

      package com.vrs.selfserv.batch;
      
      import java.rmi.RMISecurityManager;
      import java.util.*;
      
      import javax.naming.InitialContext;
      import javax.rmi.PortableRemoteObject;
      import javax.mail.*;
      import javax.mail.internet.*;
      
      import org.apache.log4j.Logger;
      
      import com.vrs.selfserv.session.interfaces.RegistrarEr;
      import com.vrs.selfserv.session.interfaces.RegistrarErHome;
      import com.vrs.selfserv.dataobject.RegistrationErReportUnregisteredUsers;
      import com.vrs.selfserv.dataobject.RegistrationErReportTerminatedUsers;
      import com.vrs.selfserv.dataobject.RegistrationErReportNewUsers;
      import com.vrs.selfserv.dataobject.RegistrationErReportDetail;
      
      public class BatchEmployerRegistrationProcessor {
      
       private static final String EJB_NAME = "ejb/RegistrarErRemoteHome";
      
       private InitialContext ic = null;
      
       private RegistrarErHome home = null;
      
       private RegistrarEr registrar = null;
      
       private Properties props = null;
      
       private static Logger log = null;
      
       private BatchEmployerRegistrationProcessor() {
       /*
       * Log properties are read automatically from log4j.xml
       */
       log = Logger.getLogger(this.getClass());
       log.info("Processing begins");
       }
      
       /**
       * @param args
       */
       public static void main(String[] args) {
       BatchEmployerRegistrationProcessor processor = new BatchEmployerRegistrationProcessor();
       int exitCode = 0;
       try {
       processor.init();
       processor.process();
       } catch (Exception e) {
       exitCode = 32;
       } finally {
       if (exitCode == 0) {
       log.info("Processing ends");
       } else {
       log.warn("Processing terminated");
       }
       System.exit(exitCode);
       }
       }
      
       private void init() throws Exception {
       log.debug("Initializing");
       try {
       /*
       * Load runtime properties. JNDI properties are read automatically from
       * jndi.properties
       */
       props = new Properties();
       props.load(this.getClass().getResourceAsStream("/run.properties"));
       ic = new InitialContext();
       Hashtable env = ic.getEnvironment();
       if (log.isDebugEnabled()) {
       for (Iterator it = env.keySet().iterator(); it.hasNext();) {
       String key = (String) it.next();
       log.debug("Property: " + key + "=" + env.get(key));
       }
       }
       log.debug("Creating security manager");
       System.setSecurityManager(new RMISecurityManager());
       log.debug("Security Manager set");
       Object objref = ic.lookup(EJB_NAME);
       log.debug("Lookup of EJB complete");
       home = (RegistrarErHome) PortableRemoteObject.narrow(objref, RegistrarErHome.class);
       log.debug("EJB home has been narrowed " + (home == null ? " home is null" : home.getClass().getName()));
       registrar = home.create();
       log.debug("EJB home created");
       } catch (Exception e) {
       log.debug("Oops! " + e.getMessage());
       log.error("Initialization error", e);
       System.out.println(e.getMessage());
       e.printStackTrace();
       throw e;
       }
       log.debug("Initialization complete");
       }
      
       private void process() throws Exception {
       try {
       log.debug("Getting list of authorized users");
       List authorizedUsers = registrar.getAuthorizedUsers();
       log.debug(authorizedUsers.size() + " authorized users retrieved");
      
       log.debug("Getting list of active registrations");
       List activeUsers = registrar.getActiveRegistrations();
       log.debug(activeUsers.size() + " active registrations retrieved");
      
       log.debug("Getting list of users who have not registered");
       List pendingUsers = registrar.getPendingRegistrations();
       log.debug(pendingUsers.size() + " non-registered users retrieved");
      
       /* other code removed that is not pertinent to the problem */
      
       } catch (Exception e) {
       log.error("Processing exception", e);
       emailMessage.append("<hr><span style=\"color:red);\">ERROR</span><br/>");
       emailMessage.append("Processing exception: ");
       emailMessage.append(e.toString());
       sendMailTo = 'I';
       } finally {
       log.info("Transaction processing complete");
       emailMessage.append("</body></html>");
       log.debug(emailMessage);
       sendEmail(emailMessage, sendMailTo);
       }
       }
      
       private void sendEmail(StringBuffer emailMessage, char to) {
       /* code removed that is not pertinent */
       }
      }