GetNameInNamespace

I am attempting to run an application and I am getting an error
java.lang.NoSuchMethodException: getNameInNamespace.
My code does not mention this method and the jar that has it is in my classpath. So I was wondering. where does this method live and how can I call it.

this method is from your context you importet in all likely to your classfile with
e.g.
import javax.naming.*;
import javax.naming.directory.*;

Similar Messages

  • After 2nd time running a method my app window freezes 7 seocnds,error msg-

    Hello folks,
    first you will surely say is that my server is offline or something with the network is wrong but it is not ;-)
    thats the code:
    Please read my words after the pasted code at the bottom of the page!
    import java.awt.Color;
    import java.awt.Insets;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.*;
    import javax.naming.directory.*;
    import javax.naming.ldap.LdapName;
    import javax.naming.ldap.Rdn;
    import java.util.Hashtable;
    import javax.naming.Context;
    import javax.naming.*;
    import java.io.UnsupportedEncodingException;
    import java.util.*;
    import javax.swing.BorderFactory;
    public class MainWindow extends JFrame implements ActionListener
           static final long serialVersionUID = 1L; 
           private JLabel newPasswordLB      = new JLabel("Neues Passwort");
         private JLabel newPasswordRepeatLB = new JLabel("Neues Passwort wiederholen");
         private JLabel errorLB = new JLabel("Fehlerstatus:");
         private JLabel benutzerNameLB = new JLabel("Benutzername ausw�hlen:");
         private JPasswordField neuesKennwortPF = new JPasswordField();
         private JPasswordField neuesKennwortWdhPF = new JPasswordField(10);
         //private JLabel fehlerNachrichtLB = new JLabel();
         private JTextField fehlerNachrichtLB = new JTextField();
         private JButton pwBT = new JButton("Setze neues Passwort");     
         private DefaultListModel listModel = new DefaultListModel();
         private JList liste = new JList(listModel);
         private JScrollPane benutzerListeSP = new JScrollPane(liste);
         private JCheckBox kennwortVergebenCB = new JCheckBox("Benutzer vergibt Kennwort bei Neuanmeldung selbst");
         JFrame frame;
         String bla;
         String neuesKennwortTemp;
         String benutzername;     
         String klassengruppe;  // OU=Klassen
         String lehrergruppe;   // OU=Lehrer
         String edvlehrername;  // z.B. "verenabit"
         String schulname;      // z.B. OU=ASR
         String BaseDN=",DC=bodensee,DC=de";
         String adminPassword = "test";
         String adminUser = "cn=administrator,cn=users,dc=bodensee,dc=de";     
         public MainWindow()
             super("LDAP Modification Tool");            
             setLayout(null);         
             add(newPasswordLB);
             add(newPasswordRepeatLB);     
             add(neuesKennwortWdhPF);
             add(neuesKennwortPF);              
             add(pwBT);       
             add(errorLB);
             add(fehlerNachrichtLB); 
             add(benutzerListeSP);        
             add(benutzerNameLB);
             add(kennwortVergebenCB);    
             kennwortVergebenCB.setBounds(16,120,350,25);
             benutzerNameLB.setBounds(430,25,160,25);    
             fehlerNachrichtLB.setOpaque(true);
             fehlerNachrichtLB.setBackground(new Color(255,255,255));
             fehlerNachrichtLB.setBorder(BorderFactory.createLineBorder(new Color(155,155,155)));
             neuesKennwortPF.setBounds(230,50,150,25);
             neuesKennwortWdhPF.setBounds(230,80,150,25);
             newPasswordLB.setBounds(20,50,130,25);
             newPasswordRepeatLB.setBounds(20,80,190,25);       
             pwBT.setBounds(230,170,150,40);             
             errorLB.setBounds(20,385,100,25);
             fehlerNachrichtLB.setBounds(110,385,270,25);       
             benutzerListeSP.setBounds(430,50,160,360);
             kennwortVergebenCB.setHorizontalTextPosition(SwingConstants.LEADING);     
             neuesKennwortPF.setMargin(new Insets(1, 3, 1, 1));
             neuesKennwortWdhPF.setMargin(new Insets(1, 3, 1, 1));        
             pwBT.setMargin(new Insets(0,0,0,0));     
             fehlerNachrichtLB.setForeground(new Color(100,120,255));          
             pwBT.addActionListener(this);         
             liste.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
             liste.setVisibleRowCount(1);               
             listModel.addElement("verena bit");
             listModel.addElement("verena bit");
             listModel.addElement("verena bit");      
             this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             this.setSize(620,460);
             this.setLocationRelativeTo(null);
             this.setResizable(false);      
             this.setVisible(true);
          }  /*--------------------------------------- Konstruktor -------------------------------------------*/
          public String schulenameSuchen()
            return "";
          public void edvlehrernameEinlesen()
            edvlehrername = System.getProperty("user.name");      
          public void benutzernameEinlesen()
          int index = liste.getSelectedIndex();
               benutzername = (String) liste.getModel().getElementAt(index);       
               benutzername = "CN=" + benutzername + ",OU=Lehrer,OU=ASR";
          public void neuesKennwortEinlesen()
          neuesKennwortTemp = String.valueOf(neuesKennwortPF.getPassword());          
          public void actionPerformed(ActionEvent e)
           char[] neuesKennwortArray = neuesKennwortPF.getPassword();
           char[] neuesKennwortWdhArray = neuesKennwortWdhPF.getPassword();
           if (e.getSource().equals(pwBT))
                if(liste.isSelectionEmpty())
                     JOptionPane.showMessageDialog(frame,"Sie m�ssen einen Benutzer ausw�hlen!");
                return;
           else if(!Arrays.equals(neuesKennwortArray,neuesKennwortWdhArray))
                JOptionPane.showMessageDialog(frame,"Die eingegebenen Kennw�rter sind nicht gleich!");
                return;
           else if(neuesKennwortArray.length == 0 || neuesKennwortWdhArray.length == 0)
                JOptionPane.showMessageDialog(frame,"Es wurde kein Kennwort eingegeben!");
                return;
                benutzernameEinlesen(); // F�r diesen Benutzer wird das Kennwort ge�ndert
                neuesKennwortEinlesen(); // Dieses Kennwort bekommt der obige Benutzer neu
                edvlehrernameEinlesen(); // Anhand dieses EDV-Lehrers wird die Schule ermittelt wo sich der EDV-Lehrer
                // befindet. Dieser schulname bzw. z.B. OU="ASR" wird als Einstieg genommen, wenn sich der EDV-Lehrer
                // mit dem W2K Server befindet. Somit gibt es nur noch das Unterverzeichnis              
                // Eine Hashtable speichert Schl�ssel/Wert Paare
                Hashtable env = new Hashtable();
                String keystore = "C:/Programme/Java/jre1.6.0_01/lib/security/ZertifikatBerlin";
                System.setProperty("javax.net.ssl.trustStore",keystore);
                // Die Methode put der Klasse Hashtable weist die rechten Werte (Stings hier) einen Schl�ssel zu (verschiedene Kontexte hier)
                env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
                env.put(Context.REFERRAL,"follow");
                env.put(Context.PROVIDER_URL,"ldaps://rhein:636");      
                env.put(Context.SECURITY_PROTOCOL,"SSL");
                env.put(Context.SECURITY_AUTHENTICATION, "simple");
               env.put(Context.SECURITY_PRINCIPAL, adminUser);
               env.put(Context.SECURITY_CREDENTIALS,adminPassword);                  
           try
                DirContext ctx = new InitialDirContext(env);
                String base = "dc=bodensee,dc=de";
                String filter = "(sAMAccountName=" + edvlehrername + ")";
                String[] attribut = {"distinguishedName"};
                SearchControls kontroller = new SearchControls();
                kontroller.setSearchScope(SearchControls.SUBTREE_SCOPE);
                kontroller.setReturningAttributes(attribut);
                kontroller.setReturningObjFlag(true);
               NamingEnumeration enm = ctx.search(base,filter,kontroller);
               String DNkette="";
                while(enm.hasMore())
                    SearchResult resultat = (SearchResult) enm.next();
                    System.out.println(resultat.getNameInNamespace());
                    DNkette = resultat.getNameInNamespace();
                // CN=verena bit,OU=Lehrer,OU=ASR ,DC=bodensee,DC=de
                // index=4      ,index=3  ,index=2,index=1    ,incex=0
                LdapName FullDN = new LdapName(DNkette);
                 for( int i = 0 ; i < FullDN.size() ; i++ )
                     System.out.println(FullDN.getRdn(i));                                            
                 ctx.close();
                // Wert f�r das Kenntwort in der Activev Directory erzeugen
                String neuesKennwort   = "mother"; //neuKennwortPF.getText();
                String neuesKennwortAD = "\"" + neuesKennwort + "\"";
                byte[] newpassword = neuesKennwortAD.getBytes("UTF-16LE");
                // The username to be used for the password change                    
                ModificationItem mods[] = new ModificationItem[1];
                mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE,new BasicAttribute("unicodePwd", newpassword));
                ctx.modifyAttributes(fehlerNachrichtLB.getText(),mods); */
            catch (Exception er)
                fehlerNachrichtLB.setText(er.toString());
            } // if Ende           
          } // actionPerformed Ende    
              public static void main(String args[]) throws NamingException, UnsupportedEncodingException
                 try
                      JFrame.setDefaultLookAndFeelDecorated(true);          
                 catch (Exception e)     
                   e.printStackTrace();
                 MainWindow Fenster = new MainWindow (); 
           } When I run the application the first time enter twice a password and select a user etc.. to fullfill the if clauses and press the button all is working fine: I get this result:
    CN=verena bit,OU=Lehrer,OU=ASR,DC=bodensee,DC=de
    DC=de
    DC=bodensee
    OU=ASR
    OU=Lehrer
    CN=verena bitthe first line with CN=verena bit etc... I get because of this line:
    System.out.println(resultat.getNameInNamespace());the next 5 Relative DN`s i get because of this code:
    // CN=verena bit,OU=Lehrer,OU=ASR ,DC=bodensee,DC=de
    // index=4 ,index=3 ,index=2,index=1 ,incex=0
    LdapName FullDN = new LdapName(DNkette);
           for( int i = 0 ; i < FullDN.size() ; i++ )
                     System.out.println(FullDN.getRdn(i));                                            
                 }thats all fine, BUT when i hit the button in my application[b] the 2nd time and the above code gets executed my whole app freezes for 7 seconds and i get the error:
    javax.naming.ServiceUnavailableException: rhein:636; socket closedand when i click my button the 3rd time the app runs fine again and the fourth time i click my button the app throws me again the error and freezes ??
    Can someone help?
    another mysterious thing is when i dont use this line of code:
    env.put(Context.REFERRAL,"follow");
    I get a PartialResultException, but why ?

    A really odd thing is also that sometimes the user attribute like "cn" which i do retrieve gets not displayed in my JList when i start the application, but when i close the app and start it again it the JList contains the cn values or not its like a random factor. ???
    Someone told me that the garbage collector is not releasing all memory i used in my application so i have to release the resource explicit ??!! is that right? And how do i have to do this? I have never ever read something about that!

  • JNDI LookUp does not work in WSAD5.0

    Hi,
    I have an independent java class which creates Data Source in WASD 5.0, and this works fine to get data source when the server is 4.0, but does not work for server 5.0, here is the code:
    public static void main(String[] args) throws NamingException {
         javax.naming.InitialContext initialContext = null;
         java.util.Hashtable htContextEnvironment = new java.util.Hashtable();
            htContextEnvironment.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
            htContextEnvironment.put(javax.naming.Context.DNS_URL,"dns://127.0.0.1");
         htContextEnvironment.put(javax.naming.Context.PROVIDER_URL,"iiop://127.0.0.1:2809/");
            initialContext = new javax.naming.InitialContext(htContextEnvironment);
            System.out.println("Initial Context = " + initialContext.getNameInNamespace());
            Hashtable ht = initialContext.getEnvironment();
            DataSource ds = (DataSource) initialContext.lookup("jndi/abcd");
            System.out.println("Data Source = \n" + ds);
    }The only change which I need to make is change the port name from 2809 [5.0] to 900[4.0], the jndi name in both server is defined as "jndi/abcd"
    I always get the initial context in both cases, but can not get data source. For 5.0, I get the following exception:
    javax.naming.NameNotFoundException: jndi/abcd
         at com.ibm.ejs.ns.jndi.CNContextImpl.doLookup(CNContextImpl.java:1445)
         at com.ibm.ejs.ns.jndi.CNContextImpl.lookup(CNContextImpl.java:1129)
         at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:128)
         at javax.naming.InitialContext.lookup(InitialContext.java:359)Is there any difference in creating inital context and data source between 4.0 and 5.0 servers.
    Any help on this please.
    Thanks
    Rajender

    This did not work dear. I assume when you say [Add ur datasource], you mean the name of the datasource, and I did as you told. I was wondering though that I have an independent java class which try to get data source from WSAD server, then how does web.xml help, may be I am not understanding the connection here.
    Just to let you know, that same java class gets the datasource from 4.0 test server. I am running both servers now i.e. 4.0 test and 5.0 test server on different ports, and only data source from 4.0 workd good. Do you have any other solution, which I can try.
    Is there any difference the way data source is accessed between 4.0 and 5.0 versions.
    Thanks in advance.
    Open web.xml, There will reference tab,, then take
    Resource, Add ur datasourse on where the Cursor points
    and then JNDI Name.
    U need to restart ..

  • JNDI and LDAP Results

    I have also posted this on Novell forums and it seems to only happen when the LDAP target is eDirectory.
    I am writing a JAVA program that uses JNDI to access LDAP data sources and I have run into an interesting problem when accessing eDirectory. The issue is that when I query on objects that involve a multivalue attribute and that multivalue attribute contains a large number of values then I appear to be getting back multiple records in my JNDI result set. For example, when I am going after an object in the LDAP Directory that is a "group" and there is a multivalue object within that record called "member" and if there are large number of member values (say 30,000 or so) then I will get multiple results in the JNDI Result set for the same DN value. The first record will contain all the normal attributes plus the first 650 or so member attribute values. Subsequent records will contain only the member attribute with more values. Each record is assciated with the same DN value. When I do the same type of thing going against an Active Directory the member attribute will be returned with an id of "member;range=0-1499" indicating that a range retrieval is required to get the remaining attributes BUT with AD I only get a single record back in the result set and it is up to my code to make the appropriate calls to get the remaining records. I can understand that each LDAP provider may have a different implementation for this type of large multivalue attribute issue but I have not been able to figure out in the case of eDirectory who is doing this "chunking" of values and how it can be detected or controlled. Can anyone provide me some help understanding how this data is being returned from eDirectory? I have not been able to find an explanation doing searches on JNDI or eDirectory that explains this behavior. In the testing I have done and looking at the TCP/IP dumps it would appear that JNDI is breaking the result coming from LDAP into multiple SearchResult entries. As mentioned, each SearchResult enties contains about 650 of the multi-valued attribute results which total about 20,000 bytes of information. Whoever is doing this knows the data is for the same DN value as the DN returned for all records by SearchResult.getObject()).getNameInNamespace() is the same.

    Curious if you ever came across a good solution for this?
    I'm running up against essentially the same thing; I have an application that needs to traverse potentially tens of thousands of entries within a given search base. Sort order is unimportant, speed is important. Having the directory administrator create vlv indexes is a non-starter.
    I did notice that I could have it sort on any attribute, even an attribute not in the schema (e.g., "hooHahFoo"), and get the same performance. Also noted that sorting by "dn" is broken in DS5.1, not in DS5.2.

  • I need "TestSessionHome" but get "CDRInputStream$1"

    Hi all! what about this:
    I deployed a session bean TestSession in Sun's app server.
    I made a client to test the bean, it runs outside of the app server
    here the code:
    package myjca.client;
    import javax.naming.*;
    import java.util.*;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.rmi.PortableRemoteObject;
    import com.testing.session.*;
    * @author zurdo1119
    public class TestClient
         //Prints the context
         private static void printContext(Context contexto, String contextoS, int a) throws NamingException
              int b;
              NameClassPair c;
              NamingEnumeration enum2;
              if (a == 0)
                   enum2 = contexto.list(contexto.getNameInNamespace());
              else
                   enum2 = contexto.list(contextoS);
              while (enum2.hasMore())
                   b = a;
                   while (b-- > 0)
                        System.out.print("--");
                   c = (NameClassPair)enum2.next();
                   System.out.println(c);
                   if (c.getClassName().equals("javax.naming.Context"))
                        printContext(contexto, c.getName(), a + 1);
         //Connect to TestSession
         public static void testConn()
              InitialContext initCtx = null;
              Object obj = null;
              try
                   initCtx = getInitialContext();
                   printContext(initCtx, "", 0);
                   TestSessionHome helloWorldHome =
                        (TestSessionHome)PortableRemoteObject.narrow(
                             initCtx.lookup("TestSession"),
                             TestSessionHome.class);
                   TestSession helloWorld = helloWorldHome.create();
                   helloWorld = helloWorldHome.create();
                   String pepe = helloWorld.helloWorld();
                   System.out.println("Pepe es: " + pepe);
              catch (Throwable ex)
                   ex.printStackTrace();
         //Get context
         private static InitialContext getInitialContext() throws NamingException
              Hashtable env = new Hashtable();
              env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
              env.put(Context.PROVIDER_URL, "iiop://localhost:1050");
              return new InitialContext(env);
         public static void main(String[] args)
              testConn();
    }Runing the client I get the context(the method "printContext" does it) and then a exception:
    ServerObject: com.sun.corba.se.internal.iiop.CDRInputStream$1:com.sun.corba.se.internal.iiop.CDRInputStream$1:IOR:000000...
    RemoteLogReader: com.sun.corba.se.internal.iiop.CDRInputStream$1:com.sun.corba.se.internal.iiop.CDRInputStream$1:IOR:000000...
    TestSession:com.sun.corba.se.internal.iiop.CDRInputStream$1:com.sun.corba.se.internal.iiop.CDRInputStream$1:IOR:000000001...
    java.lang.ClassCastException
         at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(Unknown Source)
         at javax.rmi.PortableRemoteObject.narrow(Unknown Source)
         at myjca.client.TestClient.testConn(TestClient.java:45)
         at myjca.client.TestClient.main(TestClient.java:70).
    This exception was caused by the narrow.
    You can see that "TestSession" is there but as "CDRInputStream$1" and I need "TestSessionHome".
    Whats wrong?
    Thanks
    Zurdo

    Hi zurdo,
    I have the same problem!!!!!!!!!!
    If you have solved it, could you give me any help?
    Thanks,
    Fil

  • How to get name of an entry?

    I search in my schema with code below:
    List<OrganizationPojo> organizationPojoList = new ArrayList<OrganizationPojo>();
         DirContext ctx = null;
         try { 
         // get a handle to an Initial DirContext
         ctx = new InitialDirContext(env);
         String[] attrIDs = { "dc", "objectClass","ou" };
         SearchControls ctls = new SearchControls();
         ctls.setReturningAttributes(attrIDs);
         ctls.setSearchScope(SearchControls.SUBTREE_SCOPE);
         String filter = "(&(dc=*) (objectClass=organizationalUnit) (ou=*))";
         NamingEnumeration answer = ctx.search(searchBaseDn, filter, ctls);
         try
                   while (answer.hasMore())
                             SearchResult sr = (SearchResult) answer.next();
                             LdapName dn = new LdapName((String)sr.getNameInNamespace());
                             LdapName rdn = new LdapName((String)sr.getName());
    I learned SearchResult.getName returns the name "relative to search base"
    But i only want to get the name of entry.
    I am getting dn correctly but can not find out how to get rdn relative to parent in the tree.

    More generally, to get the RDN of any search result, you're nearly there:
    List<Rdn> rdns = new LdapName(sr.geNameInNamespace()).getRdns();
    Rdn rdn = rdns.get(rdns.size()-1);

  • Can't get Home inteface

    Hi all! what about this:
    I deployed a session bean TestSession in Sun's app server.
    I made a client to test the bean, it runs outside of the app server
    here the code:
    package myjca.client;
    import javax.naming.*;
    import java.util.*;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.rmi.PortableRemoteObject;
    import com.testing.session.*;
    * @author zurdo1119
    public class TestClient
         //Prints the context
         private static void printContext(Context contexto, String contextoS, int a)
                               throws NamingException
              int b;
              NameClassPair c;
              NamingEnumeration enum2;
              if (a == 0)
                   enum2 = contexto.list(contexto.getNameInNamespace());
              else
                   enum2 = contexto.list(contextoS);
              while (enum2.hasMore())
                   b = a;
                   while (b-- > 0)
                        System.out.print("--");
                   c = (NameClassPair)enum2.next();
                   System.out.println(c);
                   if (c.getClassName().equals("javax.naming.Context"))
                        printContext(contexto, c.getName(), a + 1);
         //Connect to TestSession
         public static void testConn()
              InitialContext initCtx = null;
              Object obj = null;
              try
                   initCtx = getInitialContext();
                   printContext(initCtx, "", 0);
                   TestSessionHome helloWorldHome =
                        (TestSessionHome)PortableRemoteObject.narrow(
                             initCtx.lookup("TestSession"),
                             TestSessionHome.class);
                   TestSession helloWorld = helloWorldHome.create();
                   helloWorld = helloWorldHome.create();
                   String pepe = helloWorld.helloWorld();
                   System.out.println("Pepe es: " + pepe);
              catch (Throwable ex)
                   ex.printStackTrace();
         //Get context
         private static InitialContext getInitialContext() throws NamingException
              Hashtable env = new Hashtable();
              env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
              env.put(Context.PROVIDER_URL, "iiop://localhost:1050");
              return new InitialContext(env);
         public static void main(String[] args)
              testConn();
    }Runing the client I get the context(the method "printContext" does it) and then a exception:
    ServerObject:com.sun.corba.se.internal.iiop.CDRInputStream$1:
       com.sun.corba.se.internal.iiop.CDRInputStream$1:IOR:000000...
    RemoteLogReader:com.sun.corba.se.internal.iiop.CDRInputStream$1:
       com.sun.corba.se.internal.iiop.CDRInputStream$1:IOR:000000...
    TestSession:com.sun.corba.se.internal.iiop.CDRInputStream$1:
       com.sun.corba.se.internal.iiop.CDRInputStream$1:IOR:000000001...
    java.lang.ClassCastException at
    com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(Unknown Source)
    at javax.rmi.PortableRemoteObject.narrow(Unknown Source)
    at myjca.client.TestClient.testConn(TestClient.java:45)
    at myjca.client.TestClient.main(TestClient.java:70).
    This exception was caused by the narrow.
    You can see that "TestSession" is there but as "CDRInputStream$1" and I need "TestSessionHome".
    Whats wrong?
    Thanks
    Zurdo

    I had a similar problem with my application and I was
    given the next solution:
    In your getInitialContext method try adding this
    line:
    env.put("dedicated.connection", "true");
    I don't know if this will help cause i didn't try to
    understand why it worked, but i hope soThanks but it doesn't work, I have migrated all to OC4J.
    Thanks again.

  • IBM Websphere to ActiveDirectory ( Win 2003 ) LDAP SSL.

    I am trying to connect to Win 2003 Ad LDAP from websphere Application server.
    I have installed certificates Win2k in to local key store.
    I used ikeyman of Websphere. Win 2k3 certificates were in .arm format ( thatz how Win2k3 admin gave me) . I succesfully installed the certificates in local keystore. and pointed to the keystoere when LDAP connection is happening.
    I am getting a MalformedURLException canot parse url ldaps://xx.xx.x.x:636
    Not an LDAP url .
    At the same time i also tried with Sun JDK . it shows another error .
    default context init failed: java.security.cert.CertificateParsingException: java.io.IOException: subject key, Unknown k
    ey spec: Invalid RSA modulus size.
    Please help me . I want this program to run from IBM Websphere Env.
    Please find my code below
    thanks in advance.
    import java.util.Hashtable;
    import javax.naming.*;
    import javax.naming.ldap.*;
    import javax.naming.directory.*;
    import java.io.*;
    public class Test {
    public static void main(String args[] ) {
              //String userName = "CN=Renjith\\, Vasudevan";
              String userName = null;
              String test = ",OU=xx,OU=xx,DC=xx,DC=xxm";
              String newPassword = "xxx";
              String oldPassword = "xx";
              Hashtable env = new Hashtable();
              //Hard coded values - will be moved to properties file.
              env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
              //env.put(Context.PROVIDER_URL, "ldap://X.X.X.X:389");
              env.put(Context.PROVIDER_URL, "ldaps://X.X.X.X:636");
              env.put(Context.SECURITY_AUTHENTICATION, "simple");
              //env.put(Context.SECURITY_PRINCIPAL, "[email protected]");
              env.put(Context.SECURITY_PRINCIPAL, "[email protected]");
              env.put(Context.SECURITY_CREDENTIALS, "xxxx");
              //env.put(Context.SECURITY_PROTOCOL,"ssl");
              String keystore = "C:\\j2sdk1.4.2_04\\jre\\lib\\security\\cacerts";
              System.setProperty("javax.net.ssl.trustStore",keystore);
              System.setProperty("javax.net.ssl.trustStorePassword", "changeit");
              try {
                   // Create the initial directory context
                   LdapContext ctx = new InitialLdapContext(env,null);
                   // This following code only for getting correct dn - Hardcoded dn had some tabbing/char problem.
                   // Renjith - begin
                   SearchControls constraints = new SearchControls();
                   constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
                   String[] strAttributes = { "sAMAccountName", "memberOf" };
                   //String FILTER = "(&(objectClass=user))";
                   String FILTER = "(&(objectClass=user)(sAMAccountName=prrev))";
                   String searchBase = "OU=xx,OU=xx,DC=infores,DC=xx";
                   constraints.setReturningAttributes(strAttributes);
                   NamingEnumeration results =
                        ctx.search(searchBase, FILTER, constraints);
                   System.out.println("results : " + results);
                   while (results != null && results.hasMore()) {
                        SearchResult sr = (SearchResult) results.next();
                        String dn = sr.getName();
                        //String dn =  ((Context)sr.getObject()).getNameInNamespace();
                        if(dn.indexOf("Renjith") != -1 ) {
                        System.out.println("Distinguised Name : " + dn);
                        //System.out.println("Charg"+dn.toCharArray());
                        userName = dn+test;
                        break;
                   // Renjith - end.
                   //set password is a ldap modify operation
                   ModificationItem[] mods = new ModificationItem[2];
                   String oldQuotedPassword = "\"" + oldPassword + "\"";
                   byte[] oldUnicodePassword = oldQuotedPassword.getBytes("UTF-16LE");
                   String newQuotedPassword = "\"" + newPassword + "\"";
                   byte[] newUnicodePassword = newQuotedPassword.getBytes("UTF-16LE");
                   mods[0] = new ModificationItem(DirContext.REMOVE_ATTRIBUTE,
                              new BasicAttribute("unicodePwd", oldUnicodePassword));
                   mods[1] = new ModificationItem(DirContext.ADD_ATTRIBUTE, new BasicAttribute("unicodePwd",
                             newUnicodePassword));
                   System.out.println("Trying to reset Password for: " + userName);
                   // Perform the update
                   ctx.modifyAttributes(userName, mods);
                   System.out.println("Reset Password for: " + userName);     
                   ctx.close();
              catch (NamingException e) {
                   e.printStackTrace();
                   System.out.println("Problem resetting password: " + e);
              catch (UnsupportedEncodingException e) {
                   System.out.println("Problem encoding password: " + e);
    }

    The first error you described "malformed URL" is possibly due to the fact that your JRE version 1.4 does not support the ldaps URL.
    If using 1.4 then you must use the following syntax:env.put(Context.PROVIDER_URL,"ldap://servername:636");If using 1.5, then it supports the syntax:env.put(Context.PROVIDER_URL,"ldaps://servername:636");I can't comment on the other error message you receive, however I am concerned at two things, one is that in your sample code you are using a "null" user name, and secondly, I have no idea what certificate you have installed. I do not recall seeing a Windows CA cert with the extension of .arm. Normally the Root CA exported trust cert has the extension of .cer

  • Portalapp.xml sharing reference

    I have the following import statements :
    import java.util.Hashtable;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import com.sap.portal.pcm.iview.IiView;
    import com.sapportals.portal.pcd.gl.IPcdContext;
    import com.sapportals.portal.prt.component.AbstractPortalComponent;
    import com.sapportals.portal.prt.component.IPortalComponentRequest;
    import com.sapportals.portal.prt.component.IPortalComponentResponse;
    And my Portalapp.xml definition looks like:
    <?xml version="1.0" encoding="utf-8"?>
    <application>
      <application-config>
        <property name="SharingReference" value="com.sap.portal.usermapping"/>
      </application-config>
      <components>
        <component name="logonTest">
          <component-config>
            <property name="ClassName" value="logonTest"/>
          </component-config>
          <component-profile/>
        </component>
        </components>
      <services/>
    </application>
    Do I need additional entries?
    Message was edited by: Mario Bajic
    Message was edited by: Mario Bajic

    now i have put
    in my portalapp.xml.
    Same Error and sure that i am soon going to throw my PC out of the Window!
              Hashtable env = new Hashtable();
                   env.put(Context.INITIAL_CONTEXT_FACTORY,IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
                   env.put(Context.SECURITY_PRINCIPAL,request.getUser());
                   env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sapportals.portal.pcd.gl.PcdInitialContextFactory");
                   env.put("com.sap.portal.jndi.requested_aspect","com.sap.portal.pcd.gl.PersistencyAspect");
                   response.write("Context.INITIAL_CONTEXT_FACTORY : " + Context.INITIAL_CONTEXT_FACTORY + br);
                   response.write("IPcdContext.PCD_INITIAL_CONTEXT_FACTORY : " + IPcdContext.PCD_INITIAL_CONTEXT_FACTORY + br);
                   response.write("Context.SECURITY_PRINCIPAL : " + Context.SECURITY_PRINCIPAL + br);
                   response.write("Context.INITIAL_CONTEXT_FACTORY : " + Context.INITIAL_CONTEXT_FACTORY + br);
                   InitialContext iCtx = new InitialContext(env);
                   response.write("iCtx : " + iCtx);
                   response.write("iCtx.getNameInNamespace() : " + iCtx.getNameInNamespace() +br);
                   String id ="pcd:portal_content/de.local.m1/de.local.iV1/de.local.iVLogonTest";
                   response.write("before Lookup" +br);
                   IiView result = (IiView) iCtx.lookup(id);  <-- Here the Error is thrown!
                   Here is the Error :
                   Portal-Laufzeitfehler
                   Fehler aufgetreten bei der Verarbeitung eines Request für :
                   iView : pcd:portal_content/de.local.m1/de.local.service/de.local.s_logon/de.local.logonTest2
                   Komponentenname : logon.LogonTest
                   com/sap/portal/pcm/iview/IiView.
                   Exception id: 09:55_26/06/06_0016_36232950
                   See the details for the exception ID in the log file
                   My iView is assign to a role with the Id "s_logon".
                   All my Objects in the portal has the prefix "de.local".

  • Accessing WebLogic EJBs from Tomcat 3.2

    Has anyone out there tried to access EJBs in a WebLogic 5.10 SP6 app
    server from a servlet in Tomcat 3.2? I'm operating under Win2K. When I
    try to create the initial naming context, the following exception is
    thrown:
    java.lang.NoClassDefFoundError: COM/rsa/jsafe/JSAFE_InvalidUseException
    at weblogic.security.WLMessageDigest.getInstance
    (WLMessageDigest.java:52)
    at weblogic.security.MD5RandomBitsSource.seed
    (MD5RandomBitsSource.java:56)
    at weblogic.rjvm.LocalRJVM.<init>(LocalRJVM.java:108)
    at weblogic.rjvm.LocalRJVM.getLocalRJVM(LocalRJVM.java:85)
    at weblogic.rjvm.RJVMManager.getLocalRJVM(RJVMManager.java:89)
    at weblogic.rjvm.RJVMManager.initialize(RJVMManager.java:78)
    at weblogic.kernel.Kernel.ensureInitialized(Kernel.java:137)
    at weblogic.rjvm.ServerURL.findOrCreateRJVM(ServerURL.java:182)
    at
    weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(
    WLInitialContextFactoryDelegate.java, Compiled Code)
    at
    weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(
    WLInitialContextFactoryDelegate.java:148)
    at weblogic.jndi.WLInitialContextFactory.getInitialContext(
    WLInitialContextFactory.java:123)
    at javax.naming.spi.NamingManager.getInitialContext(
    NamingManager.java:771)
    at javax.naming.InitialContext.getDefaultInitCtx(
    InitialContext.java:169)
    at javax.naming.InitialContext.<init>(InitialContext.java:146)
    From poking around in the WebLogic server directories, in appears that
    the RSA-related classes are implemented as native methods in jsafe.dll.
    Should I be trying to install this dll in Tomcat somehow? If so, where
    should I be looking for information on how to do this?
    -- Erik

    "Erik Horstkotte" <[email protected]> wrote in message news:[email protected]...
    Has anyone out there tried to access EJBs in a WebLogic 5.10 SP6 app
    server from a servlet in Tomcat 3.2? I'm operating under Win2K. When I
    try to create the initial naming context, the following exception is
    thrown:[Sigh. I know it's bad form to follow up your own posts, but...]
    Ignore the exact problem description above. I wasn't including
    \weblogic\classes and \weblogic\lib\weblogicaux.jar in Tomcat's
    classpath. Now the same code connects to the app server:
    Connected successfully using http to JIMBO/172.16.1.4:7001
    But immediately after connecting, I get a new exception:
    java.lang.NoSuchMethodError: java.lang.NoSuchMethodException:
    getNameInNamespace
    at weblogic.jndi.toolkit.BasicWLContext_WLStub.ensureInitialized
    (BasicWLContext_WLStub.java:127)
    at weblogic.jndi.toolkit.BasicWLContext_WLStub.<init>
    (BasicWLContext_WLStub.java:146)
    at java.lang.reflect.Constructor.newInstance(Native Method)
    at weblogic.common.internal.ClassTableEntry.newInstance
    (ClassTableEntry.java:86)
    at weblogic.common.internal.WLObjectInputStreamBase.readLeftover
    (WLObjectInputStreamBase.java:248)
    at weblogic.common.internal.WLObjectInputStreamBase
    .readObjectBody (WLObjectInputStreamBase.java:202)
    at weblogic.common.internal.WLObjectInputStreamBase.readObject
    (WLObjectInputStreamBase.java:949)
    at weblogic.common.internal.WLObjectInputStreamBase.readObjectWL
    (WLObjectInputStreamBase.java:308)
    at weblogic.jndi.toolkit.WLContextStub.readExternal
    (WLContextStub.java:79)
    at weblogic.common.internal.WLObjectInputStreamBase
    .readPublicSerializable(WLObjectInputStreamBase.java:269)
    at weblogic.common.internal.WLObjectInputStreamBase.readLeftover
    (WLObjectInputStreamBase.java:254)
    at weblogic.common.internal.WLObjectInputStreamBase.readObjectBody
    (WLObjectInputStreamBase.java:202)
    at weblogic.common.internal.WLObjectInputStreamBase.readObject
    (WLObjectInputStreamBase.java:949)
    at weblogic.common.internal.WLObjectInputStreamBase.readObjectWL
    (WLObjectInputStreamBase.java:308)
    at weblogic.rmi.extensions.AbstractInputStream2.readObject
    (AbstractInputStream2.java:25)
    at weblogic.jndi.internal.RemoteContextFactoryImpl_WLStub
    .getContext(RemoteContextFactoryImpl_WLStub.java:99)
    at weblogic.jndi.WLInitialContextFactoryDelegate
    .newRemoteContext(WLInitialContextFactoryDelegate.java:316)
    at weblogic.jndi.WLInitialContextFactoryDelegate.newContext
    (WLInitialContextFactoryDelegate.java:242)
    at weblogic.jndi.WLInitialContextFactoryDelegate
    .getInitialContext(WLInitialContextFactoryDelegate.java, Compiled
    Code)
    at weblogic.jndi.WLInitialContextFactoryDelegate
    .getInitialContext(WLInitialContextFactoryDelegate.java:148)
    at weblogic.jndi.WLInitialContextFactory.getInitialContext
    (WLInitialContextFactory.java:123)
    at javax.naming.spi.NamingManager.getInitialContext
    (NamingManager.java:771)
    at javax.naming.InitialContext.getDefaultInitCtx
    (InitialContext.java:169)
    at javax.naming.InitialContext.<init>(InitialContext.java:146)
    getNameInNamespace isn't a method in any of my EJB's (that I wrote, at
    least - it could be generated by weblogic.ejbc), and it's not a method
    I'm calling directly. Presumably, something in the remote session bean
    creation is calling this method (of what class?)
    Am still I missing classpath entries in Tomcat? If so, which ones?
    If you've successfully referenced EJBs in a WebLogic Server from a
    Tomcat servlet, what setup changes did you have to make to Tomcat and
    WLS to make it fly?
    -- Erik

  • Using JNDI to establish dependencies

    Hi, I'm wondering whether anyone here has used the method of tracking JNDI lookups
    to establish dependencies between components. I'm trying to establish a dependency
    chain on the server side by which I can authoritatively say that a particular
    transaction follows a certain path through a set of components. Is this possible
    with WLS?

    It is not possible to create automagically arbitrary files directly
    via FSContext. However it is possible to delete them.
    A little example might clarify things:
    Context ctx = new InitialContext(env);
    System.out.println(ctx.getClass().toString());
    // create file
    String filename = "foo.txt";           
    File f = new File(ctx.getNameInNamespace() + "/" + filename);
    // store it to file system
    if (f.createNewFile())
    System.out.println("File " + filename  + " created");           
    // note you cannot do ctx.rebind(filename  ,f) with RefFSContext because File is not Referenceable
    // check that the file can be found via JNDI
    f = (File)ctx.lookup(filename);
    System.out.println(f.getClass().toString()  + " " + f.toString());
    // delete file
    ctx.unbind(filename); // <---physically deletes fileCheers,
    Kullervo

  • When I ran the sample code(WebLogicContextExample.java)

    Hi:
    when I ran the sample code(c:\weblogic\examples\jndi\WebLogicContextExample.java) occuring some errors.
    Any Body can help me. Thx a lot!
    Anny Chen
    Here's error message:
    C:\weblogic>java examples.jndi.WebLogicContextExample
    WebGain Java! JustInTime Compiler Version 4.00.002(x) for JDK 1.2
    Copyright (C) 2000 WebGain, Inc.
    null
    java.lang.NoSuchMethodError: java.lang.NoSuchMethodException: getNameInNamespace
    at weblogic.jndi.toolkit.BasicWLContext_WLStub.ensureInitialized(BasicWL
    Context_WLStub.java:127)
    at weblogic.jndi.toolkit.BasicWLContext_WLStub.<init>(BasicWLContext_WLS
    tub.java:146)
    at java.lang.reflect.Constructor.newInstance(Native Method)
    at weblogic.common.internal.ClassTableEntry.newInstance(ClassTableEntry.
    java:86)
    at weblogic.common.internal.WLObjectInputStreamBase.readLeftover(WLObjec
    tInputStreamBase.java:248)
    at weblogic.common.internal.WLObjectInputStreamBase.readObjectBody(WLObj
    ectInputStreamBase.java:202)
    at weblogic.common.internal.WLObjectInputStreamBase.readObject(WLObjectI
    nputStreamBase.java:949)
    at weblogic.common.internal.WLObjectInputStreamBase.readObjectWL(WLObjec
    tInputStreamBase.java:308)
    at weblogic.jndi.toolkit.WLContextStub.readExternal(WLContextStub.java:7
    9)
    at weblogic.common.internal.WLObjectInputStreamBase.readPublicSerializab
    le(WLObjectInputStreamBase.java:269)
    at weblogic.common.internal.WLObjectInputStreamBase.readLeftover(WLObjec
    tInputStreamBase.java:254)
    at weblogic.common.internal.WLObjectInputStreamBase.readObjectBody(WLObj
    ectInputStreamBase.java:202)
    at weblogic.common.internal.WLObjectInputStreamBase.readObject(WLObjectI
    nputStreamBase.java:949)
    at weblogic.common.internal.WLObjectInputStreamBase.readObjectWL(WLObjec
    tInputStreamBase.java:308)
    at weblogic.rmi.extensions.AbstractInputStream2.readObject(AbstractInput
    Stream2.java:25)
    at weblogic.jndi.internal.RemoteContextFactoryImpl_WLStub.getContext(Rem
    oteContextFactoryImpl_WLStub.java:99)
    at weblogic.jndi.WLInitialContextFactoryDelegate.newRemoteContext(WLInit
    ialContextFactoryDelegate.java:316)
    at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialCon
    textFactoryDelegate.java:242)
    at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLIni
    tialContextFactoryDelegate.java, Compiled Code)
    at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLIni
    tialContextFactoryDelegate.java:148)
    at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialCont
    extFactory.java:123)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:7
    71)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:169
    at javax.naming.InitialContext.<init>(InitialContext.java:146)
    at examples.jndi.WebLogicContextExample.main(WebLogicContextExample.java
    :107)
    Initial context created
    Subcontext 'example' created
    Bound 'Example String created at 2000/1/3 &#19979;&#21320; 05:48:18' to 'example.one' for th
    e first time.
    Example finished successfully.

    This is very likely a CLASSPATH issue. Make sure weblogicaux.jar is
    at the head of your CLASSPATH.
    Mike
    "pamal" <[email protected]> wrote in message
    news:[email protected]...
    I just installed 5.1 with sp2 and have the same problem. Anyone know
    about this one?
    Anny Chen wrote:
    Hi:
    when I ran the sample
    code(c:\weblogic\examples\jndi\WebLogicContextExample.java) occuring some
    errors.
    Any Body can help me. Thx a lot!
    Anny Chen
    Here's error message:
    C:\weblogic>java examples.jndi.WebLogicContextExample
    WebGain Java! JustInTime Compiler Version 4.00.002(x) for JDK 1.2
    Copyright (C) 2000 WebGain, Inc.
    null
    java.lang.NoSuchMethodError: java.lang.NoSuchMethodException:getNameInNamespace
    >>
    atweblogic.jndi.toolkit.BasicWLContext_WLStub.ensureInitialized(BasicWL
    Context_WLStub.java:127)
    atweblogic.jndi.toolkit.BasicWLContext_WLStub.<init>(BasicWLContext_WLS
    tub.java:146)
    at java.lang.reflect.Constructor.newInstance(Native Method)
    atweblogic.common.internal.ClassTableEntry.newInstance(ClassTableEntry.
    java:86)
    atweblogic.common.internal.WLObjectInputStreamBase.readLeftover(WLObjec
    tInputStreamBase.java:248)
    atweblogic.common.internal.WLObjectInputStreamBase.readObjectBody(WLObj
    ectInputStreamBase.java:202)
    atweblogic.common.internal.WLObjectInputStreamBase.readObject(WLObjectI
    nputStreamBase.java:949)
    atweblogic.common.internal.WLObjectInputStreamBase.readObjectWL(WLObjec
    tInputStreamBase.java:308)
    atweblogic.jndi.toolkit.WLContextStub.readExternal(WLContextStub.java:7
    9)
    atweblogic.common.internal.WLObjectInputStreamBase.readPublicSerializab
    le(WLObjectInputStreamBase.java:269)
    atweblogic.common.internal.WLObjectInputStreamBase.readLeftover(WLObjec
    tInputStreamBase.java:254)
    atweblogic.common.internal.WLObjectInputStreamBase.readObjectBody(WLObj
    ectInputStreamBase.java:202)
    atweblogic.common.internal.WLObjectInputStreamBase.readObject(WLObjectI
    nputStreamBase.java:949)
    atweblogic.common.internal.WLObjectInputStreamBase.readObjectWL(WLObjec
    tInputStreamBase.java:308)
    atweblogic.rmi.extensions.AbstractInputStream2.readObject(AbstractInput
    Stream2.java:25)
    atweblogic.jndi.internal.RemoteContextFactoryImpl_WLStub.getContext(Rem
    oteContextFactoryImpl_WLStub.java:99)
    atweblogic.jndi.WLInitialContextFactoryDelegate.newRemoteContext(WLInit
    ialContextFactoryDelegate.java:316)
    atweblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialCon
    textFactoryDelegate.java:242)
    atweblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLIni
    tialContextFactoryDelegate.java, Compiled Code)
    atweblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLIni
    tialContextFactoryDelegate.java:148)
    atweblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialCont
    extFactory.java:123)
    atjavax.naming.spi.NamingManager.getInitialContext(NamingManager.java:7
    71)
    atjavax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:169
    at javax.naming.InitialContext.<init>(InitialContext.java:146)
    atexamples.jndi.WebLogicContextExample.main(WebLogicContextExample.java
    :107)
    Initial context created
    Subcontext 'example' created
    Bound 'Example String created at 2000/1/3 &#19979;&#21320; 05:48:18' to'example.one' for th
    e first time.
    Example finished successfully.

  • Retrieve CodeLink of PCD iView

    I have written a JSPDynPage application to list all IViews in the PCD.  For each iView in the list, I want to display several attributes.  I am successfully retrieving "last changed by" as well as "quicklink", but I have not been able to retrieve "CodeLink".  The call for CodeLink returns a nullPointer.   See code below.  Any thoughts on how to successfully retrieve the "CodeLink" attribute?  Thanks in advance!
    try {
        this.setLastChangedBy(
        sr.getAttributes().get("com.sap.portal.pcd.gl.LastChangedBy").get().toString());
    } catch (Exception e) {
       this.setLastChangedBy("");
    try {
        this.setQuicklink(
        sr.getAttributes().get("com.sap.portal.navigation.QuickLink").get().toString());
    } catch (Exception e) {
        this.setQuicklink("");
    try {
        this.setCodeLink(
        sr.getAttributes().get("CodeLink").get().toString());
    } catch (Exception e) {
        this.setCodeLink(e.toString());

    I also ran into this issue in the past, not being able to retrieve the 'CodeLink' attribute during the lookup process and I could not find any workaround for this issue. I was looking for all appintegrator iViews so I was checking for all iViews with 'System' attribute (refer to java code):
    private List getiViewsList(String searchRoot, IUser user) {
              List list = new ArrayList();
              try {
                   String searchString = "(&" + SEARCH_STRING + ")";
                   Hashtable env = new Hashtable();
                   env.put(Constants.REQUESTED_ASPECT,IPcdAttribute.PERSISTENCY_ASPECT);
                   env.put(IPcdContext.SECURITY_PRINCIPAL, user);
                   env.put(Context.INITIAL_CONTEXT_FACTORY,IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
                   InitialContext iCtx = new InitialContext(env);
                   IPcdContext searchRootCtx = (IPcdContext) iCtx.lookup(searchRoot);
                   PcdSearchControls ctls = new PcdSearchControls();
                   //ctls.setSearchScope(PcdSearchControls.UNIT_ROOTS_ONLY_SCOPE);
                   ctls.setSearchScope(PcdSearchControls.SUBTREE_SCOPE);
                   ctls.setReturningObjFlag(true);
                   NamingEnumeration enum1 =searchRootCtx.search("", searchString, ctls);
                   while (enum1.hasMore()) {
                        SearchResult result = (SearchResult) enum1.next();
                        IPcdContext pcdCtx = (IPcdContext) result.getObject();
                        String alias =pcdCtx.getAttributes("").get(ATTR_ID_SYSTEM).get().toString();
                        //String codelink = pcdCtx.getAttributes("").get(ATTR_ID_CODELINK).get().toString();
                        list.add(new IViewInfo(pcdCtx.getNameInNamespace(), alias));
              } catch (NamingException e) {
                   return null;
              return list;
    - (See next message for more details)
    Edited by: Ehud Felus on May 16, 2010 2:57 PM

  • Jndi jdbc App Server Integration

    We are seeing the following error in -
    /jes/var/opt/SUNWappserver/domains/domain1/logs/server.log
    [#|2007-07-26T10:58:47.790-0400|FINE|sun-appserver-ee8.1_02|
    javax.enterprise.resource.resourceadapter|_ThreadID=27;|
    RAR5036:Resource reference is not defined for JNDI name [jdbc/MarxDB]|#]
    Application server is -
    Sun Java System Application Server 8.1_02 (build b21-p10)
    Excerpt from our test java class
    System.out.println("\n.MARKER2 before dataSource.getConnection().\n");
    Above seen in log files.
    dbConnection = dataSource.getConnection();
    System.out.println("\n.after dataSource.getConnection().\n");
    Above never seen in log files.
    Excerpt from our server.log.
    .MARKER2 before dataSource.getConnection().
    |#]
    [#|2007-07-26T10:58:47.790-0400|FINE|sun-appserver-ee8.1_02|
    javax.enterprise.resource.resourceadapter|_ThreadID=27;|
    RAR5036:Resource reference is not defined for JNDI name [jdbc/MarxDB]|#]
    Excerpt from /jes/var/opt/SUNWappserver/domains/domain1/config/domain.xml
    <jdbc-resource enabled="true" jndi-name="jdbc/MarxDB" object-type="user" pool-name="MARXDB"/>
    <jdbc-connection-pool connection-validation-method="auto-commit"
    datasource-classname="COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource"
    fail-all-connections="true"
    idle-timeout-in-seconds="300"
    is-connection-validation-required="true"
    is-isolation-level-guaranteed="false"
    max-pool-size="32"
    max-wait-time-in-millis="8000"
    name="MARXDB"
    pool-resize-quantity="4"
    res-type="javax.sql.ConnectionPoolDataSource"
    steady-pool-size="8"
    validation-table-name="mcs_user_status">
    <property name="user" value="IACSTNV"/>
    <property name="url" value="jdbc:db2:HCFADB1T"/>
    <property name="password" value="CKM349AB"/>
    <property name="databaseName" value="HCFADB1T"/>
    <property name="portNumber" value="50000"/>
    </jdbc-connection-pool>

    Here is the java
    package gov.hhs.cms.ebs.das;
    import gov.hhs.cms.ebs.log.LogManager;
    import gov.hhs.cms.ebs.util.PropertiesUtil;
    import java.sql.CallableStatement;
    import java.sql.Connection;
    import java.sql.SQLException;
    import java.sql.Types;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.sql.DataSource;
    import java.util.Hashtable;
    import java.util.Enumeration;
    public class MarxDas {
         private static int MARX_COUNTER = 0;
         private static Connection getConnection(String MARX_DB_DATASOURCE) {
              System.out.println("\nMarxDas cl, getConnection md arg is ." + MARX_DB_DATASOURCE + ".\n");
              LogManager.debug("Inside getConnection method of MarxDao");
              Connection dbConnection = null;
              InitialContext ic = null;
              DataSource dataSource = null;
              try {
                   LogManager.debug("getConnection: Trying to establish a DB2 connection");
                   ic = new InitialContext();
              System.out.println("\nMarxDas cl, getConnection md ic.getNameInNamespace is ." + ic.getNameInNamespace() + ".\n");
    Hashtable myHashtable = ic.getEnvironment();
              System.out.println("\nMarxDas cl, getConnection md myHashtable isEmpty is ." + myHashtable.isEmpty() + ".\n");
    Enumeration enum = myHashtable.keys();
    while ( enum.hasMoreElements() ) {
    Object myKey = enum.nextElement();
              System.out.println("\nMarxDas cl, getConnection md Hashtable key is ." + myKey + ".\n");
              System.out.println("\nMarxDas cl, getConnection md value is ." + myHashtable.get(myKey) + ".\n");
    // System.out.println("\nMarxDas cl, ic.lookup(MARX_DB_DATASOURCE) is." + ic.lookup(MARX_DB_DATASOURCE) + ".\n");
    if ( (DataSource) ic.lookup(MARX_DB_DATASOURCE) == null ) {
    System.out.println("\n (DataSource) ic.lookup(MARX_DB_DATASOURCE) is NULL." );
    else {
    System.out.println("\n (DataSource) ic.lookup(MARX_DB_DATASOURCE) is NOT NULL.\n");
    System.out.println("\n (DataSource) ic.lookup(MARX_DB_DATASOURCE) is ." + (DataSource) ic.lookup(MARX_DB_DATASOURCE) + ".\n");
                   if (ic != null) {
                        dataSource = (DataSource) ic.lookup(MARX_DB_DATASOURCE);
    System.out.println("\ndataSource is ." + dataSource + ".\n");
                        if (dataSource != null) {
    System.out.println("\n.before dataSource.getConnection().\n");
    System.out.println("\n.MARKER2 before dataSource.getConnection().\n");
    // dbConnection = ((com.sun.gjc.spi.DataSource)dataSource).getConnection();
    dbConnection = dataSource.getConnection();
    System.out.println("\n.after dataSource.getConnection().\n");
              } catch (Exception e) {
                   LogManager.error(
                        "getConnection: Exception occurred while getting datasource: "
                             + e.getMessage());
         System.out.println("\nMarxDas cl, getConnection md dbConnection is ." + dbConnection + ".\n");
              return dbConnection;
    public static String checkMarxConnection(String MARX_DB_DATASOURCE) {
         System.out.println("\nMarxDas cl, checkMarxConnection md arg is ." + MARX_DB_DATASOURCE + ".\n");
    LogManager.debug("Inside checkMarxConnection method of MarxDao");
    Connection dbConnection = null;
    try {
    dbConnection = getConnection(MARX_DB_DATASOURCE);
    System.out.println("\n.9.\n");
    /* if (dbConnection == null && MARX_COUNTER < 10) {
    MARX_COUNTER = MARX_COUNTER+1;
    LogManager.debug("MARX COUNTER is "+MARX_COUNTER);
    String timeout = PropertiesUtil.getProperty("iacs", "MARX_POLL_WAIT");
    Thread.sleep(new Long(timeout).longValue());
    LogManager.debug("Returning FALSE");
    return "false";
    } else {
    LogManager.debug("MARX COUNTER is "+MARX_COUNTER);
    LogManager.debug("Resetting MARX COUNTER to 0 and returning TRUE");
    MARX_COUNTER = 0;
    return "true";
    if (dbConnection == null) {
    String timeout =
    PropertiesUtil.getProperty("iacs", "MARX_POLL_WAIT");
    LogManager.debug(
    "checkMarxConnection: connection is null; about to enter a sleep");
    Thread.sleep(new Long(timeout).longValue());
    LogManager.debug("checkMarxConnection: returning FALSE");
    return "false";
    } else {
    LogManager.debug(
    "checkMarxConnection: connection is not null; returning TRUE");
    return "true";
    } catch (NumberFormatException e1) {
    LogManager.error(
    "Check MARX Connection: NumberFormatException occurred: "
    + e1.getMessage());
    return "false";
    } catch (InterruptedException e2) {
    LogManager.error(
    "Check MARX Connection: InterruptedException occurred: "
    + e2.getMessage());
    return "false";
    } finally {
    try {
    dbConnection.close();
    } catch (SQLException e) {
    e.printStackTrace();
         public static String createMarxAccount(
              String requesterUserId,
              String userIdmId,
              String userId,
         //This is the RACF ID
              String userFirstname,
              String userLastname,
              String userMiddleInitial,
              int roleCount,
              String roleData,
              int ACSCount,
              String ACSData,
              int userOrgType,
              String userOrgName,
              String MARX_DB_DATASOURCE,
              String MARX_DB_STORPROC_NAME) {
              Connection dbConnection = getConnection(MARX_DB_DATASOURCE);
              String replyStatus = "";
              CallableStatement callableStatement = null;
              String query =
                   "{call " + MARX_DB_STORPROC_NAME + " (?,?,?,?,?,?,?,?,?,?,?,?,?) }";
              try {
                   LogManager.debug(" After getConnection");
                   callableStatement = dbConnection.prepareCall(query);
                   LogManager.debug("preparecall is a success");
                   callableStatement.setString(1, requesterUserId);
                   LogManager.debug("requesterUserId is a success");
                   callableStatement.setString(2, userIdmId);
                   LogManager.debug("IDMiD is a success");
                   callableStatement.setString(3, userId);
                   LogManager.debug("userId is a success");
                   callableStatement.setString(4, userFirstname);
                   LogManager.debug("userFirstname is a success");
                   callableStatement.setString(5, userLastname);
                   LogManager.debug("userLastname is a success");
                   callableStatement.setString(
                        6,
                        (userMiddleInitial == null) ? "" : userMiddleInitial);
                   LogManager.debug("userMiddleInitial is a success");
                   // callableStatement.setShort(7, Short.valueOf(roleCount).shortValue());
                   callableStatement.setShort(7, (short) roleCount);
                   LogManager.debug("roleCount is a success");
                   callableStatement.setString(8, roleData);
                   LogManager.debug("roleData is a success");
                   // callableStatement.setShort(9, Short.valueOf(ACSCount).shortValue());
                   callableStatement.setShort(9, (short) ACSCount);
                   LogManager.debug("ACSCount is a success");
                   callableStatement.setString(10, ACSData);
                   LogManager.debug("ACSData is a success");
                   callableStatement.setShort(11, (short) userOrgType);
                   LogManager.debug("userOrgType is a success");
                   if (userOrgName!=null && userOrgName.length()>20) {
                        userOrgName = userOrgName.substring(0, 20);
                   callableStatement.setString(12, userOrgName);
                   LogManager.debug("userOrgName is a success");
                   LogManager.debug(" input args all success");               
                   callableStatement.registerOutParameter(13, Types.CHAR);
                   LogManager.debug(" After registerOutParameter");
                   callableStatement.execute();
                   LogManager.debug(" execute is a success");
                   replyStatus = callableStatement.getString(13);
              } catch (Exception e) {
                   replyStatus = "100";
                   try {
                        dbConnection.rollback();
                   } catch (Exception ex) {
                   LogManager.error(
                        "Exception occurred createMarxAccount: " + e.getMessage());
              } finally {
                   try {
                        if (callableStatement != null) {
                             callableStatement.close();
                        if (dbConnection != null) {
                             dbConnection.close();
                   } catch (Exception e) {
              return replyStatus;
    }

  • Error in JNDI

    javax.naming.AuthenticationException: RMIConnection Disconnected
    What could be the possible cause for this exception
    Following are the context details
    [RMI context JavaO2S]/jdbc/jo2s
    com.evermind.naming.SubContext
    Running the following code in jsp page
    Context ctx = new InitialContext();
    Context jdbc = (Context)ctx.lookup("java:comp/env/jdbc");
              out.println("<BR>" + jdbc.getNameInNamespace() + "<BR>");
              out.println("<BR>" + jdbc.getClass().getName() + "<BR>");
    NamingEnumeration ne = jdbc.listBindings("");
    while (ne.hasMore()) {
    Binding b = (Binding)ne.next();
    String name = b.getName();
    if (dbList.length() > 0)
    dbList.append(',');
    dbList.append(name);
    }

    javax.naming.AuthenticationException: RMIConnection Disconnected
    What could be the possible cause for this exception
    Following are the context details
    [RMI context JavaO2S]/jdbc/jo2s
    com.evermind.naming.SubContext
    Running the following code in jsp page
    Context ctx = new InitialContext();
    Context jdbc = (Context)ctx.lookup("java:comp/env/jdbc");
              out.println("<BR>" + jdbc.getNameInNamespace() + "<BR>");
              out.println("<BR>" + jdbc.getClass().getName() + "<BR>");
    NamingEnumeration ne = jdbc.listBindings("");
    while (ne.hasMore()) {
    Binding b = (Binding)ne.next();
    String name = b.getName();
    if (dbList.length() > 0)
    dbList.append(',');
    dbList.append(name);
    }

Maybe you are looking for

  • Is it possible to install Mountain Lion on a Macbook Pro 2,1

    I've heard it's possible to install Mountain Lion on several unsupported Mac models, but i was wondering if it's possible for the MacBook Pro 2,1 late 2006 model? Here's the link for the unsupported model http://www.karthikk.net/2012/02/15-steps-to-i

  • Step for Adding new condition in Pricing procedure

    Hi,   We have different pricing procedure  with different condition ,  in this procerdure i want to add one new  condition at 2 position and the requirement is that  if system found the value with this condition it should skip the 3 step and directly

  • How to clear/send the failed notifications?

    Hi When i query and checked the wf_notifications table, is shows around 300 notifications that are with failed status. How to fix and send these notifications to the users? The query that i have used is as follows: select notification_id, status, mai

  • ZXF08U06 - userexit coding - Idoc syntax problem.

    I am doing IDOC coding in the userexit <b>ZXF08U06</b> in which I am   modifying values in structure edidd. It was working fine previously. But in further testing we got below error : 26  Error during syntax check of IDoc (outbound). Could you please

  • How to force JEditorPane to be refreshed?

    Dear all, I've problem of refreshing JEditorPane using setPage( ) method. I've written a simple JAVA browser with an analysing system. When a user clicks a hyperlink, the setPage( ) method will be called. Followed by the setPage( ) method, is another