Ko In Cek created JAMES-1448:
--------------------------------

             Summary: Issue to establish Weblogic InitialContext
                 Key: JAMES-1448
                 URL: https://issues.apache.org/jira/browse/JAMES-1448
             Project: James Server
          Issue Type: Bug
          Components: Matchers/Mailets (bundled)
    Affects Versions: 2.3.2
         Environment: AIX Java6_64 bit Weblogic 10.3.6.0
            Reporter: Ko In Cek


Hi All,

I'm working a project to leverage James Server to integrate the mail service to 
my application via Weblogic EJB Remote call.

Basically, I developed a MailArriveStoreMailet to snift the response from mail 
server and store the email content into a Oracle database via a Remote EJB call.

The application is working fine in Windows environment. But, I'm encountering 
the below problem when deploy the application in a UNIX AIX machine. Below are 
the exception I'm getting:

...
Using JAVA_HOME:      /apps/java6_64
...
Running Phoenix: 

Phoenix 4.2

James Mail Server 2.3.2
org.apache.avalon.phoenix.containerkit.lifecycle.LifecycleException: Component 
named "spoolmanager" failed to pass through the Starting stage. (Reason: 
java.lang.ExceptionInInitializerError).
...
Caused by: java.lang.ExceptionInInitializerError
        at java.lang.J9VMInternals.initialize(J9VMInternals.java:222)
        at weblogic.rjvm.LocalRJVM.getLocalRJVM(LocalRJVM.java:72)
        at weblogic.rjvm.JVMID.<init>(JVMID.java:373)
        at weblogic.rjvm.JVMID.setLocalClientID(JVMID.java:146)
        at weblogic.rjvm.JVMID.localID(JVMID.java:110)
        at 
weblogic.protocol.LocalServerIdentity$SingletonMaker.<clinit>(LocalServerIdentity.java:13)
        at java.lang.J9VMInternals.initializeImpl(Native Method)
        at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
        at 
weblogic.protocol.LocalServerIdentity.getIdentity(LocalServerIdentity.java:20)
        at 
weblogic.server.channels.ServerChannelImpl.createDefaultServerChannel(ServerChannelImpl.java:223)
        at 
weblogic.rjvm.t3.ProtocolHandlerT3$ChannelInitializer.<clinit>(ProtocolHandlerT3.java:37)
        at java.lang.J9VMInternals.initializeImpl(Native Method)
        at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
        at 
weblogic.rjvm.t3.ProtocolHandlerT3.getDefaultServerChannel(ProtocolHandlerT3.java:42)
        at 
weblogic.protocol.ServerChannelManager$SingletonMaker$1.getOutboundServerChannel(ServerChannelManager.java:393)
...
        ... 22 more
Caused by: java.lang.NullPointerException
        at java.security.SecureRandom.nextBytes(SecureRandom.java:292)
        at weblogic.rjvm.LocalRJVM.<init>(LocalRJVM.java:92)
        at weblogic.rjvm.LocalRJVM.<init>(LocalRJVM.java:28)
        at weblogic.rjvm.LocalRJVM$LocalRJVMMaker.<clinit>(LocalRJVM.java:31)
        at java.lang.J9VMInternals.initializeImpl(Native Method)
        at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
        ... 64 more



Code snapshot of the MailArriveStoreMailet:

public class MailArriveStoreMailet extends GenericMailet
{
        private static Logger logger = 
Logger.getLogger(MailArriveStoreMailet.class.getName());
        SecuredInboxEJB inboxEJB;
        DFTCApp dftcAppRemote;

        public MailArriveStoreMailet()
        {
                this.inboxEJB = null;
                this.dftcAppRemote = null;
        }

        public void init(MailetConfig newConfig) throws MessagingException
        {
                super.init(newConfig);
                try
                {
                        ContextUtils.initContext();
                        String securedinboxJNDI = 
ContextUtils.properties.getProperty("securedinbox.ejb");
                        this.inboxEJB = 
((SecuredInboxEJB)ContextUtils.ctx.lookup(securedinboxJNDI));
                        this.dftcAppRemote = ContextUtils.getAppEJB();
                }
                catch (Exception e)
                {
                        logger.error(e);
                        e.printStackTrace();
                }
        }
        
Code snapshot of the ContextUtils:
  public static Context initContext() throws Exception
  {
    String configFileName = System.getProperty(CONFIG_FILE_NAME);
    if (logger.isDebugEnabled())
    {
      logger.debug("read config file is: " + configFileName + "");
    }
    properties.load(new FileReader(configFileName));

    String initialContextFactory = 
properties.getProperty("java.naming.factory.initial");
    String providerURL = properties.getProperty("java.naming.provider.url");

    if (logger.isDebugEnabled())
    {
      logger.debug("initialContextFactory is: " + initialContextFactory);
      logger.debug("providerURL is: " + providerURL);
    }

    Hashtable env = new Hashtable();
    env.put("java.naming.factory.initial", initialContextFactory);
    env.put("java.naming.provider.url", providerURL);

    ctx = new InitialContext(env);
    return ctx;
  }

        

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to