Problem w/ InitialContext

Here is my issue:
1. I have and stateless session EJB deploy to OC4J (the preview release).
2. I have a servlet that access the the EJB using the "RMInitialContextFactory" factory.
3. When I deploy the servlet to Tomcat on a different box it works fine.
4. When I deploy the servlet to the OC4J server that is is holding the ejb (two different ear files/packages) the servlet will error out w/ a class cast exception when I attempt to
narrow the return from context lookup.
I have noticed that the class that is returned by the context lookup (to get the ejb) is DIFFERENT when the servlet is run on tomcat vs OC4J.
Tomcat returns a "__Proxy0" object on the context lookup
OC4J returns a "TxGetHome_StatelessSessionHomeWrapper"
So how can I deploy a servlet to OC4J that uses an EJB that previously deployed to the server (ie they are not in the same application). What factory/context magic is required here?
And what is the difference between "RMInitialContextFactory" and "ApplicationClientContextFactory" they are both used when the client is comming from a different VM right?

First, thanks for helping!
However,
I am not trying to get at an EJB in the same application as the servlet(that does work). The EJB is in a different application than the servelt.
I can access the EJB from a remote container , on the same box (ie Tomcat) with tht following code:
Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.evermind.server.rmi.RMIInitialContextFactory");
env.put(Context.SECURITY_PRINCIPAL, SECURITY_PRINCIPAL);
env.put(Context.SECURITY_CREDENTIALS, SECURITY_CREDENTIALS);
env.put(Context.PROVIDER_URL,"ormi://localhost/ParametricData");
Context ctx = new InitialContext(env);
TxGetHome pHome = (TxGetHome)ctx.lookup("TxGet");
However if I deploy servlet with this code to OC4J it will throw a class cast excpetion on the last line (work fine in Tomcat). Looks like a classloader issue.
So how would I access the EJB "TxGet" in application "ParametricData" from a servelt NOT in the "ParametricData" application?
Are you telling me that I can use "Context ctx = new InitialContext()" to get at an EJB in a different application than the servlet? When I try this is does not work.
Page 2-31 in the servlet developers guide has an section entitled "EJB Lookup Outside the Application" { see I have read the docs :-) } gives an example of lookuping up an EJB using
HelloHome hh = (HelloHome) (new InitialContext().lookup("ormi://host:port/appname/env/ejb/HELLOEJB"); This does not work either. I have tried the following and it can not find the EJB:
TxGetHome pHome = (TxGetHome)new InitialContext().lookup("ormi://localhost:23971/ParametricData/env/ejb/TxGet");
I know my servlet and ejb work because I can use the ejb from the servlet when I deploy the servlet Tomcat and connect w/ RMIInitialContextFactory.

Similar Messages

  • Problem with InitialContext Creation in Weblogic 5.1

    Hi all,
    We are using Weblogic 5.1 on Windows and Solaris.
    We are trying to get InitialContext by the following code snippet.
    This piece of code is in a Thread which is kicked off by a startup class.
    The purpose of getting the initialContext here is to get a reference to a JMS
    queue and to start listening for any messages that are put into the queue.
    Hashtable htEnv = new Hashtable();
    htEnv.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    htEnv.put(Context.PROVIDER_URL, "t3://ip_address:port_number");
    return new InitialContext(htEnv);
    Sometimes this code takes almost 15 minutes to return an InitialContext.
    Some other times it does not return at all, neither does it throw any exception.
    In the application this code may get called multiple times simultaneously.
    The problem is not consistent also.
    There is one aspect that has been noticed. A number of InitialContext Objects
    are initiated in the application and are not closed after use (As recommended
    in the weblogic documentation).
    The other observation is that the occurrence of the above explained problem is
    very consistent when the executeThreadCount of the Weblogic server is low (<=
    15). However, once the executeThread count is increased to a higher value (30
    to 45) the occurrence of the problem is very rare.
    Any information regarding this problem would be extremely helpful.
    Thanks and Regards,
    Uday

    Thank you Bhagvan,
    The creation of initial context in every call is a clear mistake. Caching has
    to be implemented.
    However , i need some more information about this ....
    As you said the initial context is being created at every instant for a lookup
    of any object in the jndi tree in the remote machine(I'll name this "machine A").
    Simultaneously there is an attempt for creation of an InitialContext in the other
    machine(call it "machine B") for the remote "machine A".
    This is needed because "machine B" has to get a reference to a JMS queue on "machine
    A" and start listening for any messages in it.
    It is at this point that the InitialContext creation takes randomly long times
    to return.
    That is the call is made by populating a Hashtable with the properties of the
    remote "machine A" like the IP address, Port number of "machine A" and using this
    Hashtable as a parameter in "machine B" to get the InitialContext.
    I was also wondering if there is a limit on the number of InitialContext objects
    that can be opened at any instant in a server.
    Could you please throw more light on these areas ........
    Thanks and regards,
    uday
    "bhagvan" <[email protected]> wrote:
    >
    Is there any particular reason why you want to get
    a new initial context in every call ?? My suggestion
    is to cache it based on the application parameters let us
    say the client user or client's machine or any other parameter
    which is unique for a client.
    hope this helps.
    "Uday Reddy" <[email protected]> wrote:
    Hi all,
    We are using Weblogic 5.1 on Windows and Solaris.
    We are trying to get InitialContext by the following code snippet.
    This piece of code is in a Thread which is kicked off by a startup class.
    The purpose of getting the initialContext here is to get a reference
    to a JMS
    queue and to start listening for any messages that are put into thequeue.
    Hashtable htEnv = new Hashtable();
    htEnv.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    htEnv.put(Context.PROVIDER_URL, "t3://ip_address:port_number");
    return new InitialContext(htEnv);
    Sometimes this code takes almost 15 minutes to return an InitialContext.
    Some other times it does not return at all, neither does it throw any
    exception.
    In the application this code may get called multiple times simultaneously.
    The problem is not consistent also.
    There is one aspect that has been noticed. A number of InitialContext
    Objects
    are initiated in the application and are not closed after use (As recommended
    in the weblogic documentation).
    The other observation is that the occurrence of the above explainedproblem
    is
    very consistent when the executeThreadCount of the Weblogic server is
    low (<=
    15). However, once the executeThread count is increased to a highervalue
    (30
    to 45) the occurrence of the problem is very rare.
    Any information regarding this problem would be extremely helpful.
    Thanks and Regards,
    Uday

  • Problems getting InitialContext

    Hi all,
    unfortunately I am getting the following error message while trying to get an InitialContext:
    com.sap.engine.services.jndi.persistent.exceptions.NamingException: Exception while trying to get InitialContext. [Root exception is com.sap.engine.services.security.exceptions.BaseLoginException: Cannot create new RemoteLoginContext instance.]
         at com.sap.engine.services.jndi.InitialContextFactoryImpl.getInitialContext(InitialContextFactoryImpl.java:532)
         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
         at javax.naming.InitialContext.init(InitialContext.java:219)
         at javax.naming.InitialContext.<init>(InitialContext.java:195)
         at src.EJBRemoteClient.main(EJBRemoteClient.java:24)
    Caused by: com.sap.engine.services.security.exceptions.BaseLoginException: Cannot create new RemoteLoginContext instance.
         at com.sap.engine.services.security.remote.login.RemoteLoginContext.<init>(RemoteLoginContext.java:98)
         at com.sap.engine.services.jndi.implclient.LoginHelper.clientSideLogin(LoginHelper.java:78)
         at com.sap.engine.services.jndi.InitialContextFactoryImpl.getInitialContext(InitialContextFactoryImpl.java:396)
         ... 5 more
    Caused by: com.sap.engine.services.rmi_p4.P4RuntimeException: Unexpected exception.Nested exception is:
         java.io.EOFException: End of stream is reached unexpectedly during input from Socket[addr=/10.62.145.243,port=50104,localport=1564]
         at com.sap.engine.services.rmi_p4.P4ObjectBrokerClientImpl.getException(P4ObjectBrokerClientImpl.java:591)
         at com.sap.engine.services.rmi_p4.P4ObjectBrokerClientImpl.getException(P4ObjectBrokerClientImpl.java:561)
         at com.sap.engine.services.security.remote.RemoteSecurity_Stub.getRemoteLoginContext(RemoteSecurity_Stub.java:674)
         at com.sap.engine.services.security.remote.login.RemoteLoginContext.<init>(RemoteLoginContext.java:93)
         ... 7 more
    Does anybody know how to solve this problem?
    Thank you in advance.
    Kind regards, Patrick.

    Hi Patrick,
    What version is your J2EE ?
    I found a SAP Note
    SAP Note 1071044 - P4 connection problems between two j2ee cluster instances
    Maybe its applicable to your issue.
    Regards,
    Siddhesh

  • Problem in using InitialContext to do a lookup of CMP EnitityBean.

    Hi,
    I am running WLS 5.1 SP6 on Windows98. I am trying to lookup a CMP entiry bean from
    Java 1.3 client. I can successfully create the InitialContext but having trouble in using it to do the lookup. I get the following error:
    jndiContext is javax.naming.InitialContext@61f24(This is line is the result of println : see code)
    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
    at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.lookup(Unknown Source)
    at com.titan.cabin.Client_1.main(Client_1.java:21)
    My code of the Java 1.3 client is as follows:
    package com.titan.cabin;
    import com.titan.cabin.CabinHome;
    import com.titan.cabin.Cabin;
    import com.titan.cabin.CabinPK;
    import javax.naming.InitialContext;
    import javax.naming.Context;
    import javax.naming.NamingException;
    import java.rmi.RemoteException;
    import java.util.Properties;
    import java.util.Hashtable;
    public class Client_1 {
    public static void main(String [] args){
    try {
    InitialContext jndiContext = getWeblogicInitialContext();
    System.out.println("jndiContext is " + jndiContext);
    CabinHome home = (CabinHome)(jndiContext.lookup("CabinHome"));
    Cabin cabin_1 = home.create(1);
    System.out.println("created it!");
    cabin_1.setName("Master Suite");
    cabin_1.setDeckLevel(1);
    cabin_1.setShip(1);
    cabin_1.setBedCount(3);
    CabinPK pk = new CabinPK();
    pk.id = 1;
    System.out.println("keyed it! ="+ pk);
    Cabin cabin_2 = home.findByPrimaryKey(pk);
    System.out.println("found by key! ="+ cabin_2);
    System.out.println(cabin_2.getName());
    System.out.println(cabin_2.getDeckLevel());
    System.out.println(cabin_2.getShip());
    System.out.println(cabin_2.getBedCount());
    } catch (java.rmi.RemoteException re){re.printStackTrace();}
    catch (javax.naming.NamingException ne){ne.printStackTrace();}
    catch (javax.ejb.CreateException ce){ce.printStackTrace();}
    catch (javax.ejb.FinderException fe){fe.printStackTrace();}
    public static InitialContext getWeblogicInitialContext()
    throws javax.naming.NamingException {
    InitialContext ctx = null;
    Hashtable ht = new Hashtable();
    ht.put(Context.INITIAL_CONTEXT_FACTORY, weblogic.jndi.WLInitialContextFactory.class.getName());
    ht.put(Context.PROVIDER_URL, "t3://localhost:7001");
    ht.put(Context.SECURITY_PRINCIPAL, "system");
    ht.put(Context.SECURITY_CREDENTIALS, new weblogic.common.T3User("system", "askpanch"));
    try {
    ctx = new InitialContext(ht);
    // Use the context in your program
    catch (NamingException e) {
    System.out.println("InitialContext could not be created");
    System.out.println("The explanation is " + e.getExplanation());
    e.printStackTrace();
    // a failure occurred
    finally {
    try {ctx.close();}
    catch (Exception e) {
    // a failure occurred
    return ctx;
    The message printed by System.out.println shows that InitialContext is created but exception is thrown when it is used by the lookup method.
    My classpath is as follows:
    CLASSPATH=C:\VisualCafeEE\Java\Lib\ERADPUBLIC.JAR;C:\VisualCafeEE\Java\Lib\servlet.jar;C:\VisualCafeEE\Java\Lib\server.jar;C:\VisualCafeEE\Bin\Components\templa
    tes.jar;C:\VisualCafeEE\Java\Lib\javax_ejb.ZIP;C:\VisualCafeEE\Java\Lib\jndi.jar;C:\VisualCafeEE\Bin\Components\vcejbwl.jar;C:\VisualCafeEE\Bin\sb;C:\VisualCafe
    EE\Bin\sb\classes\sb.jar;.;;C:\VisualCafeEE\Java\Lib;C:\VisualCafeEE\Java\Lib\SYMCLASS.ZIP;C:\VisualCafeEE\Java\Lib\CLASSES.ZIP;C:\VisualCafeEE\Java\Lib\COLLECT
    IONS.ZIP;C:\VisualCafeEE\Java\Lib\ICEBROWSERBEAN.JAR;C:\VisualCafeEE\Java\Lib\SYMTOOLS.JAR;C:\VisualCafeEE\JFC\SWINGALL.JAR;C:\VisualCafeEE\Bin\Components\SFC.J
    AR;C:\VisualCafeEE\Bin\Components\SYMBEANS.JAR;C:\VisualCafeEE\Java\Lib\DBAW.ZIP;C:\VisualCafeEE\Bin\Components\DBAW_AWT.JAR;C:\VisualCafeEE\Bin\Components\Data
    bind.JAR;C:\VisualCafeEE\Java\Lib\ERADTOOLS.JAR;;C:\IBMVJava\eab\runtime30;C:\IBMVJava\eab\runtime20;;.;c:\Weblogic\classes;c:\weblogic\lib\weblogicaux.jar
    Any help to solove this problem from anybody is greatly appreciated. I am including some other related articles in this newsgroup for your ready reference(see below).
    Thanks a lot,
    Ashok Pancharya
    Email: [email protected]
    Sounds like your WL config is a bit different, perhaps a classpath issue or
    a missing .properties file or a different command line. For whatever
    reason, the factory does not know what class is supposed to be used as the
    initial context.
    Peace.
    Cameron Purdy
    [email protected]
    http://www.tangosol.com
    WebLogic Consulting Available
    "Chris Solar" <[email protected]> wrote in message
    news:[email protected]...
    Hi-
    I'm running WLS 5.1 on NT 4.0 (SP6).
    For some reason, I'm unable to use the default
    constructor to get an initial context. That is,
    if I try:
    InitialContext ctx = new InitialContext();
    I get a NoInitialContextException, as in:
    "Need to specify class name in environment or system
    property, or as an applet parameter, or in an application
    resource file: java.naming.factory.initial"
    This does not happen if I pass in a HashTable or Properties
    object containing a value for the initial context factory
    (even if it's just weblogic.jndi.WLInitialContextFactory).
    Colleagues of mine seem to be able to use
    the defaut constructor without any problems.
    What am I missing?
    -Chris.

    Thanks Gene. Good solution. I could solve the problem which is explained in my another article posted just before a minute you posted this response.
    Thanks again.
    Ashok Pancharya
    "Gene Chuang" <[email protected]> wrote:
    According to your getWeblogicInitialContext(), you are putting ctxt.close() in a finally block,
    which will always get executed, and then returning ctxt. Don't think you can do any lookups with a
    closed Context.
    Gene Chuang
    Join Kiko.com!
    "Ashok Pancharya" <[email protected]> wrote in message news:[email protected]...
    Hi,
    I am running WLS 5.1 SP6 on Windows98. I am trying to lookup a CMP entiry bean from
    Java 1.3 client. I can successfully create the InitialContext but having trouble in using it todo the lookup. I get the following error:
    jndiContext is javax.naming.InitialContext@61f24(This is line is the result of println : see code)
    javax.naming.NoInitialContextException: Need to specify class name in environment or systemproperty, or as an applet parameter, or in an application resource file:
    java.naming.factory.initial
    at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
    at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.lookup(Unknown Source)
    at com.titan.cabin.Client_1.main(Client_1.java:21)
    My code of the Java 1.3 client is as follows:
    package com.titan.cabin;
    import com.titan.cabin.CabinHome;
    import com.titan.cabin.Cabin;
    import com.titan.cabin.CabinPK;
    import javax.naming.InitialContext;
    import javax.naming.Context;
    import javax.naming.NamingException;
    import java.rmi.RemoteException;
    import java.util.Properties;
    import java.util.Hashtable;
    public class Client_1 {
    public static void main(String [] args){
    try {
    InitialContext jndiContext = getWeblogicInitialContext();
    System.out.println("jndiContext is " + jndiContext);
    CabinHome home = (CabinHome)(jndiContext.lookup("CabinHome"));
    Cabin cabin_1 = home.create(1);
    System.out.println("created it!");
    cabin_1.setName("Master Suite");
    cabin_1.setDeckLevel(1);
    cabin_1.setShip(1);
    cabin_1.setBedCount(3);
    CabinPK pk = new CabinPK();
    pk.id = 1;
    System.out.println("keyed it! ="+ pk);
    Cabin cabin_2 = home.findByPrimaryKey(pk);
    System.out.println("found by key! ="+ cabin_2);
    System.out.println(cabin_2.getName());
    System.out.println(cabin_2.getDeckLevel());
    System.out.println(cabin_2.getShip());
    System.out.println(cabin_2.getBedCount());
    } catch (java.rmi.RemoteException re){re.printStackTrace();}
    catch (javax.naming.NamingException ne){ne.printStackTrace();}
    catch (javax.ejb.CreateException ce){ce.printStackTrace();}
    catch (javax.ejb.FinderException fe){fe.printStackTrace();}
    public static InitialContext getWeblogicInitialContext()
    throws javax.naming.NamingException {
    InitialContext ctx = null;
    Hashtable ht = new Hashtable();
    ht.put(Context.INITIAL_CONTEXT_FACTORY,weblogic.jndi.WLInitialContextFactory.class.getName());
    ht.put(Context.PROVIDER_URL, "t3://localhost:7001");
    ht.put(Context.SECURITY_PRINCIPAL, "system");
    ht.put(Context.SECURITY_CREDENTIALS, new weblogic.common.T3User("system", "askpanch"));
    try {
    ctx = new InitialContext(ht);
    // Use the context in your program
    catch (NamingException e) {
    System.out.println("InitialContext could not be created");
    System.out.println("The explanation is " + e.getExplanation());
    e.printStackTrace();
    // a failure occurred
    finally {
    try {ctx.close();}
    catch (Exception e) {
    // a failure occurred
    return ctx;
    The message printed by System.out.println shows that InitialContext is created but exception isthrown when it is used by the lookup method.
    My classpath is as follows:
    CLASSPATH=C:\VisualCafeEE\Java\Lib\ERADPUBLIC.JAR;C:\VisualCafeEE\Java\Lib\servlet.jar;C:\VisualCafe
    EE\Java\Lib\server.jar;C:\VisualCafeEE\Bin\Components\templa
    >
    tes.jar;C:\VisualCafeEE\Java\Lib\javax_ejb.ZIP;C:\VisualCafeEE\Java\Lib\jndi.jar;C:\VisualCafeEE\Bin
    \Components\vcejbwl.jar;C:\VisualCafeEE\Bin\sb;C:\VisualCafe
    >
    EE\Bin\sb\classes\sb.jar;.;;C:\VisualCafeEE\Java\Lib;C:\VisualCafeEE\Java\Lib\SYMCLASS.ZIP;C:\Visual
    CafeEE\Java\Lib\CLASSES.ZIP;C:\VisualCafeEE\Java\Lib\COLLECT
    >
    IONS.ZIP;C:\VisualCafeEE\Java\Lib\ICEBROWSERBEAN.JAR;C:\VisualCafeEE\Java\Lib\SYMTOOLS.JAR;C:\Visual
    CafeEE\JFC\SWINGALL.JAR;C:\VisualCafeEE\Bin\Components\SFC.J
    >
    AR;C:\VisualCafeEE\Bin\Components\SYMBEANS.JAR;C:\VisualCafeEE\Java\Lib\DBAW.ZIP;C:\VisualCafeEE\Bin
    \Components\DBAW_AWT.JAR;C:\VisualCafeEE\Bin\Components\Data
    >
    bind.JAR;C:\VisualCafeEE\Java\Lib\ERADTOOLS.JAR;;C:\IBMVJava\eab\runtime30;C:\IBMVJava\eab\runtime20
    ;;.;c:\Weblogic\classes;c:\weblogic\lib\weblogicaux.jar
    Any help to solove this problem from anybody is greatly appreciated. I am including some otherrelated articles in this newsgroup for your ready reference(see below).
    Thanks a lot,
    Ashok Pancharya
    Email: [email protected]
    Sounds like your WL config is a bit different, perhaps a classpath issue or
    a missing .properties file or a different command line. For whatever
    reason, the factory does not know what class is supposed to be used as the
    initial context.
    Peace.
    Cameron Purdy
    [email protected]
    http://www.tangosol.com
    WebLogic Consulting Available
    "Chris Solar" <[email protected]> wrote in message
    news:[email protected]...
    Hi-
    I'm running WLS 5.1 on NT 4.0 (SP6).
    For some reason, I'm unable to use the default
    constructor to get an initial context. That is,
    if I try:
    InitialContext ctx = new InitialContext();
    I get a NoInitialContextException, as in:
    "Need to specify class name in environment or system
    property, or as an applet parameter, or in an application
    resource file: java.naming.factory.initial"
    This does not happen if I pass in a HashTable or Properties
    object containing a value for the initial context factory
    (even if it's just weblogic.jndi.WLInitialContextFactory).
    Colleagues of mine seem to be able to use
    the defaut constructor without any problems.
    What am I missing?
    -Chris.

  • Problem in accessing two different InitialContexts simultaneously

    Hi All
    I have a strange problem the scenario is as below
    I have two different web logic servers as server1 and server2
    The Realm on server1 is user1 and password is pwd1
    The Realm on server1 is user2 and password is pwd2
    In my application on server1 I created the database connection with DataSource lookup by setting InitialContext values as java.naming.security.principal to user1 and java.naming.security.credentials to pwd1 and i have done some data base transaction .
    In between i need to made a remote EJB call which is on server2 so i created an other
    InitialContext by setting java.naming.security.principal to user2 and java.naming.security.credentials to pwd2 and this 2nd context i am closing after placing the HomeObject in a HashMap.
    After completing the EJB call I have to continue the remaining database transactions by getting the connection from lookup.
    Here i am getting the following error
    *Caused by: java.sql.SQLException: Pool connect failed : java.lang.SecurityException: [Security:090398]Invalid Subject:user2*
    If any one has faced the same problem or know the solution to this problem please help me in solving this.
    Thanks in Advance.

    The thread that establishes an initial context with a WLS server gets infected with the security credential of the initial context. Anything that thread does afterwards will be using that credential. A typical solution to this would be to obtain and cache the current subject on the thread before getting the second initial context, and then resume the subject when you need to go back to work with the first initial context. You may want to look into weblogic.Security.Security class for the APIs that you need to accomplish this.
    Regards,
    Dongbo
    Edited by: user650694 on Dec 12, 2008 10:31 AM

  • JNDI InitialContext problem:

    Hi,
    I have problem with to get look up the JDBC Factory.
    I have given code below which have been working fine in Sneak Preview SPS11. But It giving some error in SPS14.
    code:
    Hashtable env = new Hashtable();
    env.put("domain", "true");
    Context initctx = new com.sapportals.portal.prt.jndisupport.InitialContext(env);
    Object obj = initctx.lookup("deployedAdapters/JDBCFactory/shareable/JDBCFactory");
    Error:
    #com.sap.security.core.policy.PolicyInfoManagerImpl.copyApplicationConfiguration
    #Administrator#974####22d400d023ba11dbbd2a00127991cc99
    #SAPEngine_Application_Thread[impl:3]_32##0#0#Error#1#/System/Security/WS/SecurityProtocol
    #Java###An error occured while copying configurations for application .
    Reason: sap.com/LDAPTestEAR#com.sap.engine.frame.core.configuration.NameNotFoundException
    #Error##Plain###Processing HTTP request to servlet [LDAPTest] finished with error. <b>The error is: java.lang.NoClassDefFoundError: EDU/oswego/cs/dl/util/concurrent/ConcurrentReaderHashMap</b>
         at com.sapportals.portal.prt.jndisupport.util.MemoryHierarchicalContext.prepare(MemoryHierarchicalContext.java:43)
         at com.sapportals.portal.prt.jndisupport.util.AbstractHierarchicalContext.<init>(AbstractHierarchicalContext.java:53)
         at com.sapportals.portal.prt.jndisupport.util.AbstractHierarchicalContext.<init>(AbstractHierarchicalContext.java:33)
         at com.sapportals.portal.prt.jndisupport.util.MemoryHierarchicalContext.<init>(MemoryHierarchicalContext.java:28)
         at com.sapportals.portal.prt.jndisupport.JNDISupport.<init>(JNDISupport.java:32)
         at com.sapportals.portal.prt.jndisupport.JNDISupport.getInstance(JNDISupport.java:71)
         at com.sapportals.portal.prt.jndisupport.NamingManager.findContextFactory(NamingManager.java:164)
         at com.sapportals.portal.prt.jndisupport.NamingManager.getInitialContext(NamingManager.java:41)
         at com.sapportals.portal.prt.jndisupport.InitialContext.getDefaultInitCtx(InitialContext.java:39)
         at com.sapportals.portal.prt.jndisupport.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:59)
         at javax.naming.InitialContext.lookup(InitialContext.java:347)
         at com.hcl.heiam.LDAPTest.doGet(LDAPTest.java:32)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    Regards,
    Krishna.

    Hi Amrendra,
    I had set clssapath.
    This is server classpath.
    JAVA_HOME = D:\j2sdk1.4.2_09
    CLASSPATH = %CLASSPATH%;%JAVA_HOME%\lib
    I have checked as CLASSPATH = %CLASSPATH%;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\jre\lib\rt.jar;
    But, same error is coming.
    thanks for reply.
    Regards,
    Krishna.

  • InitialContext - Applet Problem

    Hi,
    When i try to get InitialContext from Applet ( running from appletviewer),
    i'm hitting this error. Please help me to solve this problem
    Exactly this line gives the error
    InitialContext ic = new InitalContext ( hEnv )
    Error:
    javax.naming.NoInitialContextException: Cannot Instantiate class:
    weblogic.jndi.WLInitialContextFactory
    -regards
    Abdul Malik

    you can use applet to pull data periodically from the servlet.
    mj
    "Anthony A." wrote:
    What if you want to perform some type of 'realtime' push from the server?
    Anthony
    "minjiang" <[email protected]> wrote in message
    news:[email protected]...
    why do you have to call your ejbs in applet directly? Why not use aservlet in
    between?
    The overhead of downloading so many so big jar files to the client machinewill
    kill/time out any broswer http session.
    mj
    Abdul Malik wrote:
    Dear Friends,
    After 5 days of struggle, somehow i was managed to access the EJB from
    Applet. But very slow coz of Big Jar files ( can make it bit small by
    identitfying required classes ). I dont know this is correct approach
    or
    not, but works ( damn slow )
    What i did was
    1) Installed the Latest Plugin 1.3.1
    2) Downloaded HTMLConverter tool from java.sun.com and converted my
    html file to use plugin.
    3) inlcuded few jar files in archive tag.
    The files i added in archive tag is
    1) myapplet.jar ( applet classes )
    2) weblogicaux.jar ( !!!!!!!!!!!! quite big jar file )
    3) weblogicclass.jar ( jarred all the classes from classes\weblogicfolder
    (!!!!!!!!!! so big jar file !!!!!! )
    4) myejb.jar ( suppose to work with home and remote class, but notworking
    ( looking for container generated files). so i added my EJB.jar file.dont
    know why ?????????? )
    then it works.
    well, i am not happy with this kind of approach. if any body haveefficient
    one, please kindly post it.
    Note: i tried in 1.2.2 plugin ( works )
    Environment: Windows 2000 / Windows 98, Weblogic 5.1 Service pack 7
    -regards
    Abdul Malik
    "Daniel Hoppe" <[email protected]> wrote in message
    news:[email protected]...
    Anthony,
    why should he place j2ee.jar in the applet classpath? Shouldn't be there
    actually. Your problem seems to be related to a class which is not
    serializable.
    Daniel
    -----Ursprüngliche Nachricht-----
    Von: Anthony A. [mailto:[email protected]]
    Bereitgestellt: Freitag, 22. Juni 2001 18:10
    Bereitgestellt in: jndi
    Unterhaltung: InitialContext - Applet Problem
    Betreff: Re: InitialContext - Applet Problem
    As a test, try to place the j2ee.jar and weblogic.jar in your
    <archive tag>.
    I have this code in my applet's init() method and it fails
    due to a JMS
    Exception.
    I'm using BEA's web server, jndi server, and app server on
    the same box as
    the client.
    Thanks,
    Anthony
    code:
    Hashtable ht = new Hashtable();
    ht.put(Context.INITIAL_CONTEXT_FACTORY,
    "weblogic.jndi.WLInitialContextFactory");
    ht.put(Context.PROVIDER_URL, "t3://anthony01:7001");
    System.out.println("creating context");
    InitialContext ctx = new InitialContext(ht);
    error:
    JMSException: weblogic.jms.common.JMSException:
    java.rmi.MarshalException:
    failed to marshal public abstract weblogic.jms.client.JMSConnection
    weblogic.jms.frontend.FEConnectionFactoryRemote.createConnecti
    on(weblogic.rj
    vm.JVMID,weblogic.jms.client.JMSCallbackRemote) throws
    javax.jms.JMSException,java.rmi.RemoteException; nested exception is:
    java.io.NotSerializableException: weblogic.jms.client.JMSCallback

  • Problem in using new InitialContext when running client application

    Hi All,
    We are having a web application which runs on weblogic server 6.1.
    We are loading a servelet at startup which will load the application specific
    properties file and bind it with the context.
    In one of the classes in the .ear file we are looking up the data source like
    this
    InitialContext _initialContext = new InitialContext();
    dataSource = (DataSource)
    initialContext.lookup(ClaimsConstants.CLAIMSRDBMS);
    con = dataSource.getConnection();
    This works fine through the jsp.
    But when I run a separate client program this lookup is failing.
    I tried another way of looking up like this
         Properties h = new Properties();
         h.put(Context.INITIAL_CONTEXT_FACTORY,
              "weblogic.jndi.WLInitialContextFactory");
         h.put(Context.PROVIDER_URL, url);
         Context _initialContext = new InitialContext(h);
    dataSource = (DataSource)
    initialContext.lookup(ClaimsConstants.CLAIMSRDBMS);
    But the weblogic server got hanged for some time after it gave no messages coming
    idle exception.
    If any body knows the solution for this please reply. I am trying to develop an
    application client but I don't know hoe to proceed. Any examples I can get for
    writing a application client using weblogic is very much welcome.
    Please give your valuable suggestions.

    Hi Krishna,
    servlet/jsp programs will work successfully in getting initial context of
    application server, because they runs at server side, and server
    automatically loaded the client library.
    If you are using application client, you need to point the weblogic.jar the
    application client classpath.What is the exception it is throwing?
    Can you test the weblogic samples from the following location of your
    installation
    \bea\wlserver6.1\samples\examples
    Thanks
    Kumar
    "Krishna Kumar" <[email protected]> wrote in message
    news:3def5758$[email protected]..
    >
    Hi All,
    We are having a web application which runs on weblogic server 6.1.
    We are loading a servelet at startup which will load the applicationspecific
    properties file and bind it with the context.
    In one of the classes in the .ear file we are looking up the data sourcelike
    this
    InitialContext _initialContext = new InitialContext();
    dataSource = (DataSource)
    initialContext.lookup(ClaimsConstants.CLAIMSRDBMS);
    con = dataSource.getConnection();
    This works fine through the jsp.
    But when I run a separate client program this lookup is failing.
    I tried another way of looking up like this
    Properties h = new Properties();
    h.put(Context.INITIAL_CONTEXT_FACTORY,
    "weblogic.jndi.WLInitialContextFactory");
    h.put(Context.PROVIDER_URL, url);
    Context _initialContext = new InitialContext(h);
    dataSource = (DataSource)
    initialContext.lookup(ClaimsConstants.CLAIMSRDBMS);
    But the weblogic server got hanged for some time after it gave no messagescoming
    idle exception.
    If any body knows the solution for this please reply. I am trying todevelop an
    application client but I don't know hoe to proceed. Any examples I can getfor
    writing a application client using weblogic is very much welcome.
    Please give your valuable suggestions.

  • JMS InitialContext Problem

    Hi,
    I am a starter in JMS, quite stuck at first program its been a hard time loading InitialContext with attributes.
    I need to know what are the context attributes that are mandatory and their values. I am listing two of them i use in my program as well please, let me know if i am wrong.
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
    env.put(Context.PROVIDER_URL, "ldap://192.168.0.221:389");Thanks in advance

    OK, so you are using the application server. Sorry, I was under the impression you were using a simple java client. Now, take what I will say with a grain of salt because I am very light on my app server skills. So if someone wants to jump in and help, please be my guest.
    For the mdb you shouldn't need to put anything in the code, it should all be managed by the application server. The JNDI entries are done by using the SJS App server admin screen (or asadmin).
    <NotSure>
    If you still need to use the file based JNDI (for sending messages I guess), then yes, you would need to get into the imqadmin and create the object factory. Please refer to the admin guide (from http://docs.sun.com) for specific values.
    </NotSure>
    In the meantime, I'll try to increase my knowledge of application servers... ;o)
    BTW, you may have some chances posting also to the Sun site for the application server forum.
    TE

  • Problem with Server-Side InitialContext

    The Weblogic 5.1 documentation states that to create a context from within a
    server-side object, all you need to do is issue the following statement:
    Context ctx = new InitialContext();
    That you do not need to specify a factory, or a provider URL; by default,
    the context will be created as a WebLogic context and will connect to the
    local naming service.
    I only get this to work when I am running from within an EJB. When I try
    this from a servlet, it doesn't work.
    I am running Weblogic 5.1 SP9 with JDK 1.3.1_02. Any ideas about what I may
    be doing wrong???

    Hi,
    runtime->session_id indicates the browser session not a windows session so as such there is nothing to prevent that except from preventing to open the app in the same browser again by eg testing on the session id
    Eddy

  • InitialContext problem when using classloader

    Hi
    I tried to do a client (stand alone not EJB bean) that make lookup for
    connection factory, which i define via the weblogic console.
    When I used simple client (not using class loaders) the Initial Context
    work fine, but when
    I try it from a client which have class loaders i got the following
    exception:
    <17:53:19 IST 08/01/2001> <Error> <JavaSocketMuxer> <Uncaught Throwable
    in proce
    ssSockets
    java.lang.OutOfMemoryError
            <<no stack trace available>>
    >
    Thanks
    Nir Parikman

    I found my problem, it was cause by order of loading the jars in the
    classpath.
    Nir Parikman wrote:
    Hi
    I tried to do a client (stand alone not EJB bean) that make lookup for
    connection factory, which i define via the weblogic console.
    When I used simple client (not using class loaders) the Initial Context
    work fine, but when
    I try it from a client which have class loaders i got the following
    exception:
    <17:53:19 IST 08/01/2001> <Error> <JavaSocketMuxer> <Uncaught Throwable
    in proce
    ssSockets
    java.lang.OutOfMemoryError
            <<no stack trace available>>
    >
    Thanks
    Nir Parikman

  • Initialcontext problem

    I am using Websphere, created a server with a datasource that connects to MySQL.
    Here is my simple code :
    public static void main(String arg[]){
              Properties p = new Properties();
              try{
              System.out.println("Initial Context Factory");
              p.put
    (Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
         System.out.println("Provider URL");
              p.put(Context.PROVIDER_URL,"iiop://localhost:2809");
              System.out.println("Initial Context");
              InitialContext ctx = new InitialContext(p);
              System.out.println("Data Source");
              DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/ds1");
              }catch(NamingException e){
              e.printStackTrace();
    There is an error when the new InitialContext(p) is called.. please help.
    Here's the error generated :
    Initial Context Factory
    Provider URL
    Initial Context
    javax.naming.NoInitialContextException: Cannot instantiate class: com.ibm.websphere.naming.WsnInitialContextFactory. Root exception is java.lang.ClassNotFoundException: com.ibm.websphere.naming.WsnInitialContextFactory
         at java.net.URLClassLoader.findClass(URLClassLoader.java:240)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:516)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:441)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:448)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:220)
         at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:57)
         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:661)
         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:255)
         at javax.naming.InitialContext.init(InitialContext.java:231)
         at javax.naming.InitialContext.<init>(InitialContext.java:207)
         at ds.test.DsTestMain.main(DsTestMain.java:33)
    Anybody, pls help.

    In WSAD5:
    * Use the following JVM argument (WSAD: Run->Run-->Argument-->VM Arguments): -Djava.ext.dirs=<WSAD_INSTALL_DIR>\runtimes\base_v5\java\jre\lib\ext;<WSAD_INSTALL_DIR>\runtimes\base_v5\java\jre\lib;<WSAD_INSTALL_DIR>\runtimes\base_v5\lib;<WSAD_INSTALL_DIR>\runtimes\base_v5\properties
    * Make sure you use the same jre as the WAS5 server (WSAD: Run-->Run-->JRE)
    * Make sure you have the classes for the expected object on your classpath (e.g. classes12.zip for the Oracle JDBC driver or com.ibm.mqjms.jar)
    Outside WSAD (please replace your installation path):
    D:\work\pd2\PersoonlijkDossier2\development>java -Djava.ext.dirs=C:\progra~1\IBM
    \APPLIC~1.1\runtimes\base_v5\java\jre\lib\ext;C:\progra~1\IBM\APPLIC~1.1\runtime
    s\base_v5\java\jre\lib;C:\progra~1\IBM\APPLIC~1.1\runtimes\base_v5\lib;C:\progra
    ~1\IBM\APPLIC~1.1\runtimes\base_v5\properties -classpath lib\was\implfactory.jar
    ;tmp\pdlib;lib\other\junit.jar;C:\progra~1\IBM\APPLIC~1
    .1/wstools/eclipse/plugins/com.ibm.websphere.v5_5.0.3.1/implfactory.jar <yourtestclass> -Dserver.root=C:\progra~1\IBM\APPLIC~1.1\runti
    mes\base_v5 -Dcom.ibm.CORBA.ConfigURL=C:\progra~1\IBM\APPLIC~1.1\runtimes\base_v
    5\properties\sas.client.props
    Note the use of the implfactory.jar on the classpath

  • Unable to get 'InitialContext' using Java Client in Oracle App 10.0.2.0

    Scenario & Problem Description: Unable to get 'Initial Context' using Simple Java Client in Oracle Application Server 10.0.2.0
    I'm having an issue while I try to initialize the Initial Context for an EJB lookup from a simple Java Client [local lookup], but the same code snippet works fine when I try from Servlet. I have enclosed the Exception Stack Trace and the Code Snippet for your reference.
    1. .NET Client ---> Servlet --> LookupUtility --> EJB --> DB - Issue
    2. .NET Client ---> Servlet --> EJB --> DB - Works
    Exception: java.lang.InstantiationException: Error communicating with server: Lookup error: javax.naming.AuthenticationException: Invalid username/password for Config (guest); nested exception is: nested exception is: Exception in InitialContext: javax.naming.NamingException: Lookup error: javax.naming.AuthenticationException: Invalid username/password for Config (guest) at com.evermind.server.ApplicationClientInitialContextFactory.getInitialContext(ApplicationClientInitialContextFactory.java:149)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
    at javax.naming.InitialContext.init(InitialContext.java:219)
    at javax.naming.InitialContext.<init>(InitialContext.java:195)
    at com.seagate.edcs.config.util.LookupUtility.getInitialContext(LookupUtility.java:123)
    at com.seagate.edcs.config.util.LookupUtility.getConfiguration (LookupUtility.java:69)
    at com.seagate.edcs.config.util.LookupUtility.main(LookupUtility.java:135)
    Code Snippet:
    * This method returns the Configuration for the properties set.
    public ArrayList getConfiguration ( ) throws Exception {
    ArrayList arrayList = null;
    try {
    Context context = getInitialContext();
    System.out.println("Context : " + context);
    Object home = context.lookup("java:comp/env/ejb/com.seagate.edcs.config.ejb.ConfigSessionEJBHome");
    System.out.println("Object home : " + home);
    ConfigSessionEJBHome configSessionEJBHome = (ConfigSessionEJBHome)PortableRemoteObject.narrow(home, ConfigSessionEJBHome.class);
    System.out.println("ConfigSessionEJBHome configSessionEJBHome : " + configSessionEJBHome);
    ConfigSessionEJB configSessionEJB =(ConfigSessionEJB)PortableRemoteObject.narrow(configSessionEJBHome.create(), ConfigSessionEJB.class);
    System.out.println("ConfigSessionEJB configSessionEJB : " + configSessionEJB);
    arrayList = configSessionEJB.getAllConfig();
    System.out.println("Context : " + context);
    } catch (Exception ex) {
    System.out.println("Exception Occured");
    throw ex;
    return arrayList;
    * Get an initial context from the JNDI tree.
    private Context getInitialContext() throws NamingException {
    try {
    Hashtable hashtable = new Hashtable();
    hashtable.put("java.naming.factory.initial", "com.evermind.server.ApplicationClientInitialContextFactory");
    hashtable.put("java.naming.provider.url", "ormi://seagate.mil-shivas-270.am.ad.seagate.com/home"); // if we won't specify the port, it considers the default port
    hashtable.put("java.naming.security.principal","ias_admin");
    hashtable.put("java.naming.security.credentials","ias123");
    return new InitialContext(hashtable);
    } catch (NamingException ne) {
    System.out.println("Exception in InitialContext.");
    throw ne;
    Note:
    1. The user "ias_admin" & password "ias123" are the credential provided for the 'Admin' while installing the Oracle App Server and using these credentials I'm able to bring the Admin Console. Also, added new user 'guest/guest' - assigned this user to the 'admin' group ...
    2. Since its a local lookup, there is no need to specify the credentials, but at runtime a dialog box pops up prompting to enter the 'userid/password' and when I enter the crendtials, I get the exception as stated. [In case of Servlet - EJB lookup, I'm not specifying any credentials]
    Are there are any configuration parameters which I need to provide in any of the .xml? Could you please let me know the fix for the same.
    Regards,
    Kafeel/-

    Please use the OS {forum:id=210}

  • Problem to send a message with JMS

    Hi
    I'm doing some tests with the api JMS to know how works. I have got some problems. I have been looking for some information but i don't find so much. I have got too doubts.
    I am usinng Netbeans 5.5 with Sun Java System Application Server Platform Edition 9.0_01 (build b14).
    I am trying to do it with ejb. Because in the future the application can have got so many connection in the same time.
    The server shows me the next errors.
    Starting Sun Java System Application Server Platform Edition 9.0_01 (build b14) ...
    CORE5098: AS Socket Service Initialization has been completed.
    CORE5076: Using [Java HotSpot(TM) Client VM, Version 1.6.0_03] from [Sun Microsystems Inc.]
    SEC1002: Security Manager is OFF.
    ADM0001:MBeanServer initialized successfully
    SEC1143: Loading policy provider com.sun.enterprise.security.provider.PolicyWrapper.
    sgmt.service_initialized
    DPL5400:Exception occurred : error in opening zip file.
    ADM1079: Initialization of AMX MBeans successful
    ADM1504: Here is the JMXServiceURL for the Standard JMXConnectorServer: [service:jmx:rmi:///jndi/rmi://t1:8686/jmxrmi].  This is where the remote administrative clients should connect using the standard JMX connectors
    ADM1506: Status of Standard JMX Connector: Active = [true]
    JTS5014: Recoverable JTS instance, serverId = [3700]
    About to load the system app: MEjbApp
    LDR5010: All ejb(s) of [MEjbApp] loaded successfully!
    About to load the system app: __ejb_container_timer_app
    EJB5109:EJB Timer Service started successfully for datasource [jdbc/__TimerPool]
    LDR5010: All ejb(s) of [__ejb_container_timer_app] loaded successfully!
    NAM0008 : Invalid Destination: jndi/Topic for java:comp/env/jms/Topic
    EJB5090: Exception in creating EJB container [javax.naming.NamingException [Root exception is javax.naming.NameNotFoundException]]
    appId=Chat-ejb moduleName=Chat-ejb ejbName=publicarBean
    LDR5004: UnExpected error occured while creating ejb container
    javax.naming.NamingException [Root exception is javax.naming.NameNotFoundException]
            at com.sun.enterprise.naming.NamingManagerImpl.bindObjects(NamingManagerImpl.java:485)
            at com.sun.ejb.containers.BaseContainer.setupEnvironment(BaseContainer.java:2628)
            at com.sun.ejb.containers.BaseContainer.<init>(BaseContainer.java:629)
            at com.sun.ejb.containers.StatelessSessionContainer.<init>(StatelessSessionContainer.java:163)
            at com.sun.ejb.containers.ContainerFactoryImpl.createContainer(ContainerFactoryImpl.java:515)
            at com.sun.enterprise.server.AbstractLoader.loadEjbs(AbstractLoader.java:490)
            at com.sun.enterprise.server.EJBModuleLoader.load(EJBModuleLoader.java:158)
            at com.sun.enterprise.server.AbstractManager.load(AbstractManager.java:206)
            at com.sun.enterprise.server.ApplicationLifecycle.onStartup(ApplicationLifecycle.java:198)
            at com.sun.enterprise.server.ApplicationServer.onStartup(ApplicationServer.java:326)
            at com.sun.enterprise.server.ondemand.OnDemandServer.onStartup(OnDemandServer.java:112)
            at com.sun.enterprise.server.PEMain.run(PEMain.java:326)
            at com.sun.enterprise.server.PEMain.main(PEMain.java:260)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at com.sun.enterprise.server.PELaunch.main(PELaunch.java:272)
    Caused by: javax.naming.NameNotFoundException
            at com.sun.enterprise.naming.TransientContext.resolveContext(TransientContext.java:255)
            at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:178)
            at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:61)
            at com.sun.enterprise.naming.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:98)
            at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:309)
            at javax.naming.InitialContext.lookup(InitialContext.java:392)
            at com.sun.enterprise.naming.NamingManagerImpl.bindObjects(NamingManagerImpl.java:469)
            ... 17 more
    CORE5021: Application NOT loaded: [Chat-ejb]
    WEB0302: Starting Sun-Java-System/Application-Server.
    WEB0100: Loading web module [__default-admingui] in virtual server [__asadmin] at [/]
    WEB0100: Loading web module [adminapp] in virtual server [__asadmin] at [/web1]
    WEB0100: Loading web module [admingui] in virtual server [__asadmin] at [/asadmin]
    WEB0100: Loading web module [amserver] in virtual server [server] at [/amserver]
    Initializing Sun's JavaServer Faces implementation (1.2_02-b03-FCS) for context ''
    Completed initializing Sun's JavaServer Faces implementation (1.2_02-b03-FCS) for context ''
    Initializing Sun's JavaServer Faces implementation (1.2_02-b03-FCS) for context '/asadmin'
    Completed initializing Sun's JavaServer Faces implementation (1.2_02-b03-FCS) for context '/asadmin'
    WEB0712: Starting Sun-Java-System/Application-Server HTTP/1.1 on 8080
    WEB0712: Starting Sun-Java-System/Application-Server HTTP/1.1 on 8181
    WEB0712: Starting Sun-Java-System/Application-Server HTTP/1.1 on 4848
    About to load the system app: __JWSappclients
    WEB0100: Loading web module [__JWSappclients:sys.war] in virtual server [server] at [/__JWSappclients]
    Using MQ RA for Broker lifecycle control
    JMS Service Connection URL is :mq://t1:7676/
    MQJMSRA_RA1101: SJSMQ JMS Resource Adapter starting...
    EB-start:brokerProps={imq.instancename=imqbroker, imq.jmx.rmiregistry.port=8686, BrokerArgs=-port 7676 -name imqbroker -imqhome D:\Sun\AppServer\imq\bin\.. -varhome D:/sun/AppServer/domains/domain1\imq -useRmiRegistry -rmiRegistryPort 8686, imq.jmx.rmiregistry.use=true, imq.portmapper.port=7676}
    [07/nov/2007:18:35:03 CET]
    ================================================================================
    Sun Java(tm) System Message Queue 4.0
    Sun Microsystems, Inc.
    Version:  4.0  (Build 27-a)
    Compile:  Thu 03/02/2006
    Copyright (c) 2006 Sun Microsystems, Inc.  All rights reserved.
    SUN PROPRIETARY/CONFIDENTIAL.  Use is subject to license terms.
    This product includes code licensed from RSA Data Security.
    ================================================================================
    Java Runtime: 1.6.0_03 Sun Microsystems Inc. D:\sun\Java\jdk1.6.0_03\jre
    [07/nov/2007:18:35:03 CET]    IMQ_HOME=D:\sun\AppServer\imq
    [07/nov/2007:18:35:03 CET] IMQ_VARHOME=D:\sun\AppServer\domains\domain1\imq
    [07/nov/2007:18:35:03 CET] Windows XP 5.1 x86 t1 (1 cpu) pepepc
    [07/nov/2007:18:35:03 CET] Java Heap Size: max=506816k, current=46944k
    [07/nov/2007:18:35:03 CET] Arguments: -port 7676 -name imqbroker -imqhome D:\Sun\AppServer\imq\bin\.. -varhome D:/sun/AppServer/domains/domain1\imq -useRmiRegistry -rmiRegistryPort 8686
    [07/nov/2007:18:35:04 CET] [B1060]: Loading persistent data...
    [07/nov/2007:18:35:04 CET] Using built-in file-based persistent store: D:\sun\AppServer\domains\domain1\imq\instances\imqbroker\
    [07/nov/2007:18:35:04 CET] [B1189]: Cluster Service feature is not available
    [07/nov/2007:18:35:04 CET] [B1039]: Broker "imqbroker@t1:7676" ready.
    MQJMSRA_EB1101: run:EMBEDDED broker started with code =0
    MQJMSRA_RA1101: SJSMQ JMS ResourceAdaapter configuration=
            raUID                               =null
            brokerType                          =EMBEDDED
            brokerInstanceName                  =imqbroker
            brokerBindAddress                   =null
            brokerPort                          =7676
            brokerHomeDir                       =D:\Sun\AppServer\imq\bin\..
            brokerVarDir                        =D:/sun/AppServer/domains/domain1\imq
            brokerJavaDir                       =D:/sun/Java/jdk1.6.0_03
            brokerArgs                          =null
            brokerStartTimeout                  =60000
            adminUsername                       =admin
            adminPassFile                       =E:\tempWin\asmq21980.tmp
            useJNDIRmiServiceURL                =true
            rmiRegistryPort                     =8686
            startRmiRegistry                    =false
            useSSLJMXConnector                  =true
            brokerEnableHA                      =false
            clusterId                           =null
            brokerId                            =null
            jmxServiceURL                       =null
            dbType                              =null
            dbProps                             ={}
            dsProps                             ={}
            ConnectionURL                       =
            UserName                            =guest
            ReconnectEnabled                    =true
            ReconnectInterval                   =5000
            ReconnectAttempts                   =3
            AddressListBehavior                 =RANDOM
            AddressListIterations               =3
            InAppClientContainer                =false
            InClusteredContainer                =false
            GroupName                           =null
    MQJMSRA_RA1101: start:SJSMQ JMSRA Connection Factory Config={imqOverrideJMSPriority=false, imqConsumerFlowLimit=1000, imqOverrideJMSExpiration=false, imqAddressListIterations=3, imqLoadMaxToServerSession=true, imqConnectionType=TCP, imqPingInterval=30, imqSetJMSXUserID=false, imqConfiguredClientID=, imqSSLProviderClassname=com.sun.net.ssl.internal.ssl.Provider, imqJMSDeliveryMode=PERSISTENT, imqConnectionFlowLimit=1000, imqConnectionURL=http://localhost/imq/tunnel, imqBrokerServiceName=, imqJMSPriority=4, imqBrokerHostName=localhost, imqJMSExpiration=0, imqAckOnProduce=, imqEnableSharedClientID=false, imqAckTimeout=0, imqAckOnAcknowledge=, imqConsumerFlowThreshold=50, imqDefaultPassword=guest, imqQueueBrowserMaxMessagesPerRetrieve=1000, imqDefaultUsername=guest, imqReconnectEnabled=false, imqConnectionFlowCount=100, imqAddressListBehavior=PRIORITY, imqReconnectAttempts=3, imqSetJMSXAppID=false, imqConnectionHandler=com.sun.messaging.jmq.jmsclient.protocol.tcp.TCPStreamHandler, imqSetJMSXRcvTimestamp=false, imqBrokerServicePort=0, imqDisableSetClientID=false, imqSetJMSXConsumerTXID=false, imqOverrideJMSDeliveryMode=false, imqBrokerHostPort=7676, imqQueueBrowserRetrieveTimeout=60000, imqSetJMSXProducerTXID=false, imqSSLIsHostTrusted=false, imqConnectionFlowLimitEnabled=false, imqReconnectInterval=5000, imqAddressList=localhost:7676, imqOverrideJMSHeadersToTemporaryDestinations=false}
    MQJMSRA_RA1101: SJSMQ JMSRA Started
    endpoint.determine.destinationtype
    NAM0008 : Invalid Destination: jndi/Topic for java:comp/env/jms/Topic
    EJB5090: Exception in creating EJB container [javax.naming.NamingException [Root exception is javax.naming.NameNotFoundException]]
    appId=Chat moduleName=Chat-ejb_jar ejbName=publicarBean
    LDR5004: UnExpected error occured while creating ejb container
    javax.naming.NamingException [Root exception is javax.naming.NameNotFoundException]
            at com.sun.enterprise.naming.NamingManagerImpl.bindObjects(NamingManagerImpl.java:485)
            at com.sun.ejb.containers.BaseContainer.setupEnvironment(BaseContainer.java:2628)
            at com.sun.ejb.containers.BaseContainer.<init>(BaseContainer.java:629)
            at com.sun.ejb.containers.StatelessSessionContainer.<init>(StatelessSessionContainer.java:163)
            at com.sun.ejb.containers.ContainerFactoryImpl.createContainer(ContainerFactoryImpl.java:515)
            at com.sun.enterprise.server.AbstractLoader.loadEjbs(AbstractLoader.java:490)
            at com.sun.enterprise.server.ApplicationLoader.load(ApplicationLoader.java:184)
            at com.sun.enterprise.server.TomcatApplicationLoader.load(TomcatApplicationLoader.java:113)
            at com.sun.enterprise.server.AbstractManager.load(AbstractManager.java:206)
            at com.sun.enterprise.server.ApplicationLifecycle.onStartup(ApplicationLifecycle.java:204)
            at com.sun.enterprise.server.ApplicationServer.onStartup(ApplicationServer.java:326)
            at com.sun.enterprise.server.ondemand.OnDemandServer.onStartup(OnDemandServer.java:112)
            at com.sun.enterprise.server.PEMain.run(PEMain.java:326)
            at com.sun.enterprise.server.PEMain.main(PEMain.java:260)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at com.sun.enterprise.server.PELaunch.main(PELaunch.java:272)
    Caused by: javax.naming.NameNotFoundException
            at com.sun.enterprise.naming.TransientContext.resolveContext(TransientContext.java:255)
            at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:178)
            at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:61)
            at com.sun.enterprise.naming.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:98)
            at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:309)
            at javax.naming.InitialContext.lookup(InitialContext.java:392)
            at com.sun.enterprise.naming.NamingManagerImpl.bindObjects(NamingManagerImpl.java:469)
            ... 18 more
    Registering ad hoc servlet: WebPathPath: context root = "/Chat", path = "/Chat-app-client'
    Java Web Start services started for application com.sun.enterprise.appclient.jws.ApplicationContentOrigin@aabc2d registration name=Chat
        [email protected]56b4 registration name=Chat, context root=/Chat/Chat-app-client, module name=
    , parent=Chat
    CORE5021: Application NOT loaded: [Chat]
    SMGT0007: Self Management Rules service is enabled
    Application server startup complete.
    JBISE6013: JavaEEServiceEngine : Java EE Service Engine started successfully.
    CORE5024: EJB module [Chat-ejb] unloaded successfully!
    DeployedItemRef postDeregistration failed. Load Balancer Monitoring MBeans might be lying around if this application is being load balanced
    BPEL service engine started
    ADM1064:The upload file at [E:\tempWin\s1astempdomain1server-162970426\Chat-ejb.jar] exists and will be overwritten.
    ADM1006:Uploading the file to:[E:\tempWin\s1astempdomain1server-162970426\Chat-ejb.jar]
    deployed with moduleid = Chat-ejb
    ADM1041:Sent the event to instance:[ModuleDeployEvent -- enable ejb/Chat-ejb]
    endpoint.determine.destinationtype
    NAM0008 : Invalid Destination: jndi/Topic for java:comp/env/jms/Topic
    EJB5090: Exception in creating EJB container [javax.naming.NamingException [Root exception is javax.naming.NameNotFoundException]]
    appId=Chat-ejb moduleName=D__sun_AppServer_domains_domain1_applications_j2ee-modules_Chat-ejb ejbName=publicarBean
    LDR5004: UnExpected error occured while creating ejb container
    javax.naming.NamingException [Root exception is javax.naming.NameNotFoundException]
            at com.sun.enterprise.naming.NamingManagerImpl.bindObjects(NamingManagerImpl.java:485)
            at com.sun.ejb.containers.BaseContainer.setupEnvironment(BaseContainer.java:2628)
            at com.sun.ejb.containers.BaseContainer.<init>(BaseContainer.java:629)
            at com.sun.ejb.containers.StatelessSessionContainer.<init>(StatelessSessionContainer.java:163)
            at com.sun.ejb.containers.ContainerFactoryImpl.createContainer(ContainerFactoryImpl.java:515)
            at com.sun.enterprise.server.AbstractLoader.loadEjbs(AbstractLoader.java:490)
            at com.sun.enterprise.server.EJBModuleLoader.load(EJBModuleLoader.java:158)
            at com.sun.enterprise.server.StandAloneEJBModulesManager.moduleDeployed(StandAloneEJBModulesManager.java:219)
            at com.sun.enterprise.server.StandAloneEJBModulesManager.moduleDeployed(StandAloneEJBModulesManager.java:174)
            at com.sun.enterprise.server.StandAloneEJBModulesManager.moduleDeployed(StandAloneEJBModulesManager.java:406)
            at com.sun.enterprise.server.StandAloneEJBModulesManager.moduleEnabled(StandAloneEJBModulesManager.java:500)
            at com.sun.enterprise.admin.event.AdminEventMulticaster.invokeModuleDeployEventListener(AdminEventMulticaster.java:960)
            at com.sun.enterprise.admin.event.AdminEventMulticaster.handleModuleDeployEvent(AdminEventMulticaster.java:941)
            at com.sun.enterprise.admin.event.AdminEventMulticaster.processEvent(AdminEventMulticaster.java:448)
            at com.sun.enterprise.admin.event.AdminEventMulticaster.multicastEvent(AdminEventMulticaster.java:160)
            at com.sun.enterprise.admin.server.core.AdminNotificationHelper.sendNotification(AdminNotificationHelper.java:128)
            at com.sun.enterprise.admin.server.core.ConfigInterceptor.postInvoke(ConfigInterceptor.java:109)
            at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:97)
            at $Proxy1.invoke(Unknown Source)
            at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:297)
            at com.sun.enterprise.admin.jmx.remote.server.callers.InvokeCaller.call(InvokeCaller.java:56)
            at com.sun.enterprise.admin.jmx.remote.server.MBeanServerRequestHandler.handle(MBeanServerRequestHandler.java:142)
            at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.processRequest(RemoteJmxConnectorServlet.java:109)
            at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.doPost(RemoteJmxConnectorServlet.java:180)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
            at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
            at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:174)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:276)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
            at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
            at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
            at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
            at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:239)
            at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
            at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
            at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
            at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
            at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
            at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
            at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
    Caused by: javax.naming.NameNotFoundException
            at com.sun.enterprise.naming.TransientContext.resolveContext(TransientContext.java:255)
            at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:178)
            at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:61)
            at com.sun.enterprise.naming.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:98)
            at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:309)
            at javax.naming.InitialContext.lookup(InitialContext.java:392)
            at com.sun.enterprise.naming.NamingManagerImpl.bindObjects(NamingManagerImpl.java:469)
            ... 54 more
    CORE5020: Error while loading ejb module
    {code}
    I know it is very large. I think the error it is in this line.
    {code}
    NAM0008 : Invalid Destination: jndi/Topic for java:comp/env/jms/Topic
    EJB5090: Exception in creating EJB container [javax.naming.NamingException [Root exception is javax.naming.NameNotFoundException]]
    {code}
    also I am going to put the code.
    file PublicarBean.java
    {code}
    package org.pepes;
    import com.sun.tools.ws.processor.model.java.JavaArrayType;
    import javax.annotation.Resource;
    import javax.ejb.SessionContext;
    import javax.ejb.Stateless;
    import javax.jms.ConnectionFactory;
    import javax.jms.QueueConnectionFactory;
    import javax.jms.Topic;
    import javax.naming.NamingException;
    * @author pepes
    @Stateless(mappedName="ejb/publicar")
    public class publicarBean implements org.pepes.publicarRemote {
        /** Creates a new instance of publicarBean */
        @Resource(name="jms/QueueConnectionFactory")
        private QueueConnectionFactory connectionFactory;
        @Resource(name="jms/Topic", mappedName="jndi/Topic")
        private Topic topic;
        private javax.naming.InitialContext ctx;
        public publicarBean() {
        public void creaMensaje() throws javax.naming.NamingException , javax.jms.JMSException {
            try {       
                javax.naming.InitialContext ctx = new javax.naming.InitialContext();
                this.connectionFactory = (javax.jms.QueueConnectionFactory)ctx.lookup("jms/QueueConnectionFactory");
                this.topic = (javax.jms.Topic)ctx.lookup("jms/Topic");
                javax.jms.Connection connection = this.connectionFactory.createConnection();
                javax.jms.TopicSession ts = (javax.jms.TopicSession)connection.createSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE);
                javax.jms.TopicPublisher tp = ts.createPublisher(this.topic);
                javax.jms.TextMessage msg = ts.createTextMessage();
                for (int i = 0; i<3;i++) {
                    msg.setText("Prueba: " + i);
                    tp.publish(msg);
            catch (javax.jms.JMSException jmex) {
                throw jmex;
    {code}
    the file publicarRemote.java
    {code}
    package org.pepes;
    import javax.ejb.Remote;
    * This is the business interface for publicar enterprise bean.
    @Remote
    public interface publicarRemote {
         public void creaMensaje() throws javax.naming.NamingException , javax.jms.JMSException;
    {code}
    file mensaje.java
    {code}
    package org.pepes;
    import javax.annotation.Resource;
    import javax.ejb.ActivationConfigProperty;
    import javax.ejb.MessageDriven;
    import javax.ejb.MessageDrivenContext;
    import javax.jms.Message;
    import javax.jms.MessageListener;
    * Entity class Mensaje
    * @author pepes
    @MessageDriven(mappedName = "jms/Mensaje", activationConfig =  {
            @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
            @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue")
    public class Mensaje implements MessageListener {
        /** Creates a new instance of Mensaje */
        @Resource
        private MessageDrivenContext mdc;
        public Mensaje() {
        public void onMessage(Message message) {
            javax.jms.TextMessage msg = null;
            try {
                if (message instanceof javax.jms.TextMessage) {
                    msg = (javax.jms.TextMessage) message;
                    System.out.println(msg.getText());
                } else {
                    System.out.println("Message of wrong type: "
                            + message.getClass().getName());
            } catch (javax.jms.JMSException e) {
                e.printStackTrace();
                mdc.setRollbackOnly();
            } catch (Throwable te) {
                te.printStackTrace();
    {code}
    the file prueba.jsp
    {code}
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%--
    The taglib directive below imports the JSTL library. If you uncomment it,
    you must also add the JSTL library to the project. The Add Library... action
    on Libraries node in Projects view can be used to add the JSTL 1.1 library.
    --%>
    <%--
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    --%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>JSP Page</title>
        </head>
        <body>
        <h1>JSP Page</h1>
        <%--
        This example uses JSTL, uncomment the taglib directive above.
        To test, display the page like this: index.jsp?sayHello=true&name=Murphy
        --%>
        <%--
        <c:if test="${param.sayHello}">
            <!-- Let's welcome the user ${param.name} -->
            Hello ${param.name}!
        </c:if>
        --%>
        <%    
            try {
            javax.naming.InitialContext ctx = new javax.naming.InitialContext();
            org.pepes.publicarRemote publisher = (org.pepes.publicarRemote)ctx.lookup("ejb/publicar");
            if (publisher==null) {
                System.out.println("INFO: Es null");
            else {
                System.out.println("INFO: No es null");
            publisher.creaMensaje();
            } catch (javax.naming.NamingException ex) {
                System.out.println("ERROR naming: " + ex.getMessage());
            catch (javax.jms.JMSException jmex) {
                System.out.println("ERROR jms: " + jmex.getMessage());
            catch (java.lang.NullPointerException nullex) {
                System.out.println("ERROR null: " + nullex.getMessage());
    %>
        </body>
    </html>
    {code}
    I think the problem is because i don't put destination address. if it is so, the true where do I put this address?. if not where is the problem?
    I hope your help.
    Thanks you  in advanced.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

    Hi,
    Did you create your destinations in your application server? It seems that the destinations such as topics and queues are not created. First you should create them and then start using them.
    For example, in here, it says that jndi/Topic is not valid. To check if the destinations are valid or not; you can do it either through the graphical user interface or the command line console.

  • Problem Sending mails in a loop using JavaMail API

    Hello All,
    I am sending emails in a loop(one after the other) using JavaMail API,but the problem is, if the first two,three email addresses in the loop are Valid it sends the Email Properly, but if the Fourth or so is Invalid Address it throws an Exception....
    "javax.mail.SendFailedException: Sending failed;"
    nested exception is:
    javax.mail.SendFailedException: Invalid Addresses;
    nested exception is:
    javax.mail.SendFailedException: 450 <[email protected]>:Recipient address rejected: Domain not found......
    So if i want to send hundereds of emails and if one of the Emails inbetween is Invalid the process Stops at that point and i could not send the other emails in the Loop......
    How Could i Trap the exception thrown and handle it in such a way, so that the loops continues ..
    Is there something with the SMTP Server....?
    The code which i am using is as follows....
    <Code>...
    try {
    InitialContext ic = new InitialContext();
    Session session = (Session) ic.lookup(JNDINames.MAIL_SESSION);
    if (Debug.debuggingOn)
    session.setDebug(true);
    // construct the message
    MimeMessage msg = new MimeMessage(session);
    msg.setFrom(new InternetAddress(eMess.getEmailSender()));
    String to = "";
    msg.setRecipients(Message.RecipientType.TO,
    InternetAddress.parse(to, false));
    msg.setRecipients(Message.RecipientType.BCC,
    InternetAddress.parse(eMess.getEmailReceiver(), false));
    msg.setSubject(eMess.getSubject());
    msg.setContent(eMess.getHtmlContents(),"text/plain");
    msg.saveChanges();                
    Transport.send(msg);
    } catch (Exception e) {
    Debug.print("createAndSendMail exception : " + e);
    throw new MailerAppException("Failure while sending mail");
    </Code>....
    Please give me any suggestions regarding it....and guide me accordingly..
    Thanks a million in advance...
    Regards
    Sam

    How about something like the code attached here. Be aware it is lifted and edited out of an app we have here so it may require changing to get it to work. If it don't work - don't come asking for help as this is only a rough example of one way of doing it. RTFM - that's how we worked it out!
    SH
    try {
    Transport.send(msg);
    // If we get to here then the mail went OK so update all the records in the email as sent
    System.out.println("Email sent OK");
    catch (MessagingException mex) {
    System.out.println("Message error");
    Exception ex = mex;
    do {
    if (ex instanceof SendFailedException) {
    if (ex.getMessage().startsWith("Sending failed")) {
    // Ignore this message as we want to know the real reason for failure
    // If we get an Invalid Address error or a Message partially delivered message process the message
    if (ex.getMessage().startsWith("Message partially delivered")
    || ex.getMessage().startsWith("Invalid Addresses")) {
    // This message is of interest as we need to process the actual individual addresses
    System.out.println(ex.getMessage().substring(0, ex.getMessage().indexOf(";")));
    // Now get the addresses from the SendFailedException
    SendFailedException sfex = (SendFailedException) ex;
    Address[] invalid = sfex.getInvalidAddresses();
    if (invalid != null) {
    System.out.println("Invalid Addresse(s) found -");
    if (invalid.length > 0) {
    for (int x = 0; x < invalid.length; x++) {
    System.out.println(invalid[x].toString().trim());
    Address[] validUnsent = sfex.getValidUnsentAddresses();
    if (validUnsent != null) {
    System.out.println("Valid Unsent Addresses found -");
    if (validUnsent.length > 0) {
    for (int x = 0; x < validUnsent.length; x++) {
    System.out.println(validUnsent[x].toString().trim());
    Address[] validSent = sfex.getValidSentAddresses();
    if (validSent != null) {
    System.out.println("Valid Sent Addresses found -");
    if (validSent.length > 0) {
    for (int x = 0; x < validSent.length; x++) {
    System.out.println(validSent[x].toString().trim());
    if (ex instanceof MessagingException)
    ex = ((MessagingException) ex).getNextException();
    else {
    // This is a general catch all and we should assume that no messages went and should stop
    System.out.println(ex.toString());
    throw ex;
    } while (ex != null);

Maybe you are looking for

  • MIGO Goods receipt Error

    Dear All                At the time of goods receipt with reference to 303 movement type system through out the error as " In consistancy in classifycation Data" after that its terminating the session ..what is the problem and solution.. for this Reg

  • HOW CAN I COPY AND PAST A LINK INTO/ONTO A FORM???

    I use acrobat X and have created froms to fill out and email to clients so they can review differnt real estate properties and i want to past a link at the bottom of the form. When i receive an email alert about a new property there is a hyperlink in

  • CS6 Instalation errors

    I spent 5+4 hours with two Adobe tech agents (India) a few days ago, trying to resolve CS6 instalation errors. No solution only a damaged Acrobat 8.1.3 which I need everyday and was in WORKING order before all this. Acrobat 8 cannot find a cab file f

  • With the new offer of $9.99 for CC and Lightroom 5, can I cancel at the end of year without penalty?

    After reviewing the current offer of $9.99 for C.C. and Lightroom 5 can I cancel my subscription after the 12 months without penalty before the renewal at a different rate?

  • MacBook Pro 13" 2.53GHz vs MacBook Pro 15" 2.53GHz

    Hi everyone, So I know this seems like a moronic question, but I've been contemplating getting a MacBook/MacBook Pro for way too long now, and because the promotion deadline is approaching fast, I was wondering if I can get some input from some more