Default initial context in cluster -multi homed environment

Hi,
          Here is the configuration for our environment.
          Cluster at the webserver level only.
          Mutihomed Solaris.
          Guest user is disabled.
          I call this statement from a class which is application server.
          InitialContext l_objInitialContext = new InitialContext();
          Can I use l_objInitialContext to do a lookup to the application server
          where this class is loaded?
          Thanks
          Suresh
          

The truststore is invalid. Can you list it with the keytool?

Similar Messages

  • Creating initial context from a java client

    I have tried to create intial context from a java client.....
    but that gives me the following exception:
    My code:TestClient.java
    import java.util.*;
    import javax.naming.*;
    public class TestClient
    public static void main(String nilesh[]) throws NamingException
    Hashtable hash = new Hashtable();
    hash.put("Context.INITIAL_CONEXT_FACTORY","com.evermind.server.rmi.RMIInitialContextFactory");
    hash.put("Context.PROVIDER_URL","ormi://localhost:23791/symularity");
    hash.put("Context.SECURITY_PRINCIPAL","admin");
    hash.put("Context.SECURITY_CREDENTIALS","admin");
    Context ctx = new InitialContext(hash);
    System.out.println("Context: "+ctx);
    The output is:
    ERROR! Shared library ioser12 could not be found.
    Exception in thread "main" javax.naming.NamingException: Error accessing repository: Cannot con
    nect to ORB
    at com.sun.enterprise.naming.EJBCtx.<init>(EJBCtx.java:51)
    at com.sun.enterprise.naming.EJBInitialContextFactory.getInitialContext(EJBInitialConte
    xtFactory.java:62)
    at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
    at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.init(Unknown Source)
    at javax.naming.InitialContext.<init>(Unknown Source)
    at TestClient.main(TestClient.java:14)
    is anybody able to solve my problem....
    Thanks in advance..
    NileshG

    Nilesh,
    First of all make sure that the shared library error you are getting is fixed by including the library in your classpath. Secondly, where are you running the client from? The connection factory that you use varies depending on where you are connecting from:
    1. ApplicationClientContextFactory is used when looking up remote objects from standalone application clients. This uses refs and mappings in application-client.xml.
    2. RMInitialContextFactory is used when looking up remote objects between different containers.
    3. ApplicationInitalContextFactory is used when looking up remote objects in same application. This is the default initial context factory and this uses refs/mappings in web.xml and ejb-jar.xml.
    Rob Cole
    Oracle Hello Rob cole..
    thank u for ur reply...but actualy i dont know what is application-client.xml and where i can find that file in my j2ee folder...can u give me detail explanation about that...actually i have not created any application or not deployed also without deploying any application i have created that TestClient.java class so how it will relate with application-client.xml....so i have changed the lookup code with ApplicaitonClientContextFactory...but still the same error is coming......can u give me the full explanation or solution of my problem...
    Thanks & Regards
    NileshG...

  • Initial context and PROVIDER_URL default

    I´d like a short way to put into the initial context the correct provider.
    Default value of PROVIDER_URL is "t3://localhost:7001", but this is tied to a specific port (I run two instances of Weblogic in a development environment).
    How can I detect on wich port is running my instance of weblogic server in order to put the provider value in an independent way.
    Thanks,

    I am fairly new to JBoss as well, so I may be of limited help here. Although JBoss can use a jndi.properties file (as you are using) I have not experimented with this appraoch as of yet ...I supply a Hashtable filled with the appropriate properties.
    i.e.
        java.util.Hashtable props = new java.util.Hashtable();
         props.put(
          Context.INITIAL_CONTEXT_FACTORY,
        props.put(
          Context.PROVIDER_URL,
        props.put(
          Context.URL_PKG_PREFIXES,
        Context ctx = null;
        try {
           ctx = new InitialContext(props);
        } catch (NamingException ne) {
          System.out.println("Failed to create JNDI context from EJB server.");
          System.out.println(ne.toString(true));
        }However, I am starting to think this might not be the problem. I was reading the JBoss newsgroup yesterday and there are some jars from the JBoss "client" folder that need to be included in the classpath when running your client, but I sent the doc I created home (I could verify for you later if we can'y figure it out here from memory). You need two for sure, one being $JBOSS_HOME/client/log4j.jar and the other being (something like) $JBOSS_HOME/client/clientall-jboss.jar
    If you experiment with what you find in the client folder in the JBoss install dir, you will likely find the jars you need in the classpath by process of elimination.
    Hope this helps, sorry all my references are at home at the moment.
    GumB.

  • Error in JMS receiver adapter: "Error creating initial context with environment"

    Hello,
    I have some trouble with a JMS receiver adapter (access to JMS-provider with JNDI).
    The message in adapter monitoring is:
    A channel error occurred. Detailed error (if any) :
    com.sap.aii.adapter.jms.api.connector.ConnectorException: Fatal Error looking up connection factoryJMSQueueConnectionFactory, for profile: ConnectionProfile of channel: CC_JMS_RCV_XLIMI00001on node: 503473150 having object id: 5b424f2f79b6350ca636ab35d528cfdd:
    ConnectorException: Error creating initial context with environment: java.naming.provider.url=wcsefdev.example.com:9064; java.naming.factory.initial=com.ibm.websphere.naming.WsnInitialContextFactory; for profile: ConnectionProfile of channel:
    CC_JMS_RCV_XLIMI00001on node: 503473150 having object id: 5b424f2f79b6350ca636ab35d528cfdd: javax.naming.NoInitialContextException:
    Cannot instantiate class: com.ibm.websphere.naming.WsnInitialContextFactory<br> at com.sap.aii.adapter.jms.core.connector.JndiConnectorImpl.createConnectionFactory
    (JndiConnectorImpl.java:152)<br> ....
    Message processing failed. Cause:
    com.sap.aii.adapter.jms.core.fsm.DFA$InvalidTransitionException: No transition found from state: ERROR, on event: process_commence for DFA: CC_JMS_RCV_XLIMI00001:5b424f2f79b6350ca636ab35d528cfdd
    The third party assured me that the specified JNDI parameters are right and everything is configured on their site, so it should work...
    Might there be a problem with the JMS drivers?
    Regards,
    Marcus

    Hi Marcus,
    Have a look at below thread
    Connecting to PI 7.11 JMS Queue from other PI 7.11 Server

  • Error creating initial context with environment

    Hi,
    Currently we are working on a scenarios, where we need to integrate XI and webmethods using JMS.
    It was working fine. But recently they have restarted the webmethods server. After that we re getting an error message like,
    In Adapter Monitoring:
    Channel error occurred; detailed error description: com.sap.aii.adapter.jms.api.connector.ConnectorException: Error creating initial context with environment: {java.naming.provider.url=server:port, java.naming.factory.initial=com.sap.engine.services.jndi.InitialContextFactoryImpl, java.naming.security.principal=XYZ, java.naming.security.credentials=ABC}for profile: ConnectionProfile of channel: CC_RCV_JMS_INon node: 3010950 having object id: ABCXYZ: NamingException: Error getting the server-side naming service functionality during getInitialContext operation.
    at com.sap.aii.adapter.jms.core.connector.JndiConnectorImpl.createInitialContext(JndiConnectorImpl.java:66)
    In RWB
    MP: Exception caught with cause com.sap.aii.af.ra.ms.api.RecoverableException: No transition found from state: STARTING, on event: process_commence for DFA: C_RCV_JMS_IN:e4413a5265a436459e271d5e0dd4859b
    Can one please tell me what the problem is?
    Thanks in advance.
    Regards,
    Prasad Babu.

    Hi,
    Check this link looks like same problem
    Re: file to JMS(for MQ series)
    Thanks
    Vikranth

  • Getting initial context using a cluster address

    I am having trouble getting initial context using a cluster address. My cluster
    has two WL 8.1 servers at localhost:8001 and localhost:9001. I set the hashtable
    to get the initial context as follows:
    env.put(InitialContext.PROVIDER_URL, "t3://localhost:8001,t3://localhost:9001");
    This gives me the following exception:
    Could not create JNDI InitialContext: javax.naming.ConfigurationException
    [Root exception is java.net.MalformedURLException: port expected: t3://cammnbhati:8001,t3://cammnbhati:9001]
    Any idea whey this is not working? If I set only one of the addresses then there
    is no error. For example, the following works just fine:
    env.put(InitialContext.PROVIDER_URL, "t3://localhost:8001");
    Thanks.

    try t3://localhost:8001,localhost:9001 as url
    hth
    sree
    "Naresh Bhatia" <[email protected]> wrote in message
    news:4009cfdf$[email protected]..
    >
    I am having trouble getting initial context using a cluster address. Mycluster
    has two WL 8.1 servers at localhost:8001 and localhost:9001. I set thehashtable
    to get the initial context as follows:
    env.put(InitialContext.PROVIDER_URL,"t3://localhost:8001,t3://localhost:9001");
    >
    This gives me the following exception:
    Could not create JNDI InitialContext:javax.naming.ConfigurationException
    [Root exception is java.net.MalformedURLException: port expected:
    t3://cammnbhati:8001,t3://cammnbhati:9001
    Any idea whey this is not working? If I set only one of the addresses thenthere
    is no error. For example, the following works just fine:
    env.put(InitialContext.PROVIDER_URL, "t3://localhost:8001");
    Thanks.

  • How to get Initial context of Local Interface in weblogic 8.1

    I have developed a local entity bean but i wouldnt able to initial context of that bean
    CAN ANYBODY HELP ME
    bean deployment descriptor
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
    <!--
    ** This file was automatically generated by EJBGen 2.16
    ** Build: 20031001-1049
    -->
    <ejb-jar>
    <enterprise-beans>
    <entity>
    <ejb-name>CabinBean</ejb-name>
    <home>my.CabinRemoteHome</home>
    <remote>my.CabinRemote</remote>
    <ejb-class>my.CabinBean</ejb-class>
    <persistence-type>Container</persistence-type>
    <prim-key-class>java.lang.Integer</prim-key-class>
    <reentrant>True</reentrant>
    <cmp-version>2.x</cmp-version>
    <abstract-schema-name>CabinBean</abstract-schema-name>
    <cmp-field>
    <field-name>bedCount</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>deckLevel</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>id</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>name</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>shipId</field-name>
    </cmp-field>
    <primkey-field>id</primkey-field>
    <security-identity>
    <use-caller-identity/>
    </security-identity>
    </entity>
    <entity>
    <ejb-name>CabinLocal</ejb-name>
    <local-home>my.CabinLocalHome</local-home>
    <local>my.CabinLocalLocal</local>
    <ejb-class>my.CabinLocal</ejb-class>
    <persistence-type>Container</persistence-type>
    <prim-key-class>java.lang.Integer</prim-key-class>
    <reentrant>True</reentrant>
    <cmp-version>2.x</cmp-version>
    <abstract-schema-name>CabinLocal</abstract-schema-name>
    <cmp-field>
    <field-name>bedCount</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>deckLevel</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>id</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>name</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>shipId</field-name>
    </cmp-field>
    <primkey-field>id</primkey-field>
    <ejb-local-ref>
    <ejb-ref-name>LocalCabin</ejb-ref-name>
    <ejb-ref-type>Entity</ejb-ref-type>
    <local-home>CabinLocalHome</local-home>
    <local>CabinLocal</local>
    <ejb-link>LocalCabin</ejb-link>
    </ejb-local-ref>
    <security-identity>
    <use-caller-identity/>
    </security-identity>
    </entity>
    </enterprise-beans>
    <assembly-descriptor>
    <container-transaction>
    <method>
    <ejb-name>CabinLocal</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    <container-transaction>
    <method>
    <ejb-name>CabinBean</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    <ejb-client-jar>EjbClient</ejb-client-jar>
    </ejb-jar>
    ************************************** Client Code****************
    package com;
    import my.CabinBean;
    import my.CabinRemoteHome;
    import my.CabinRemote;
    import javax.naming.InitialContext;
    import javax.naming.Context;
    import javax.naming.NamingException;
    import java.rmi.RemoteException;
    import java.util.Properties;
    import javax.rmi.PortableRemoteObject;
    import weblogic.jndi.Environment;
    public class Test
        public static void main(String args[])
            try{
                 Context context = getInitialContext();
                          Object cab = context.lookup("CabinLocalHome");
                ///**********-- Exception is thrown at this point -******************
                System.out.println("============ done====");
                Context ct = getInitialContext();
                Object ref = ct.lookup("CabinHomeRemote");
                CabinRemoteHome home = (CabinRemoteHome)PortableRemoteObject.narrow(ref,CabinRemoteHome.class);
                //CabinRemote cab = home.create(new Integer(1));
                //cab.setName("Master Suite");
                //cab.setDeckLevel(new Integer(1));
                //cab.setShipId(new Integer(1));
                //cab.setBedCount(new Integer(1));
                Integer pk = new Integer(1);
                CabinRemote cab1 = home.findByPrimaryKey(pk);
                System.out.println("--->>>>>>>> "+cab1.getName());
                System.out.println("--->>>>>>>>  "+cab1.getShipId());
                System.out.println("--->>>>>>>>"+cab1.getBedCount());
                System.out.println("--->>>>>>>>"+cab1.getDeckLevel());
                System.out.println("---");  
          }catch(java.rmi.RemoteException e){e.printStackTrace();}
           catch(javax.naming.NamingException e){e.printStackTrace();}
           //catch(javax.ejb.CreateException e){e.printStackTrace();}
           catch(javax.ejb.FinderException e){e.printStackTrace();}
        public static Context getInitialContext() throws javax.naming.NamingException
           Properties p = new Properties();
           p.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
           p.put(Context.PROVIDER_URL,"t3://localhost:7001");
           return new javax.naming.InitialContext(p);
    } ************************************** Error ***********************
    javax.naming.LinkException: [Root exception is javax.naming.LinkException:  [Root exception is javax.naming.NameNotFoundException: remaining name: /app/ejb/myejb.jar#CabinLocal/local-home]; Link Remaining Name: 'null']; Link Remaining Name: 'java:app/ejb/myejb.jar#CabinLocal/local-home'
         at weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:108)
         at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:284)
         at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:244)
         at weblogic.jndi.internal.ServerNamingNode_813_WLStub.lookup(Unknown Source)
         at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:369)
         at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:357)
         at javax.naming.InitialContext.lookup(InitialContext.java:347)
         at com.Test.main(Test.java:27)
    Caused by: javax.naming.LinkException: [Root exception is javax.naming.NameNotFoundException: remaining name: /app/ejb/myejb.jar#CabinLocal/local-home]; Link Remaining Name: 'null'
         at weblogic.jndi.internal.WLNamingManager.getObjectInstance(WLNamingManager.java:98)
         at weblogic.jndi.internal.ServerNamingNode.resolveObject(ServerNamingNode.java:292)
         at weblogic.jndi.internal.BasicNamingNode.resolveObject(BasicNamingNode.java:771)
         at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:191)
         at weblogic.jndi.internal.RootNamingNode_WLSkel.invoke(Unknown Source)
         at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477)
         at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:108)
         at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:144)
         at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:415)
         at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:30)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
    Caused by: javax.naming.NameNotFoundException: remaining name: /app/ejb/myejb.jar#CabinLocal/local-home
         at weblogic.j2eeclient.SimpleContext.resolve(SimpleContext.java:35)
         at weblogic.j2eeclient.SimpleContext.resolve(SimpleContext.java:39)
         at weblogic.j2eeclient.SimpleContext.lookup(SimpleContext.java:57)
         at weblogic.j2eeclient.SimpleContext.lookup(SimpleContext.java:62)
         at weblogic.jndi.factories.java.ReadOnlyContextWrapper.lookup(ReadOnlyContextWrapper.java:45)
         at weblogic.jndi.internal.AbstractURLContext.lookup(AbstractURLContext.java:130)
         at javax.naming.InitialContext.lookup(InitialContext.java:347)
         at weblogic.jndi.internal.WLNamingManager.getObjectInstance(WLNamingManager.java:96)

    Hi,
    from what I gather, u have two jars
    1. EJBClient - this will have remote and home interfaces and will be used by the client
    2. myEJB - this iwll have all the classes - remote & home interfaces, the bean class and all the other classes required by the bean.
    Now, the question is, who is acting as the client of your EJB ? There are 3 possibilities
    1. A servlet
    2. Another EJB
    3. a simple java program.
    In the first 2 cases, you can go for Local Interfaces (more so in the second case than the first). The reason being that the the client and server will be in the same JVM. Thus, in the first case, if the Web container and the ejb container are in the same app server, EJBs can be local.
    However, in the third case, it is unlikey that you will have the client runnng and the same jvm as the server, because the server is using the jvm provided by weblogic.
    Thus, you cannot use local interfaces in this 3rd case. I have a feeling that this is what you are doing. If so, change the local interfaces to remote.
    See if this helps. Else, I will mail you some sample code. But I am afraid, sample code wont be of much help bcoz this seems to be a design problem.
    regards

  • Caching initial contexts

    I have read the posts about caching initial context lookups and have
    implemented the solution and seen some benefits.
    I am dealing with a third party application that I cannot change.
    When I put my InitialContextFactory in the architecture I also logged
    how many getInitialContext() calls were being made - I was absolutely
    shocked - often 4+ per user transaction. I suspect that the code gets
    one, does a call and dereferences all over the place.
    90% of InitialContexts had the same environment passed to the getIC()
    call so it struck me that what I should do is create a pool of IC, and
    in my factory just serve one from the pool.
    So, the question is, what is the best way of detecting when the IC has
    been dereferenced so I know I can serve it again from my pool?
    I presume this is a generic pool problem when you can't guarantee that
    your client's will be good citizens and call a close() method or
    similar.
    I've posted here as it is performance related; also, is there any
    reason why what I am doing is not a good idea?
    Can the client do something with the IC which means it is not suitable
    for use by another client? If so, can I detect this so I may discard?
    As always, many thanks in advance.
    Presuming I can get it to work I will post the code so that we can all
    share ;-)
    Cheers
    Ed

    Why don't you instrument your factory then to give out your own
    implementation of InitialContext that will in fact only wrap a "loaner"
    InitialContext every time a method is invoked on it and before returning
    the value to the caller will put the real InitialContext back to the
    pool to be reused by another one.
    Then your clients can do whatever they want with those ICs and still
    would not cause so big performance hits.
    It's just an idea that just came to mind and I haven't tested it so it
    might have flaws but it looks viable.
    --dejan
    Ed Barrett wrote:
    The application is a third-party product that cannot be changed.
    By introducing the factory you gave below (thanks!) we put the application
    back under the load test and saw minimal improvements (like 1% response
    time).
    I then instrumented the factory with a system.out on finalize and noticed
    that a factory instance is created for each call to getInitialContext() - is
    this the way that WLS/J2EE works? I would have hoped that factories were
    shared or something. What we did see is that for one user request a number
    (sometimes 5!) ICs were being created ;-( Obviously the lookup cache is a
    class instance and shared across the lot.
    So then I started to think about pre-creating ICs and haveing a pool for the
    default ones (environment specifies URL and no security details or the
    like). Trouble is how to implement such when you cannot change the client
    code to call a factory return method (such as returnToPool()).
    Any ideas would be appreciated
    "Dimitri I. Rakitine" <[email protected]> wrote in message
    news:[email protected]...
    I've ran into this problem while porting 5.1 application (JNDI lookups
    were
    super-cheap) to 6.1 (where they are not so cheap due to
    serialization/deserialization)
    and did this test to see if this indeed was the problem. As you saw I
    didn't bother to
    cache InitialContext's - I just cached JNDI lookups and that resulted in
    very significant
    performance improvements.
    Which application are you testing it with?
    Graham <[email protected]> wrote:
    Dimitri,
    We did this but did not see that much improvement over the default way -
    we
    are using 6.1 sp2.
    We put some messages in our factory and found that the client code often
    created over 4 ICs for one user click - aaggghhhh!! As I say we cannot
    change their code but if we could take the time to create an IC away
    from
    the online response we feel we would save some time.
    We also observed a new instance of the IC factory being created every
    time a
    new IC was created - is this what you would expect?
    I think this is what NamingManager.getInitialContext() is supposed to do.
    Cheers
    Ed
    "Dimitri I. Rakitine" <[email protected]> wrote in message
    news:[email protected]...
    Caching InitialContext's will probably not quite solve the problem,
    because lookup()'s are expensive (in 6.x), so, caching lookup results
    will result in performance improvements.
    If you cannot change the 3'rd party code and all it does is:
    ... DataSource ds = (DataSource)new InitialContext().lookup(".....");
    or similar, you can add caching by implementing your own InitialContext
    factory,
    for example: (extremely simplistic)
    Startup class :
    System.setProperty("java.naming.factory.initial",
    "myjndi.InitialContextFactory");
    where
    myjndi.InitialContextFactory is :
    public class InitialContextFactory implements
    javax.naming.spi.InitialContextFactory {
    public Context getInitialContext(Hashtable env) throws
    NamingException
    Context ctx = new
    weblogic.jndi.WLInitialContextFactory().getInitialContext(env);
    return
    (Context)Proxy.newProxyInstance(ctx.getClass().getClassLoader(),
    new Class[]
    { Context.class },
    new
    ContextHandler(ctx));
    and myjndi.ContextHandler is:
    public class ContextHandler implements InvocationHandler {
    Context ctx;
    static Hashtable cache = new Hashtable();
    public ContextHandler(Context ctx) {
    this.ctx = ctx;
    public Object invoke(Object proxy, Method method, Object[] args)
    throws Throwable {
    try {
    Object retVal;
    if("lookup".equals(method.getName()) && args[0] instanceof
    String) {
    retVal = cache.get(args[0]);
    if(retVal == null) {
    retVal = method.invoke(ctx, args);
    cache.put(args[0], retVal);
    } else {
    retVal = method.invoke(ctx, args);
    return retVal;
    } catch(InvocationTargetException oops) {
    throw oops.getTargetException();
    Ed <[email protected]> wrote:
    Adarsh,
    We agree it is a brilliant idea - now just to work out how to do it.
    As you cannot always guarantee to be able to change the client code
    you cannot use normal pooling techniques:
    getObjectFromPool()
    // do work
    returnObjectToPool()
    So, the client code needs an InitialContext. We can put in our own
    Factory and intercept the getInitialContext() calls. This method
    must
    return class javax.naming.Context - therefore the only way I can see
    to spot when the class is dereferenced is to extend the class and add
    a finalize() method that notifies the factory.
    The trouble I believe is that the class cannot be "rescued" in the
    finalize() method (i.e. "I'm dying - take me back" ;-). If it simply
    told the factory to add another one to its pool this would mean that
    the new IC create "hit" would be in garbage collection (i.e. the
    users
    will pay somewhere along the line) - is this correct?
    Anyone any ideas on a solution? I have discovered out code create
    HUNDREDS of contexts in an hour and discards them very quickly. Be
    nice to be able to cache them!
    Cheers
    Ed
    "Adarsh Dattani" <[email protected]> wrote in message
    news:<[email protected]>...
    Ed,
    This a brilliant idea. We are planning something similar too. We
    first
    want to create a pool of LDAP connections as apps make extensive
    calls
    to
    LDAP. Did you check-out the object pooling api at Jakarta Commons.
    It
    deserves a close look.
    http://jakarta.apache.org/commons/pool/index.html
    Thanks,
    Adarsh
    "Ed" <[email protected]> wrote in message
    news:[email protected]...
    I have read the posts about caching initial context lookups and
    have
    implemented the solution and seen some benefits.
    I am dealing with a third party application that I cannot change.
    When I put my InitialContextFactory in the architecture I also
    logged
    how many getInitialContext() calls were being made - I was
    absolutely
    shocked - often 4+ per user transaction. I suspect that the code
    gets
    one, does a call and dereferences all over the place.
    90% of InitialContexts had the same environment passed to the
    getIC()
    call so it struck me that what I should do is create a pool of IC,
    and
    in my factory just serve one from the pool.
    So, the question is, what is the best way of detecting when the IC
    has
    been dereferenced so I know I can serve it again from my pool?
    I presume this is a generic pool problem when you can't guarantee
    that
    your client's will be good citizens and call a close() method or
    similar.
    I've posted here as it is performance related; also, is there any
    reason why what I am doing is not a good idea?
    Can the client do something with the IC which means it is not
    suitable
    for use by another client? If so, can I detect this so I may
    discard?
    As always, many thanks in advance.
    Presuming I can get it to work I will post the code so that we can
    all
    share ;-)
    Cheers
    Ed
    Dimitri
    Dimitri

  • Set default Initial View to Bookmarks Panel and Page on all new docs

    Hello Acrobat Experts,
    We convert *many* Word docs to PDF.  We have PDFMaker force security on all docs.  Now every document has the security settings we want.
    That works.
    We want to force the default Initial View to be Bookmarks Panel and Page so that *every* new document shows the Bookmark Panel and the Page.
    We don't want to set this per document (which is a multi-setp process and a hassle, especially now that security is enabled) but globally for all new documents created by Adobe Acrobat.
    Any and all advice is most welcome.
    Thank you in advance.
    Tech details:
    Acrobat Professional 8.1.7
    Windows Xp Professional (all current updates)

    The article I pointed to in my Oct 20, 2009 post #3 contains two pointers that might assist to initially open the PDF fitting the page to the window.
    I think you may be after "Vire [/Fit]" as described in the article;
    [ /PageMode /UseOutlines
    /Page 1 /View [/Fit ]
    /DOCVIEW pdfmark
    These lines of code open your PDF document with the bookmarks panel open. If you just want the document on its own try "UseNone" instead of "UseOutlines". Here are some additional values:
    /Page 1 opens the PDF on page 1
    View [/Fit ] opens the PDF Fit to page
    And the article points to the PDFMark reference where you might look at Actions and Destinations on page 47.
    I've not tried to do this myself so would you be kind enough to post your result and let us know the version of Acrobat you're using?

  • Web Form Validation Message Language Setting at Runtime when work in multi lingual environment

    Business Catalyst use the default culture language to display web form validation message.
    When we are in multi lingual environment and not using subdoamin to handle multilingual sites, we found that the validation message did appear in the default culture setting. To make this work, we need to add the below script in our template.
    <script type="text/javascript">
    $(document).ready(function(){               
    var head= document.getElementsByTagName('head')[0];
    var script= document.createElement('script');
    script.src= '/BcJsLang/ValidationFunctions.aspx?lang=FR';
    script.charset = 'utf-8';
    script.type= 'text/javascript';
    head.appendChild(script);
    </script>
    Assuming the template is in french. You can change the lang parameter in the script according to your language.

    After user 1 submits the page, it might not even be committed, so there is no way to have the pending data from user1 seen by user2.
    However, we do have a new feature in ADF 11g TP4 that I plan to blog more about called Auto-Refresh view objects. This feature allows a view object instance in a shared application module to refresh its data when it receives the Oracle 11g database change notification that a row that would affect the results of the query has been changed.
    The minimum requirements in 11g TP4 to experiment with this feature which I just tested are the following:
    1. Must use Database 11g
    2. Database must have its COMPATIBLE parameter set to '11.0.0.0.0' at least
    3. Set the "AutoRefresh" property of the VO to true (on the Tuning panel)
    4. Add an instance of that VO to an application module (e.g. LOVModule)
    5. Configure that LOVModule as an application-level shared AM in the project properties
    6. Define an LOV based on a view accessor that references the shared AM's VO instance
    7. DBA must have performed a 'GRANT CHANGE NOTIFICATION TO YOURUSER'
    8. Build an ADF Form for the VO that defined the LOV above and run the web page
    9. In SQLPlus, go modify a row of the table on which the shared AM VO is based and commit
    When the Database delivers the change notification, the shared AM VO instance will requery itself.
    However that notification does not arrive all the way out to the web page, so you won't see the change until the next time you repaint the list.
    Perhaps there is some way to take it even farther with the active data feature PaKo mentions, but I'm not familiar enough with that myself to say whether it would work for you hear.

  • Initial Context Problem

    I have developed local entity bean in weblogic 8.1
    but i wouldnt able to get the Initial Context of the Bean.
    It throws javax.naming.NoInitialContextException
    But in jndi tree it shows the bean..
    the problem is only for Local Bean
    Remote Beans are working fine

    G,
    One thing I would make sure of is that you are not deploying oc4j.jar file as part of you ear. Check the 'exploded' ear file under WEB-INF/lib to ensure that you do not have an oc4j.jar file under it.
    It usually happens that in your Jdev Project, if you had included the oc4j.jar library solely to compile, but when you generated the deployment profile it would by default include all the libraries that are part of the project. You can correct this by right clicking the deployment profile and editing its properties to exclude the libraries that you don't want to deploy.

  • How to configure initial-context-factory and provider_url on Websphere MQ

    I have a few questions about WebSphere MQ. Currently, my application is able work well with other JMS provider. But I would like to move to use WebSphere instead.
    Can anyone suggest me how to configure the application connecting WebSphere?
    �     I�m using the Initial java naming factory as bellows: com.sun.jndi.fscontext.RefFSContextFactoryIs it the correct class?
    �     About the java-naming-factory-url, How do I know what object that I should use? I found this example in JMSAdmin.config � iiop://localhost:7555� What�s iiop ?
    �     What jar file that I should add in my classpath?

    Hi,
    You have a few options...
    1. Use WebSphere Application Server as the JNDI provider
    2. Don't use JNDI
    3. Use the File System Context as the JNDI provider
    Exploring these options in a bit more detail...
    1. Use WebSphere Application Server as the JNDI provider
    Assuming you have WAS, the best way of obtaining your queue is to define the Queue and Queue Connection Factory objects in WAS using the admin console, then obtain them from the Initial Context as per the following article
    http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/rnam_example_prop2.html
    If you prefer not to do JNDI lookups in your code a great alternative is to use Spring (www.springframework.org). If you haven't come across spring before it's well worth a look. One of it's many features is a bean factory for creating your objects. There is lots of support for retrieving JMS objects from JNDI, so in the main all you have to do is write some XML similar to the following...
    <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
           <property name="environment">
                  <props>
                         <prop key="java.naming.factory.initial">${jndi.initialContextFactory}</prop>
                         <prop key="java.naming.provider.url">${jndi.providerUrl}</prop>
                  </props>
           </property>
    </bean>
    <bean id="queueConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
           <property name="jndiTemplate" ref="jndiTemplate"/>
           <property name="jndiName" value="${jndi.queueConnectionFactory}"/>
    </bean>
    <bean id="queueName" class="org.springframework.jndi.JndiObjectFactoryBean">
           <property name="jndiTemplate" ref="jndiTemplate"/>
           <property name="jndiName" value="${jndi.queueName}"/>
    </bean>There's a bit more to it than this, but not much. I've been meaning to write a tutorial on this for a while so if you're interested let me know.
    2. Don't use JNDI
    This approach involves using the creating the native MQ Queue Connection Factory and Queue classes. You can hard code this, but it's much better to abstract it from your application. Again you can use Spring. The definition would look something like the following...
    <bean id="MQJMS_TP_CLIENT_MQ_TCPIP"
    class="org.springframework.beans.factory.config.FieldRetrievingFactoryBean">
           <property name="staticField">
                  <value>com.ibm.mq.jms.JMSC.MQJMS_TP_CLIENT_MQ_TCPIP</value>
           </property>
    </bean>
    <bean id="queueConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
           <property name="transportType" ref="MQJMS_TP_CLIENT_MQ_TCPIP" />
           <property name="queueManager" value="${mq.queueManager}" />
           <property name="hostName" value="${mq.host}" />
           <property name="port" value="${mq.port}" />
           <property name="channel" value="${mq.channel}" />
    </bean>
    <bean id="publishInvoiceQ" class="com.ibm.mq.jms.MQQueue">
           <constructor-arg value="${mq.queueName}" />
    </bean>
    3. Use the File System Context
    The file system context is just like a JNDI context, but instead of using a url like iiop://host:port you have to specify a file system url. Because FSContext is just another JNDI context you can still use the spring configuration from option 1, but just change the relevant parameters.
    In order to define you queues and queue connection factory using the File System Context, you need to download a swing application called JMS Admin. Get it here
    http://www-1.ibm.com/support/docview.wss?rs=171&uid=swg24004691&loc=en_US&cs=utf-8&lang=en
    With regards your specific questions...
    IIOP is just another communication protocol. If you want more details I'm sure typing "what is iiop" into google will provide plenty of hits.
    I'll do my best to answer the remain two tomorrow - I wrote an application a few months ago which used the File System Context, but don't have the details to hand.

  • ClassNotFoundException for initial-context-factory using foreign JMS p.

    Hi,
    I am currently working on migrating an application from weblogic 9 to weblogic 10 and I bumped into this issue while MDB connecting to JMS.
    [Loaded cz.jaksky.riskscenario.beans.RiskScenarioServiceLocalHome from file:/C:/SVN/app-WLS10-FRESH/app-deploy/servers/myserver/tmp/_WL_user/performance/nyubkw/point-interfaces.jar]
    <17-Sep-2012 11:01:27 o'clock CEST> <Warning> <EJB> <BEA-010061> <The Message-Driven EJB: PerformanceAsyncRequestBean is unable to connect to the JMS destination: wls.AsyncQueue. The Error was:
    javax.naming.NoInitialContextException: Cannot instantiate class: cz.jaksky.common.jms.JMSInitialContextFactory [Root exception is java.lang.ClassNotFoundException: cz.jaksky.common.jms.JMSInitialContextFactory]
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
    at javax.naming.InitialContext.init(InitialContext.java:223)
    at javax.naming.InitialContext.<init>(InitialContext.java:197)
    at weblogic.deployment.jms.ForeignOpaqueReference.getReferent(ForeignOpaqueReference.java:182)
    at weblogic.jndi.internal.WLNamingManager.getObjectInstance(WLNamingManager.java:96)
    at weblogic.jndi.internal.ServerNamingNode.resolveObject(ServerNamingNode.java:377)
    at weblogic.jndi.internal.BasicNamingNode.resolveObject(BasicNamingNode.java:856)
    at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:209)
    at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:214)
    at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)
    at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:411)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    at weblogic.jms.common.CDS$2.run(CDS.java:486)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
    at weblogic.jms.common.CrossDomainSecurityManager.runAs(CrossDomainSecurityManager.java:131)
    at weblogic.jms.common.CDS.lookupDestination(CDS.java:480)
    at weblogic.jms.common.CDS.lookupDDAndCalloutListener(CDS.java:345)
    at weblogic.jms.common.CDS.access$100(CDS.java:41)
    at weblogic.jms.common.CDS$DDListenerRegistrationTimerListener.timerExpired(CDS.java:193)
    at weblogic.timers.internal.TimerImpl.run(TimerImpl.java:273)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:176)
    Caused by: java.lang.ClassNotFoundException: cz.jaksky.common.jms.JMSInitialContextFactory
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:46)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)
    ... 23 more
    I am using foreign JMS provider with provided mapping. Config follows:
    ejb-jar.xml:
    <enterprise-beans>
              <message-driven>
                   <ejb-name>PortfolioRetrieverAsyncRequestBean</ejb-name>
                   <ejb-class>cz.jaksky.common.async.AsynchronousRequestMessageBean</ejb-class>
                   <transaction-type>Bean</transaction-type>
                   <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
                   <message-driven-destination>
                        <destination-type>javax.jms.Queue</destination-type>
                        <subscription-durability>Durable</subscription-durability>
                   </message-driven-destination>
                   <message-selector>
                        <![CDATA[ Service IN ('PortfolioRetriever')
                      AND MessageType = 'request'
                      AND BigBox = FALSE
                    ]]>
                   </message-selector>
              </message-driven>
         </enterprise-beans>
    weblogic-ejb-jar.xml:
    <weblogic-enterprise-bean>
              <ejb-name>PortfolioRetrieverAsyncRequestBean</ejb-name>
              <message-driven-descriptor>
                   <pool>
                        <max-beans-in-free-pool>64</max-beans-in-free-pool>
                        <initial-beans-in-free-pool>1</initial-beans-in-free-pool>
                   </pool>
                   <destination-jndi-name>wls.AsyncQueue</destination-jndi-name>
                   <initial-context-factory>weblogic.jndi.WLInitialContextFactory</initial-context-factory>
                   <connection-factory-jndi-name>ServiceLocatorAsyncQueueFactory</connection-factory-jndi-name>
              </message-driven-descriptor>
              <dispatch-policy>PortfolioAsyncQueueWorkManager</dispatch-policy>
         </weblogic-enterprise-bean>
    jmsconfig-jms.xml
    <foreign-server name="TibjmsAsyncServer">
    <default-targeting-enabled>true</default-targeting-enabled>
    <foreign-destination name="AsyncQueue.LOCAL.prgdwm355410.7001">
    <local-jndi-name>wls.AsyncQueue</local-jndi-name>
    <remote-jndi-name>AsyncQueue.LOCAL.prgdwm355410.7001</remote-jndi-name>
    </foreign-destination>
    <foreign-connection-factory name="FTQueueConnectionFactory">
    <local-jndi-name>ServiceLocatorAsyncQueueFactory</local-jndi-name>
    <remote-jndi-name>FTQueueConnectionFactory</remote-jndi-name>
    </foreign-connection-factory>
    <initial-context-factory>cz.jaksky.common.jms.JMSInitialContextFactory</initial-context-factory>
    <connection-url>tcp://JUSD-FTPOIA.jaksky.com:22542,tcp://JUSD-FTPOB.jaksky.com:22543</connection-url>
    </foreign-server>
    Module containing this MDB is packed as an ear file with following structure:
    APP-INF/lib/modules.jar - contains AsynchronousRequestMessageBean class
    APP-INF/lib/interface.jar - contains JMSInitialContextFactory (class used for initial-context-factory)
    portfolio-async.jar
    META-INF/ejb-jar.xml content pasted above
    META-INF/webogic-ejb-jar.xml content pasted above
    Weblogic system classpath doesn't contain any application sepcific libraries.
    This set up was working for weblogic 9 without any problem. I am just wondering what the problem is whether I am faceing class loading issue or JMS configuration issue and how to resolve it.
    Edited by: user13047709 on 18-Sep-2012 07:15
    Edited by: user13047709 on 18-Sep-2012 07:16

    Hi,
    When working with a non-WebLogic JNDI provider (or a non-WebLogic JMS provider), the non-WebLogic client classes must be made available to the classloader of the calling application in WebLogic Server. This is usually accomplished by adding them to the system classpath.
    In your case, WebLogic is looking for a proprietary/foreign JNDI Context Factory class named "cz.jaksky.common.jms.JMSInitialContextFactory", which means you need to make sure that a jar/dir that contains the non-WebLogic class "JMSInitialContextFactory.class" is in the classpath.
    The configuration for this should be similar in WL9 and WL10. It could be that your classpath is already setup to reference the foreign class, but it refers to a directory/jar that you haven't setup yet on your WL10 host.
    HTH,
    Tom

  • Error getting initial context

    Hi,
    I've gotten the following exceptions reported to us by our production clients when trying to connect to our Weblogic 4.5.1 server (sp8).
    CPClient with url: t3s://www.cpmarket.com:7002 Getting guest initial
    context
    [Root exception is java.io.IOException: Bootstrap unable to get a t3s
    connection to
    www.cpmarket.com/159.43.253.15]javax.naming.CommunicationException at
    weblogic.jndi.toolkit.ExceptionTranslator.toNamingException(ExceptionTransla
    tor.java:32) at
    weblogic.jndi.WLInitialContextFactory.toNamingException(WLInitialContextFact
    ory.java:513) at
    weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFact
    ory.java, Compiled Code) at
    weblogic.jndi.Environment.getContext(Environment.java:128) at
    weblogic.jndi.Environment.getInitialContext(Environment.java:111) at
    com.xxxxxxx.CPClient.getGuestInitialContext(CPClient.jav
    a:184) at
    com.xxxxxxx.CPClient.<init>(CPClient.java:47)
    Does anyone know where this could be coming from?
    Thanks,
    Gary Mui
    [email protected]
    [att1.html]

    Hi Tim,
    If you are running within a browser, you will not have access to anything
    outside the sandbox which includes making RMI calls. Try signing the applet.
    You can find more information on signing applets on the sun java website.
    Regards
    Arjuna
    "Tim" <[email protected]> wrote in message
    news:3c5ab818$[email protected]..
    >
    I get the following eror when I try to get the Initial Context in anapplet:
    >
    java.lang.ExceptionInInitializerError: java.security.Acc
    ess denied (java.util.PropertyPermission * read,write)
    atjava.security.AccessControlContext.checkPermission(AccessControlConte
    xt.java:272)
    atjava.security.AccessController.checkPermission(AccessController.java:
    399)
    Does anyone have any idea what would cause this? The code works finerunning
    from an application. From what I understand there might be a problem withmy
    policy file. However, it seems to look ok. Any ideas?

  • Initial Context Properties

    Hi,
    I'm using RAD 6 and the embedded messaging server. I'm trying to configure the initial context. Can anyone tell me wht it needs to be configured as.
    try {
                env.put(Context.INITIAL_CONTEXT_FACTORY,"*******");
                env.put(Context.PROVIDER_URL, "****");*/
                ctx = new InitialContext();
                System.out.println("Set CONN FACTORY");
                queueConnectionFactory = (QueueConnectionFactory)PortableRemoteObject.narrow(ctx.lookup(connectionFactoryName),QueueConnectionFactory.class);
                System.out.println("SET CONNECTION");
                queueConnection = queueConnectionFactory.createQueueConnection();
                System.out.println("SET SESSION");
                queueSession = (QueueSession) queueConnection.createSession(false, QueueSession.AUTO_ACKNOWLEDGE);
                System.out.println("SET QUEUE");
                queue = (Queue)PortableRemoteObject.narrow(ctx.lookup(queueName), Queue.class);
                 queueSender = queueSession.createSender(queue);I'm getting the following error,
    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
    And i aslo need it to work with MQ Series version 6.0, let me know the env properties for that also.
    regards,
    karthik

    env.put(Context.INITIAL_CONTEXT_FACTORY,"*******");
    env.put(Context.PROVIDER_URL, "****");*/
    ctx = new InitialContext();
    Modify the last line as:
    ctx = new InitialContext(env);That's what the error message is telling you. :-)

Maybe you are looking for