5 Replies Latest reply on May 27, 2008 1:41 PM by Peter Johnson

    Java API

    Dave Johnson Newbie

      I am getting the following error when while using Eclipse/JBoss. Can anyone help in pointing me to a solution? Help is greatly appreciated.



      log4j:WARN The log4j system is not properly configured!
      log4j:WARN All ERROR messages will be sent to the system console until proper configuration has been detected.
      com.filenet.api.exception.EngineRuntimeException: API_UNEXPECTED_JNDI_ERROR: An unexpected error occured accessing JNDI.
      at com.filenet.apiimpl.util.SessionLocator.locateEJBByPath(SessionLocator.java:789)
      at com.filenet.apiimpl.util.SessionLocator.findEJBSessionByPath(SessionLocator.java:724)
      at com.filenet.apiimpl.util.SessionLocator.createNewSession(SessionLocator.java:510)
      at com.filenet.apiimpl.util.SessionLocator.getSession(SessionLocator.java:133)
      at com.filenet.apiimpl.core.IndependentObjectImpl.getObject(IndependentObjectImpl.java:153)
      at com.filenet.apiimpl.core.IndependentObjectImpl.refresh(IndependentObjectImpl.java:161)
      at com.filenet.api.core.Factory$Domain.fetchInstance(Factory.java:2724)
      at com.ibm.filenet.edu.CEConnectionEDU.getDomainEDU(CEConnectionEDU.java:29)
      at com.ibm.filenet.edu.CEConnectionEDU.main(CEConnectionEDU.java:69)
      Caused by: javax.naming.CommunicationException: Could not obtain connection to any of these urls: iiop://host:12345 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to connect to server iiop:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server iiop:1099 [Root exception is java.net.UnknownHostException: iiop: iiop]]]
      at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1414)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:594)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
      at javax.naming.InitialContext.lookup(Unknown Source)
      at com.filenet.apiimpl.util.SessionLocator.locateEJBByPath(SessionLocator.java:778)
      ... 8 more
      Caused by: javax.naming.CommunicationException: Failed to connect to server iiop:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server iiop:1099 [Root exception is java.net.UnknownHostException: iiop: iiop]]
      at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:269)
      at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1385)
      ... 12 more
      Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server iiop:1099 [Root exception is java.net.UnknownHostException: iiop: iiop]
      at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:243)
      ... 13 more
      Caused by: java.net.UnknownHostException: iiop: iiop
      at java.net.InetAddress.getAllByName0(Unknown Source)
      at java.net.InetAddress.getAllByName0(Unknown Source)
      at java.net.InetAddress.getAllByName(Unknown Source)
      at java.net.InetAddress.getByName(Unknown Source)
      at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:76)
      at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:239)
      ... 13 more






        • 1. Re: Java API
          Peter Johnson Master

          Looks like you are using IBM/FileNet classes to do your JNDI lookups. What are the contents of you jndi.properties? Also, post the code you are using to do the lookup (include the properties if you are setting any).

          • 2. Re: Java API
            Dave Johnson Newbie

            jndi.properties
            java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
            java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
            java.naming.provider.url=jnp://localhost:1099

            VM Arguments (Using Eclipse)
            -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
            -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
            -Djava.naming.provider.url=jnp://localhost:1099
            -Djava.security.auth.login.config="C:\Documents and Settings\ben_dehaan\Desktop\P8API\jaas.conf.JBoss"

            Code

            package com.ibm.filenet.edu;
            
            import java.util.Iterator;
            import javax.security.auth.Subject;
            
            import com.filenet.api.collection.ObjectStoreSet;
            import com.filenet.api.constants.*;
            import com.filenet.api.core.*;
            import com.filenet.api.util.UserContext;
            
            public class CEConnectionEDU {
            
            public Connection getCEConnectionEDU()
            {
             String uri = "iiop://host:8080/FileNet/Engine";
             String username = "User";
             String password = "Pass";
             Connection conn = Factory.Connection.getConnection(uri);
             Subject subject = UserContext.createSubject( conn, username, password, null);
             UserContext uc = UserContext.get();
             uc.pushSubject(subject);
            
             return conn;
            }
            
            public Domain getDomainEDU(Connection conn)
            {
             String domainName = "P8Dom";
             Domain domain = Factory.Domain.fetchInstance(conn, domainName, null);
             System.out.println("Domain Name is: "+ domain.get_Name());
             return domain;
            }
            
            public void getObjectStoresEDU(Domain domain)
            {
             ObjectStoreSet osSet = domain.get_ObjectStores();
             ObjectStore store;
             Iterator osIter = osSet.iterator();
             System.out.println("Available Object Stores: ");
             while (osIter.hasNext())
             {
             store = (ObjectStore)osIter.next();
             System.out.println(store.get_Name());
             }
            }
            
            public ObjectStore getObjectStoreEDU (Domain domain, String objectStoreName)
            {
            
             ObjectStore store = Factory.ObjectStore.fetchInstance(domain, objectStoreName,null); System.out.println("Objectstore is: "+ store.get_Name());
             return store;
            }
            
            public Folder getFolderEDU(ObjectStore store, String folderName){
            
             Folder folder= Factory.Folder.fetchInstance(store,folderName, null);
             folderName = folder.get_FolderName();
             System.out.println(folderName + " folder has been retrieved");
             return folder;
            
             }
            
             public static void main(String[] args)
             {
             try{
            
             CEConnectionEDU myInstance = new CEConnectionEDU();
             Connection conn = myInstance.getCEConnectionEDU();
             Domain domain = myInstance.getDomainEDU(conn);
             myInstance.getObjectStoresEDU(domain);
            
             } catch (Exception e) {
             e.printStackTrace();
             }
            
            
             }
            }


            • 3. Re: Java API
              Peter Johnson Master

              Unfortunately, I have no idea what com.filenet.api.util.UserContext.createSubject() does, but it is apparently using the URI passed as the JNDI host name.

              A typical JNDI lookup, using the jndi.properties file you gave (porvided that properties file is in the classpath) looks like:

              javax.naming.Context ctx = new javax.naming.InitialContext();
              Object obj = ctx.lookup("some-jndi-name");

              Nothing in your code looks like this.

              • 4. Re: Java API
                Dave Johnson Newbie

                Below you had mention ...lookup("some jndi name").. Does mean doing something like ..lookup("jndi.properties") or were you meaning something different? If so, can you explain a little more in detail? Thank you for the help by the way.


                Here is what my classpath looks like...

                <?xml version="1.0" encoding="UTF-8"?>
                <classpath>
                 <classpathentry kind="src" path="src"/>
                 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/APIJRE"/>
                 <classpathentry kind="lib" path="C:/Documents and Settings/ben_dehaan/Desktop/TEMPAPI/jboss-j2ee.jar"/>
                 <classpathentry kind="lib" path="C:/Documents and Settings/ben_dehaan/Desktop/TEMPAPI/log4j-1.2.13.jar"/>
                 <classpathentry kind="lib" path="C:/Documents and Settings/ben_dehaan/Desktop/TEMPAPI/Jace.jar"/>
                 <classpathentry kind="lib" path="C:/Documents and Settings/ben_dehaan/Desktop/TEMPAPI/jbossall-client.jar"/>
                 <classpathentry kind="lib" path="C:/Documents and Settings/ben_dehaan/Desktop/TEMPAPI/src/com/ibm/filenet/edu/jndi.properties"/>
                 <classpathentry kind="output" path="bin"/>
                </classpath>


                • 5. Re: Java API
                  Peter Johnson Master

                  No, by lookup("some-jndi-name") I do not mean looking up the properties file. I meant looking up an object in the JNDI tree using the name of that object. For example, if I have an EJB whose JNDI name is "my/ejb", I would use lookup("my/ejb").

                  One suggestion - don't use or work from directories with spaces in their names - some Java libraries will trip over the spaces. This is not causing a problem here, but you could trip over this later.