NameAlreadyBoundException...

Hello folks,
I am using the J2ee deploytool to deploy one of my programs when I got this error:
Exception in creating EJB container javax.naming.NameAlreadyBoundException [Root exception is org.omg.CosNaming.NamingContextPackage.AlreadyBound: IDL:omg.org/CosNaming/NamingContext/AlreadyBound:1.0]]
The next entry in the server.log says:
Jndi name conflict found in [TestBeanApp]. Jndi name [TestBean] for bean [TestBean] is already in use.
I have checked all my EJB references, but I couldn't find anything wrong.
Any advice would be very much appreciated. Thanks in advance.

I have solved the problem. It seems that there was a memory leak when I prematurely terminated my program by doing a Ctrl-C.

Similar Messages

  • Jndi-name  javax.naming.NameAlreadyBoundException:

    Hi,
    I am getting the following error while deploying a CMP Bean. Initially
    this started to deploy, but later when I recompiled the source files
    and tried to deploy again, I get the following errors.
    In fact I am tired of trying to see what's actually happening.
    Your immediate response is highly appreciated.
    thanks and regards,
    F S Joseph
    Unable to deploy EJB: country from Country.jar:
    weblogic.ejb20.WLDeploymentException: Unable to bind EJB Home
    Interface to the JNDI name: ejb.CountryHome. The error was:
    javax.naming.NameAlreadyBoundException: Failed to bind remote object
    (ClusterableRemoteRef(127.0.0.1
    null)/292     [cashnet.ejb.CountryHome+javax.ejb.EJBHome+weblogic.ejb.QueryHome+weblogic.ejb20.interfaces.QueryHandler+weblogic.ejb20.interfaces.RemoteHome])
    to replica aware stub at CountryHome(ClusterableRemoteRef(127.0.0.1
    [127.0.0.1/291])/291     [cashnet.ejb.CountryHome+javax.ejb.EJBHome+weblogic.ejb.QueryHome+weblogic.ejb20.interfaces.QueryHandler+weblogic.ejb20.interfaces.RemoteHome]);
    remaining name 'ejb'
         at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:174)
         at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:262)
         at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:229)
         at weblogic.jndi.internal.ServerNamingNode_WLStub.bind(Unknown
    Source)
         at weblogic.jndi.internal.WLContextImpl.bind(WLContextImpl.java:359)
         at weblogic.jndi.internal.WLContextImpl.bind(WLContextImpl.java:353)
         at weblogic.ejb20.deployer.ClientDrivenBeanInfoImpl.activate(ClientDrivenBeanInfoImpl.java:951)
         at weblogic.ejb20.deployer.EJBDeployer.activate(EJBDeployer.java:1302)
         at weblogic.ejb20.deployer.EJBModule.activate(EJBModule.java:342)
         at weblogic.j2ee.J2EEApplicationContainer.activateModule(J2EEApplicationContainer.java:1509)
         at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:970)
         at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:957)
         at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:1074)
         at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:700)
         at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:24)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
         at weblogic.ejb20.deployer.ClientDrivenBeanInfoImpl.activate(ClientDrivenBeanInfoImpl.java:956)
         at weblogic.ejb20.deployer.EJBDeployer.activate(EJBDeployer.java:1302)
         at weblogic.ejb20.deployer.EJBModule.activate(EJBModule.java:342)
         at weblogic.j2ee.J2EEApplicationContainer.activateModule(J2EEApplicationContainer.java:1509)
         at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:970)
         at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:957)
         at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:1074)
         at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:700)
         at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:24)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
    failed application Country on cashnetserver

    there is already an ejb with this name!
    this is set in weblogic-ejb-jar.xml
    Ronak Parekh wrote:
    Unable to deploy EJB: OrganizationEJB from sempire_bc.jar:
    Unable to bind EJB Home Interface to the JNDI name: Organization. The error
    was:
    javax.naming.NameAlreadyBoundException: Organization is already bound;
    remaining
    name 'com.sempire.builder.business_component'
    <<no stack trace available>>

  • Javax.naming.NameAlreadyBoundException:

    Hi
    I am getting following error while
    starting managed server (admin server is already running)
    in a clustered environment.
    "javax.naming.NameAlreadyBoundException:
    AuditTopic is already bound; remaining name 'com.bea.wlpi' "
    even though there is only one entry for "AuditTopic" in config.xml
    I have attached config.xml with this post.
    here is some portion of the server console
    =================================================================
    <Oct 1, 2003 7:41:26 PM IST> <Notice> <AI> <000000> <Started WebLogic Integration
    - AI Ser
    ver version 7.0.2.0>
    javax.naming.NameAlreadyBoundException: AuditTopic is already bound; remaining
    name 'com.b
    ea.wlpi'
    at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:174)
    at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:26
    3)
    at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:23
    0)
    at weblogic.jndi.internal.ServerNamingNode_WLStub.bind(Unknown Source)
    at weblogic.jndi.internal.WLContextImpl.bind(WLContextImpl.java:358)
    at javax.naming.InitialContext.bind(InitialContext.java:353)
    at com.bea.wlpi.server.init.BPMInitBean.ejbCreate(Unknown Source)
    at com.bea.wlpi.server.init.BPMInitBean_ddwui7_Impl.ejbCreate(BPMInitBean_ddwui7_I
    mpl.java:122)
    at java.lang.reflect.Method.invoke(Native Method)
    at weblogic.ejb20.pool.StatelessSessionPool.createBean(StatelessSessionPool.java:1
    51)
    at weblogic.ejb20.pool.Pool.createInitialBeans(Pool.java:188)
    at weblogic.ejb20.manager.StatelessManager.initializePool(StatelessManager.java:37
    5)
    at weblogic.ejb20.deployer.EJBDeployer.initializePools(EJBDeployer.java:1507)
    at weblogic.ejb20.deployer.EJBDeployer.start(EJBDeployer.java:1392)
    at weblogic.ejb20.deployer.EJBModule.start(EJBModule.java:391)
    at weblogic.j2ee.J2EEApplicationContainer.start(J2EEApplicationContainer.java:1039
    at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:1
    025)
    at weblogic.management.deploy.slave.SlaveDeployer.setActivationStateForAllApplicat
    ions(SlaveDeployer.java:617)
    at weblogic.management.deploy.slave.SlaveDeployer.resume(SlaveDeployer.java:376)
    at weblogic.management.deploy.DeploymentManagerServerLifeCycleImpl.resume(Deployme
    ntManagerServerLifeCycleImpl.java:235)
    at weblogic.t3.srvr.ServerLifeCycleList.resume(ServerLifeCycleList.java:65)
    at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:832)
    at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:300)
    at weblogic.Server.main(Server.java:32)
    weblogic.ejb20.WLDeploymentException: AuditTopic is already boundjavax.ejb.CreateException
    : AuditTopic is already bound
    at com.bea.wlpi.server.init.BPMInitBean.ejbCreate(Unknown Source)
    at com.bea.wlpi.server.init.BPMInitBean_ddwui7_Impl.ejbCreate(BPMInitBean_ddwui7_I
    mpl.java:122)
    at java.lang.reflect.Method.invoke(Native Method)
    at weblogic.ejb20.pool.StatelessSessionPool.createBean(StatelessSessionPool.java:1
    51)
    at weblogic.ejb20.pool.Pool.createInitialBeans(Pool.java:188)
    at weblogic.ejb20.manager.StatelessManager.initializePool(StatelessManager.java:37
    5)
    at weblogic.ejb20.deployer.EJBDeployer.initializePools(EJBDeployer.java:1507)
    at weblogic.ejb20.deployer.EJBDeployer.start(EJBDeployer.java:1392)
    at weblogic.ejb20.deployer.EJBModule.start(EJBModule.java:391)
    =================================================================
    Thanks in advance.
    Vijay
    [config.xml]

    In config.xml remove the <Application></Application> tag for Ejb.
    Application Deployed="" Name=""
    Path="">
    <EJBComponent Name="" Targets="" URI=""/> </Application>
    gary <[email protected]> wrote:
    Hi guys, hope you can help:
    I had to change the packages of some ejbs and now when I try to deploy
    the new .jar file I get the error below. I have tried deleting the ejb's
    off the server, rebooted the server and nothing seems to work. Any help
    would be appreciated. (Weblogic version 6.1)
    Thanks in advance,
    Gary
    Unable to deploy EJB: quizinterface from etvquiz-ejb.jar:
    Unable to bind a cluster-aware stateless session EJBObject to the name:
    channel4.quizinterface_EO. Please ensure that the jndi-name in the weblogic-ejb-jar.xml
    is correct. The error was:
    javax.naming.NameAlreadyBoundException: Can't rebind anything but a replica-aware
    stub to a name that is currently bound to a replica-aware stub; remaining
    name ''
    <<no stack trace available>>
    >
    <Nov 1, 2002 1:57:46 PM GMT> <Error> <Management> <Error deploying application
    .\config\mydomain\app
    lications\etvquiz: java.lang.reflect.UndeclaredThrowableException>

  • How to produce NameAlreadyBoundException using a client program?

    Hi,
    I am trying to produce javax.naming.NameAlreadyBoundException using client program. I tried to add differnt objects for the same name repeatedly to produce it. But in vain. here is my code. what is the way to produce it in general. My actual aim is to make sure only one thread places an object in the JNDI. and when another thread tries to place for an object for the same name. I need some exception. Thanks in advance.
    import java.util.Hashtable;ries to p
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NameAlreadyBoundException;
    import javax.naming.NamingException;
    public class TestJNDI {
         private static String JNDI_NAME = "java:comp/env/test";
         public static void main(String[] args) throws NamingException {
              Hashtable<String, String> env = new Hashtable<String, String>();
         env.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
         env.put(Context.PROVIDER_URL,"t3://127.0.0.1:7001");
         Context ctx = new InitialContext(env);
         System.out.println("Initial Context created");
         String obj1 = "obj1";
         String obj2 = "obj2";
              try{
                   ctx.bind(JNDI_NAME, obj1);
                   System.out.println("Bind Sucess");
              }catch(NameAlreadyBoundException ne ){
                   // already bound
                   System.out.println("Name already bound");
              try{
                   ctx.bind(JNDI_NAME, obj2);
                   System.out.println("Re Bind Sucess");
              }catch(NameAlreadyBoundException ne ){
                   // already bound
                   System.out.println("Name already bound");
              String lookedUp = (String) ctx.lookup(JNDI_NAME);
              System.out.println("LookedUp Object"+lookedUp);
    }

    t3 is weblogic proprietary protocol for RMI

  • Javax.naming.NameAlreadyBoundException [LDAP: error code 68

    I am getting the below Error when I am trying to add the entry into the LPAD Server.
    javax.naming.NameAlreadyBoundException: [LDAP: error code 68 - Entry Already Exists]; remaining name 'ou=People,dc=company,dc=co,dc=in'
         at com.sun.jndi.ldap.LdapCtx.mapErrorCode(Unknown Source)
         at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source)
         at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source)
         at com.sun.jndi.ldap.LdapCtx.c_bind(Unknown Source)
         at com.sun.jndi.ldap.LdapCtx.c_bind(Unknown Source)
         at com.sun.jndi.toolkit.ctx.ComponentContext.p_bind(Unknown Source)
         at com.sun.jndi.toolkit.ctx.PartialCompositeContext.bind(Unknown Source)
         at com.sun.jndi.toolkit.ctx.PartialCompositeContext.bind(Unknown Source)
         at javax.naming.InitialContext.bind(Unknown Source)
         at com.test.CreateUser.main(CreateUser.java:54)
    I am using the following sample program to test this.
    public class CreateUser {     
    public static void main(String[] args) {
         java.util.Hashtable env = new java.util.Hashtable();
         env.put( javax.naming.Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory" );
         env.put( javax.naming.Context.PROVIDER_URL, "ldap://c-4966:62260");
         env.put( javax.naming.Context.SECURITY_AUTHENTICATION, "simple");
         env.put( javax.naming.Context.SECURITY_PRINCIPAL, "cn=Directory Manager");
         env.put( javax.naming.Context.SECURITY_CREDENTIALS, "test");
         String dn = "ou=People,dc=company,dc=co,dc=in";     
         try {
         // create DirContext
         DirContext ctx = new InitialDirContext(env);
         // Attributes for new entry
         Attributes attrs = new BasicAttributes();
         Attribute attr = new BasicAttribute("objectclass");
         attr.add( 0, "top" );
         attr.add( 1, "person" );
         attr.add( 2, "organizationalPerson" );
         attr.add( 3, "inetorgperson" );
         attrs.put(attr);
         System.out.println("1...........");           
         attrs.put("cn", "Sai Krishna");
         attrs.put("sn", "Potluri");
         attrs.put("givenName","Sia Potluri");
         attrs.put("uid","saipotluri");
         attrs.put("userPassword", "balaji");
         /*attr = new javax.naming.directory.BasicAttribute("mail");
         attr.add( 0, "[email protected]" );
         attr.add( 1, "[email protected]" );
         attrs.put( attr );
         attrs.put( "telephonenumber", "111-1111-3333" );*/
         System.out.println("2...........");
         ctx.bind(dn, attrs);
         } catch ( javax.naming.NamingException ex ) {
         System.err.println("Fail to Add Entry\n");
         ex.printStackTrace();
    Any help is highly appreciated.
    Thanks in Advance
    DARMA

    You're adding the entry "ou=people,dc=company,dc=co,dc=in" and not an entry under "ou=people,dc=company,dc=co,dc=in".
    The dn of the new entry should be something like "cn=Sai Krishna,ou=people,dc=company,dc=co,dc=in" when you call ctx.bind(dn,...)

  • Javax.naming.NameAlreadyBoundException: localhome is already

    Hi,
    I'm trying to install a clustered environment. I was able to startup the ff:
    1. NodeManager = port 24101
    2. Admin Server = 24102
    However, when i want to startup the managed servers, i'm getting an error....
    The WebLogic Server did not start up properly.
    Exception raised:
    'weblogic.management.configuration.ConfigurationException: -
    with nested exception:
    [javax.naming.NameAlreadyBoundException: localhome is already bound]'
    Reason: weblogic.server.ServerLifecycleException:
    weblogic.management.configuration.ConfigurationException: -
    with nested exception:
    [javax.naming.NameAlreadyBoundException: localhome is already bound]
    Where do you think is the problem?. is there something to do with my configuration of the weblogic? SOS please.

    You're adding the entry "ou=people,dc=company,dc=co,dc=in" and not an entry under "ou=people,dc=company,dc=co,dc=in".
    The dn of the new entry should be something like "cn=Sai Krishna,ou=people,dc=company,dc=co,dc=in" when you call ctx.bind(dn,...)

  • Javax.naming.NameAlreadyBoundException: Failed to bind remote object

    I am getting an error while deploying wli-ejbs.ear file. This ear uses oracle thin drivers to connect to database. But while deploying i am receiving an error as below. Can anyone please help me to solve this problem?
    Deployer:149033]preparing application wli-ejbs on managed2_cvf01
    [Deployer:149033]preparing application wli-ejbs on managed1_cvf01
    [Deployer:149033]prepared application wli-ejbs on managed1_cvf01
    [Deployer:149033]prepared application wli-ejbs on managed2_cvf01
    [Deployer:149033]activating application wli-ejbs on managed1_cvf01
    [Deployer:149033]activating application wli-ejbs on managed2_cvf01
    [Deployer:149034]An exception occurred for task [Deployer:149026]Deploy application wli-ejbs on cvf01_cluster.: weblogic.management.DeploymentException:
    Exception:weblogic.management.ApplicationException: activate failed for calendar/oracle
    Module: calendar/oracle Error: Exception activating module: EJBModule(calendar/oracle,status=PREPARED)
    Unable to deploy EJB: RemoteCalendarBean from calendar/oracle:
    [EJB:011008]Unable to bind EJB Home Interface to the JNDI name: RemoteCalendarBean.
    javax.naming.NameAlreadyBoundException: Failed to bind remote object (ClusterableRemoteRef(704752282736664516S:172.24.206.163:[7003,7003,7004,7004,7003,7004,-1,0,0]:172.24.206.163:7003,172.24.206.163:7003:cvf01:managed1_cvf01 null)/948 [com.bea.wli.calendar.api.BusinessCalendarHome+javax.ejb.EJBHome+weblogic.ejb20.interfaces.RemoteHome]) to replica aware stub at RemoteCalendarBean(ClusterableRemoteRef(704752282736664516S:172.24.206.163:[7003,7003,7004,7004,7003,7004,-1,0,0]:172.24.206.163:7003,172.24.206.163:7003:cvf01:managed1_cvf01 [704752282736664516S:172.24.206.163:[7003,7003,7004,7004,7003,7004,-1,0,0]:172.24.206.163:7003,172.24.206.163:7003:cvf01:managed1_cvf01/944, -8505871579836432025S:172.24.206.163:[7005,7005,7006,7006,7005,7006,-1,0,0]:172.24.206.163:7003,172.24.206.163:7003:cvf01:managed2_cvf01/1008])/944 [com.bea.wli.calendar.api.BusinessCalendarHome+javax.ejb.EJBHome+weblogic.ejb20.interfaces.RemoteHome]); remaining name ''
    at weblogic.rmi.cluster.ClusterableRemoteObject.onBind(ClusterableRemoteObject.java:177)
    at weblogic.jndi.internal.BasicNamingNode.bindHere(BasicNamingNode.java:347)
    at weblogic.jndi.internal.ServerNamingNode.bindHere(ServerNamingNode.java:124)
    at weblogic.jndi.internal.BasicNamingNode.bind(BasicNamingNode.java:291)
    at weblogic.jndi.internal.WLEventContextImpl.bind(WLEventContextImpl.java:279)
    at weblogic.jndi.internal.WLContextImpl.bind(WLContextImpl.java:386)
    at weblogic.ejb20.deployer.ClientDrivenBeanInfoImpl.activate(ClientDrivenBeanInfoImpl.java:1141)
    at weblogic.ejb20.deployer.EJBDeployer.activate(EJBDeployer.java:1385)
    at weblogic.ejb20.deployer.EJBModule.activate(EJBModule.java:631)
    at weblogic.j2ee.J2EEApplicationContainer.activateModule(J2EEApplicationContainer.java:3315)
    at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:2194)
    at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:2167)
    at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.activateContainer(SlaveDeployer.java:2503)
    at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.doCommit(SlaveDeployer.java:2421)
    at weblogic.management.deploy.slave.SlaveDeployer$Task.commit(SlaveDeployer.java:2138)
    at weblogic.management.deploy.slave.SlaveDeployer.commitUpdate(SlaveDeployer.java:676)
    at weblogic.drs.internal.SlaveCallbackHandler$2.execute(SlaveCallbackHandler.java:35)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)

    run the sync.bat file as mentioned in the instructions...
    or through EBCC(select sampleportal-project dir, app name "sampleportal")...
    good luck
    Vijay
    "ellen" <[email protected]> wrote:
    >
    I installed sampleportal and did all the changes according to the documents,
    when
    the server started, there is this error:
    Unable to deploy EJB: CatalogWebService from catalogwe.jar:
    Unable to bind EJB Home Interface to the JNDI name: sampleportal.BEA_commerce.CatalogWebService.
    The error was: javax.naming.nameAlreadyBoundException: Failed to bind remote
    object...to
    replica aware stub at CatalogWebService; remaining name'sampleportal.BEA_commerce'
    After the server started with the above error, I tried to run the app, here
    is what
    occured:
    PortalPersistenceManager: portal'sampleportal/sampleportal' not found.
    Has anybody seen this before?
    Ellen

  • NameAlreadyBoundException for EJB server.

    I got NameAlreadyBoundException for EJB server when I tried to start PNS in VAJave Websphere test Enviornment.
    Any help is appreciated.

    Hi,
    I think you need to stop the Application Server before you start the WebSphere Test Environment.
    If the problem still persist then try changing the port number in PNS.
    Hope this helps.

  • Problem with OpenLDAP and JNDI

    I'm having problem working with OpenLDAP and JNDI.
    First I have changed LDAP's slapd.conf file:
    suffix          "dc=antipodes,dc=com"
    rootdn          cn=Manager,dc=antipodes,dc=com
    directory     "C:/Program Files/OpenLDAP/data"
    rootpw          secret
    schemacheck offthan i used code below, to create root context:
    package test;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.naming.NameAlreadyBoundException;
    import javax.naming.directory.*;
    import java.util.*;
    public class MakeRoot {
         final static String ldapServerName = "localhost";
         final static String rootdn = "cn=Manager,dc=antipodes,dc=com";
         final static String rootpass = "secret";
         final static String rootContext = "dc=antipodes,dc=com";
         public static void main( String[] args ) {
                   // set up environment to access the server
                   Properties env = new Properties();
                   env.put( Context.INITIAL_CONTEXT_FACTORY,
                              "com.sun.jndi.ldap.LdapCtxFactory" );
                   env.put( Context.PROVIDER_URL, "ldap://" + ldapServerName + "/" );
                   env.put( Context.SECURITY_PRINCIPAL, rootdn );
                   env.put( Context.SECURITY_CREDENTIALS, rootpass );
                   try {
                             // obtain initial directory context using the environment
                             DirContext ctx = new InitialDirContext( env );
                             // now, create the root context, which is just a subcontext
                             // of this initial directory context.
                             ctx.createSubcontext( rootContext );
                   } catch ( NameAlreadyBoundException nabe ) {
                             System.err.println( rootContext + " has already been bound!" );
                   } catch ( Exception e ) {
                             System.err.println( e );
    }this worked fine, I could see that by using "LDAP Browser/Editor".
    and then I tried to create group with code:
    package test;
    import java.util.Hashtable;
    import javax.naming.*;
    import javax.naming.ldap.*;
    import javax.naming.directory.*;
    public class MakeGroup
         public static void main (String[] args)
              Hashtable env = new Hashtable();
              String adminName = "cn=Manager,dc=antipodes,dc=com";
              String adminPassword = "secret";
              String ldapURL = "ldap://127.0.0.1:389";
              String groupName = "CN=Evolution,OU=Research,DC=antipodes,DC=com";
              env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
              //set security credentials, note using simple cleartext authentication
              env.put(Context.SECURITY_AUTHENTICATION,"simple");
              env.put(Context.SECURITY_PRINCIPAL,adminName);
              env.put(Context.SECURITY_CREDENTIALS,adminPassword);
              //connect to my domain controller
              env.put(Context.PROVIDER_URL,ldapURL);
              try {
                   // Create the initial directory context
                   LdapContext ctx = new InitialLdapContext(env,null);
                   // Create attributes to be associated with the new group
                        Attributes attrs = new BasicAttributes(true);
                   attrs.put("objectClass","group");
                   attrs.put("samAccountName","Evolution");
                   attrs.put("cn","Evolution");
                   attrs.put("description","Evolutionary Theorists");
                   //group types from IAds.h
                   int ADS_GROUP_TYPE_GLOBAL_GROUP = 0x0002;
                   int ADS_GROUP_TYPE_DOMAIN_LOCAL_GROUP = 0x0004;
                   int ADS_GROUP_TYPE_LOCAL_GROUP = 0x0004;
                   int ADS_GROUP_TYPE_UNIVERSAL_GROUP = 0x0008;
                   int ADS_GROUP_TYPE_SECURITY_ENABLED = 0x80000000;
                   attrs.put("groupType",Integer.toString(ADS_GROUP_TYPE_UNIVERSAL_GROUP + ADS_GROUP_TYPE_SECURITY_ENABLED));
                   // Create the context
                   Context result = ctx.createSubcontext(groupName, attrs);
                   System.out.println("Created group: " + groupName);
                   ctx.close();
              catch (NamingException e) {
                   System.err.println("Problem creating group: " + e);
    }got the error code: Problem creating group: javax.naming.directory.InvalidAttributeIdentifierException: [LDAP: error code 17 - groupType: attribute type undefined]; remaining name 'CN=Evolution,OU=Research,DC=antipodes,DC=com'
    I tried by creating organizational unit "ou=Research" from "LDAP Browser/Editor", and then running the same code -> same error.
    also I have tried code for adding users:
    package test;
    import java.util.Hashtable;
    import javax.naming.ldap.*;
    import javax.naming.directory.*;
    import javax.naming.*;
    import javax.net.ssl.*;
    import java.io.*;
    public class MakeUser
         public static void main (String[] args)
              Hashtable env = new Hashtable();
              String adminName = "cn=Manager,dc=antipodes,dc=com";
              String adminPassword = "secret";
              String userName = "cn=Albert Einstein,ou=Research,dc=antipodes,dc=com";
              String groupName = "cn=All Research,ou=Research,dc=antipodes,dc=com";
              env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
              //set security credentials, note using simple cleartext authentication
              env.put(Context.SECURITY_AUTHENTICATION,"simple");
              env.put(Context.SECURITY_PRINCIPAL,adminName);
              env.put(Context.SECURITY_CREDENTIALS,adminPassword);
              //connect to my domain controller
              env.put(Context.PROVIDER_URL, "ldap://127.0.0.1:389");
              try {
                   // Create the initial directory context
                   LdapContext ctx = new InitialLdapContext(env,null);
                   // Create attributes to be associated with the new user
                        Attributes attrs = new BasicAttributes(true);
                   //These are the mandatory attributes for a user object
                   //Note that Win2K3 will automagically create a random
                   //samAccountName if it is not present. (Win2K does not)
                   attrs.put("objectClass","user");
                        attrs.put("samAccountName","AlbertE");
                   attrs.put("cn","Albert Einstein");
                   //These are some optional (but useful) attributes
                   attrs.put("giveName","Albert");
                   attrs.put("sn","Einstein");
                   attrs.put("displayName","Albert Einstein");
                   attrs.put("description","Research Scientist");
                        attrs.put("userPrincipalName","[email protected]");
                        attrs.put("mail","[email protected]");
                   attrs.put("telephoneNumber","999 123 4567");
                   //some useful constants from lmaccess.h
                   int UF_ACCOUNTDISABLE = 0x0002;
                   int UF_PASSWD_NOTREQD = 0x0020;
                   int UF_PASSWD_CANT_CHANGE = 0x0040;
                   int UF_NORMAL_ACCOUNT = 0x0200;
                   int UF_DONT_EXPIRE_PASSWD = 0x10000;
                   int UF_PASSWORD_EXPIRED = 0x800000;
                   //Note that you need to create the user object before you can
                   //set the password. Therefore as the user is created with no
                   //password, user AccountControl must be set to the following
                   //otherwise the Win2K3 password filter will return error 53
                   //unwilling to perform.
                        attrs.put("userAccountControl",Integer.toString(UF_NORMAL_ACCOUNT + UF_PASSWD_NOTREQD + UF_PASSWORD_EXPIRED+ UF_ACCOUNTDISABLE));
                   // Create the context
                   Context result = ctx.createSubcontext(userName, attrs);
                   System.out.println("Created disabled account for: " + userName);
                   //now that we've created the user object, we can set the
                   //password and change the userAccountControl
                   //and because password can only be set using SSL/TLS
                   //lets use StartTLS
                   StartTlsResponse tls = (StartTlsResponse)ctx.extendedOperation(new StartTlsRequest());
                   tls.negotiate();
                   //set password is a ldap modfy operation
                   //and we'll update the userAccountControl
                   //enabling the acount and force the user to update ther password
                   //the first time they login
                   ModificationItem[] mods = new ModificationItem[2];
                   //Replace the "unicdodePwd" attribute with a new value
                   //Password must be both Unicode and a quoted string
                   String newQuotedPassword = "\"Password2000\"";
                   byte[] newUnicodePassword = newQuotedPassword.getBytes("UTF-16LE");
                   mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, new BasicAttribute("unicodePwd", newUnicodePassword));
                   mods[1] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, new BasicAttribute("userAccountControl",Integer.toString(UF_NORMAL_ACCOUNT + UF_PASSWORD_EXPIRED)));
                   // Perform the update
                   ctx.modifyAttributes(userName, mods);
                   System.out.println("Set password & updated userccountControl");
                   //now add the user to a group.
                        try     {
                             ModificationItem member[] = new ModificationItem[1];
                             member[0]= new ModificationItem(DirContext.ADD_ATTRIBUTE, new BasicAttribute("member", userName));
                             ctx.modifyAttributes(groupName,member);
                             System.out.println("Added user to group: " + groupName);
                        catch (NamingException e) {
                              System.err.println("Problem adding user to group: " + e);
                   //Could have put tls.close()  prior to the group modification
                   //but it seems to screw up the connection  or context ?
                   tls.close();
                   ctx.close();
                   System.out.println("Successfully created User: " + userName);
              catch (NamingException e) {
                   System.err.println("Problem creating object: " + e);
              catch (IOException e) {
                   System.err.println("Problem creating object: " + e);               }
    }same error.
    I haven't done any chages to any schema manually.
    I know I'm missing something crucial but have no idea what. I have tried many other code from tutorials from net, but they are all very similar and throwing the same error I showed above.
    thanks in advance for help.

    I've solved this.
    The problem was that all codes were using classes from Microsoft Active Directory, and they are not supported in OpenLDAP (microsoft.schema in OpenLDAP is just for info). Due to this some fields are not the same in equivalent classes ("user" and "person").
    so partial code for creating user in root would be:
    import java.util.Hashtable;
    import javax.naming.ldap.*;
    import javax.naming.directory.*;
    import javax.naming.*;
    import javax.net.ssl.*;
    import java.io.*;
    public class MakeUser
         public static void main (String[] args)
              Hashtable env = new Hashtable();
              String adminName = "cn=Manager,dc=antipodes,dc=com";
              String adminPassword = "secret";
              String userName = "cn=Albert Einstein,ou=newgroup,dc=antipodes,dc=com";
              env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
              //set security credentials, note using simple cleartext authentication
              env.put(Context.SECURITY_AUTHENTICATION,"simple");
              env.put(Context.SECURITY_PRINCIPAL,adminName);
              env.put(Context.SECURITY_CREDENTIALS,adminPassword);
              //connect to my domain controller
              env.put(Context.PROVIDER_URL, "ldap://127.0.0.1:389");
              try {
                   // Create the initial directory context
                   LdapContext ctx = new InitialLdapContext(env,null);
                   // Create attributes to be associated with the new user
                        Attributes attrs = new BasicAttributes(true);
                                  attrs.put("objectClass","user");
                   attrs.put("cn","Albert Einstein");
                   attrs.put("userPassword","Nale");
                   attrs.put("sn","Einstein");
                   attrs.put("description","Research Scientist");
                   attrs.put("telephoneNumber","999 123 4567");
                   // Create the context
                   Context result = ctx.createSubcontext(userName, attrs);
                   System.out.println("Successfully created User: " + userName);
              catch (NamingException e) {
                   System.err.println("Problem creating object: " + e);
    }hope this will help anyone.

  • Can two EARs contain the same ejb-name?

    Is it possible to have the same entity bean ejb-name in different EARs, referenced
    by different JNDI names?
    a.ear
    JNDI = ejb.a.MyBean
    ejb-name = MyBean
    b.ear
    JNDI = ejb.b.MyBean
    ejb-name = MyBean
    I get
    Unable to bind EJB Home Interface to the JNDI name: foo.MyBean. The error was:
    javax.naming.NameAlreadyBoundException: MyBean is already bound; remaining name
    'ejb.b'
    I'm using local entity beans and it seems they should be local to the EAR. I'm
    using 7.0.
    thanks,
    jeff

    Hi Jeff,
    Local beans are local to JVM not an application/module. If you need to refer them
    by different names for some reason use EJB references (a#mybean sort).
    S
    "Jeff White" <[email protected]> wrote:
    >
    Is it possible to have the same entity bean ejb-name in different EARs,
    referenced
    by different JNDI names?
    a.ear
    JNDI = ejb.a.MyBean
    ejb-name = MyBean
    b.ear
    JNDI = ejb.b.MyBean
    ejb-name = MyBean
    I get
    Unable to bind EJB Home Interface to the JNDI name: foo.MyBean. The
    error was:
    javax.naming.NameAlreadyBoundException: MyBean is already bound; remaining
    name
    'ejb.b'
    I'm using local entity beans and it seems they should be local to the
    EAR. I'm
    using 7.0.
    thanks,
    jeff

  • Can two EARs bind the same ejb?

    Hello,
    Is it possible to use the same entity bean from different EARs?
    I have an entity ejb for the UUP and I want to use the same uup from two different applications, but when the second application is deploying, throws the next exception:
    <BEA-149231> <Unable to set the activation state to true for the application 'secondApplicationEAR'.
    weblogic.application.ModuleException: Exception activating module: EJBModule(myUUP.jar)
    Unable to deploy EJB: MyUUP from myUUP.jar:
    [EJB:011008]Unable to bind EJB Home Interface to the JNDI name: ejb.MyUUPRemoteHome.
    javax.naming.NameAlreadyBoundException: Failed to bind remote object (ClusterableRemoteRef(605920552248037872S:AdminServer [605920552248037872S
    ::AdminServer/301])/301 [uup.MyUUPRemoteHome+javax.ejb.EJBHome+weblogic.ejb20.interfaces.RemoteHome]) to replica aware stub
    at MyUUPRemoteHome(ClusterableRemoteRef(605920552248037872S::AdminServer [605920552248037872S::AdminServer/300])/300 [u
    up.MyUUPRemoteHome+javax.ejb.EJBHome+weblogic.ejb20.interfaces.RemoteHome]); remaining name 'ejb'
    at weblogic.rmi.cluster.ClusterableRemoteObject.onBind(ClusterableRemoteObject.java:201)
    at weblogic.jndi.internal.BasicNamingNode.bindHere(BasicNamingNode.java:371)
    at weblogic.jndi.internal.ServerNamingNode.bindHere(ServerNamingNode.java:140)
    at weblogic.jndi.internal.BasicNamingNode.bind(BasicNamingNode.java:317)
    at weblogic.jndi.internal.BasicNamingNode.bind(BasicNamingNode.java:324)
    at weblogic.jndi.internal.WLEventContextImpl.bind(WLEventContextImpl.java:277)
    at weblogic.jndi.internal.WLContextImpl.bind(WLContextImpl.java:407)
    at weblogic.ejb.container.deployer.ClientDrivenBeanInfoImpl.activate(ClientDrivenBeanInfoImpl.java:1249)
    at weblogic.ejb.container.deployer.EJBDeployer.activate(EJBDeployer.java:1237)
    at weblogic.ejb.container.deployer.EJBModule.activate(EJBModule.java:476)
    at weblogic.application.internal.flow.ModuleListenerInvoker.activate(ModuleListenerInvoker.java:107)
    at weblogic.application.internal.flow.DeploymentCallbackFlow$2.next(DeploymentCallbackFlow.java:411)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
    at weblogic.application.internal.flow.DeploymentCallbackFlow.activate(DeploymentCallbackFlow.java:74)
    at weblogic.application.internal.flow.DeploymentCallbackFlow.activate(DeploymentCallbackFlow.java:66)
    at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:635)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
    at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
    at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:16)
    at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:162)
    at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
    at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:184)
    at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:361)
    at weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:51)
    at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:196)
    at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)
    at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:233)
    at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169)
    at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123)
    at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:173)
    at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:89)
    at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    at weblogic.ejb.container.deployer.EJBModule.activate(EJBModule.java:493)
    at weblogic.application.internal.flow.ModuleListenerInvoker.activate(ModuleListenerInvoker.java:107)
    at weblogic.application.internal.flow.DeploymentCallbackFlow$2.next(DeploymentCallbackFlow.java:411)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
    at weblogic.application.internal.flow.DeploymentCallbackFlow.activate(DeploymentCallbackFlow.java:74)
    Truncated. see log file for complete stacktrace
    I have the myUUP.jar included in the two applications and I working with Weblogic 10.3.
    Could you help me?

    Now, they are deployed successfully.
    I have written distinct names in the <ejb-jndi> property of p13n-profile-config.xml in both applications and I've deleted the <jndi-name> param in weblogic-ejb-jar.xml into my uup jar. It seem is running correctly.
    I had a first application EAR that used an uup. The uup is defined in a Ejb Project. In the firstApplication EAR is defined a dependence on the uup.jar. I'm not an expert in uup (that's obvious) and I need other application, with other content manager and other funcionality, but the same autentication and user properties. This is the reason by I defined a second EAR project with dependencies over the same uup.jar that the first EAR project.
    But I don´t know if it's the most correct...
    Is there a better option?
    Thanks for everything.

  • How to add multiple groups in a single user in ldap

    I have problem with ldap ,Please clarify the following problem.
    My request is --> send the multiple groups at a time with single user.
    My code contain single user and single group is working.
    Please see the source file ,please solve my problem. i tried , but i did not get.
    package com.ldap;
    import java.util.Hashtable;
    import javax.naming.AuthenticationException;
    import javax.naming.Context;
    import javax.naming.NameAlreadyBoundException;
    import javax.naming.NamingException;
    import javax.naming.directory.Attribute;
    import javax.naming.directory.Attributes;
    import javax.naming.directory.BasicAttribute;
    import javax.naming.directory.BasicAttributes;
    import javax.naming.directory.DirContext;
    import javax.naming.directory.InitialDirContext;
    * This class provides methods for the user management
    * @author sudhakar
    public class LdapUserMgr {
         public final static String USER_ID = "uid";
         public final static String COMMONNAME = "cn";
         public final static String SURNAME = "sn";
         public final static String MEMBEROF = "wlsMemberOf";
         public final static String MEMBEROF1 = "wlsMemberOf";
         public final static String PASSWORD = "userpassword";
         public final static String EMAIL = "mail";
         * This method creates new user in the embedded ldap registry
         * @return
         * @throws Exception
         public void createUser() throws Exception {
              DirContext ctx = getLDAPConnection();
              String userId="sudhakar";
              String userName="sudhakar";
              String userRole="Assessor";
              String password="sudhakar123";
              String email="[email protected]";
              try{
                        Attributes attrNew = new BasicAttributes(true);
                        Attribute objclass = new BasicAttribute("objectclass");
                        String group = "ou=groups,ou=myrealm,dc=sudhakar_domain";
                        String people = "ou=people,ou=myrealm,dc=sudhakar_domain";
                        // add all the object classes required for the user profile
                        objclass.add("top");
                        objclass.add("person");
                        objclass.add("organizationalPerson");
                        objclass.add("inetOrgPerson");
                        objclass.add("wlsUser");
                        // put all the attributes required as part of the user profile
                        // add object classes
                        attrNew.put(objclass);
                        // add user Id
                        attrNew.put(USER_ID, userId);
                        // add user common name
                        attrNew.put(COMMONNAME, userName);
                        // add user surname
                        attrNew.put(SURNAME, userName);
                        // prepare the group path for the user
                        String role = COMMONNAME + "=" + userRole + "," + group;
                        // add user to a group
                        attrNew.put(MEMBEROF,role);
                        System.out.println("user role is "+role);
    // i want to pass multiple user roles at a time
                        // add user password
                        attrNew.put(PASSWORD, password);
                        // add user mail Id
                        attrNew.put(EMAIL, email);
                        // Prepare the query string to add the user to the embedded ldap
                        String query = USER_ID + "=" + userId+ "," + people;
                        System.out.println("user query is "+query);
                        // add the user to the LDAP directory
                        ctx.createSubcontext( query, attrNew );
                        System.out.println("user" + userId+ "created");
              catch ( NameAlreadyBoundException nabe ){
                   System.out.println(nabe.getMessage());
                   throw new NameAlreadyBoundException("User by this name already exits");
              catch (NamingException namEx) {
                   System.out.println(namEx.getMessage());
              catch(Exception ex){
                   System.out.println(ex.getMessage());
              finally{
                   closeLDAPConnection(ctx);
         public DirContext getLDAPConnection() throws Exception{
              DirContext ctx = null;
              try{
                   Hashtable<String,String> env = new Hashtable<String,String>();
                   env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
                   env.put(Context.PROVIDER_URL, "ldap://192.168.100.84:7030/");
                   env.put(Context.SECURITY_AUTHENTICATION, "simple");
                   env.put(Context.SECURITY_PRINCIPAL, "cn=Admin");
                   env.put(Context.SECURITY_CREDENTIALS,"admin");
                   // Create the initial directory context
                   ctx = new InitialDirContext(env);
         return ctx;
              catch (AuthenticationException authEx){
                   System.out.println(authEx.getMessage());
              throw new AuthenticationException("Authentication failed");
              catch (NamingException namEx) {
                   System.out.println(namEx.getMessage());
              throw new NamingException("Naming Exception");
              catch(Exception ex){
                   System.out.println(ex.getMessage());
              throw new Exception("Exception Occured");
         * This method closes the LDAP connection
         * @param ctx
         public void closeLDAPConnection(DirContext ctx){
              try{
                   ctx.close();
              catch(NamingException nex){
                   System.out.println(nex.getMessage());
              catch(Exception ex){
                   System.out.println(ex.getMessage());
         public static void main(String s[])throws Exception{
              LdapUserMgr ldapUserMgr = new LdapUserMgr();
              ldapUserMgr.createUser();
    Edited by: sudhakar_kavuru on Jun 16, 2009 1:58 AM

    Hi Sudhakar,
    try some thing like this.Here I have enclosed the code snippet.
         String query = USER_ID + "=" + user.getUserId()+ "," + people;
                        // add the user to the LDAP directory
    //                    ctx.createSubcontext( query, attrNew );
                        Attribute att1 = new BasicAttribute(MEMBEROF);
                        String roleName=user.getUserRoleList().get(0);
                        String role1 = COMMONNAME + "="+roleName+"," + group;
                        att1.add(role1);
                        attrNew.put(att1);
                        DirContext dirContext =ctx.createSubcontext( query, attrNew );
                        for (int i = 1; i < user.getUserRoleList().size(); i++) {
                             Attributes att2 = new BasicAttributes();
                             String roleNameStr=user.getUserRoleList().get(i);
                             log.debug("roleNameStr--->"+roleNameStr);
                             String role2 = COMMONNAME + "="+roleNameStr+"," + group;
                             log.debug("role2-->"+role2);
                             att2.put(MEMBEROF,role2);
                             dirContext.modifyAttributes("", DirContext.ADD_ATTRIBUTE, att2);
                        }

  • Error during running application

    Hi Folks,
    I have developed CustomerProject having a servlet looking up CustomerSession bean calling CustomerEntitybean.
    For developing this I used Netbean5.0 and SunoneApplicationserver8.2.After building this when I run the application for first time.It worked well.When I added some more business methods in the bean and started running its giving the following error.Please help me what might be the problem.How to solve it
    [b][#|2006-05-23T13:09:03.613-0500|WARNING|sun-appserver-pe8.2|javax.enterprise.system.core|_ThreadID=10;|CORE5021: Application NOT loaded: [order]|#]
    [#|2006-05-23T13:09:03.803-0500|INFO|sun-appserver-pe8.2|javax.enterprise.system.container.ejb|_ThreadID=10;|Instantiated container for: ejbName: CustomerFacadeBean; containerId: 75261912075403265|#]
    [#|2006-05-23T13:09:03.823-0500|SEVERE|sun-appserver-pe8.2|javax.enterprise.system.container.ejb|_ThreadID=10;|EJB5090: Exception in creating EJB container [javax.naming.NameAlreadyBoundException [Root exception is org.omg.CosNaming.NamingContextPackage.AlreadyBound: IDL:omg.org/CosNaming/NamingContext/AlreadyBound:1.0]]|#]
    [#|2006-05-23T13:09:03.823-0500|SEVERE|sun-appserver-pe8.2|javax.enterprise.system.container.ejb|_ThreadID=10;|appId=customerbook moduleName=CustomerBook-EJBModule_jar ejbName=CustomerFacadeBean|#]
    [#|2006-05-23T13:09:03.833-0500|SEVERE|sun-appserver-pe8.2|javax.enterprise.system.core.classloading|_ThreadID=10;|LDR5012: Jndi name conflict found in [customerbook]. Jndi name [ejb/CustomerFacadeBean] for bean [CustomerFacadeBean] is already in use.|#]
    [#|2006-05-23T13:09:03.833-0500|SEVERE|sun-appserver-pe8.2|javax.enterprise.system.core.classloading|_ThreadID=10;|LDR5013: Naming exception while creating EJB container:
    javax.naming.NameAlreadyBoundException [Root exception is org.omg.CosNaming.NamingContextPackage.AlreadyBound: IDL:omg.org/CosNaming/NamingContext/AlreadyBound:1.0 ]
    at com.sun.jndi.cosnaming.ExceptionMapper.mapException(ExceptionMapper.java:74)
    at com.sun.jndi.cosnaming.CNCtx.callBindOrRebind(CNCtx.java:563)
    at com.sun.jndi.cosnaming.CNCtx.bind(CNCtx.java:588)
    at javax.naming.InitialContext.bind(InitialContext.java:359)
    at com.sun.enterprise.naming.NamingManagerImpl.publishObject(NamingManagerImpl.java:176)
    at com.sun.enterprise.naming.NamingManagerImpl.publishObject(NamingManagerImpl.java:146)
    at com.sun.ejb.containers.BaseContainer.initializeHome(BaseContainer.java:622)
    at com.sun.ejb.containers.StatelessSessionContainer.initializeHome(StatelessSessionContainer.java:187)
    at com.sun.ejb.containers.ContainerFactoryImpl.createContainer(ContainerFactoryImpl.java:287)
    at com.sun.enterprise.server.AbstractLoader.loadEjbs(AbstractLoader.java:481)
    at com.sun.enterprise.server.ApplicationLoader.load(ApplicationLoader.java:125)
    at com.sun.enterprise.server.TomcatApplicationLoader.load(TomcatApplicationLoader.java:95)
    at com.sun.enterprise.server.AbstractManager.load(AbstractManager.java:185)
    at com.sun.enterprise.server.ApplicationLifecycle.onStartup(ApplicationLifecycle.java:200)
    at com.sun.enterprise.server.ApplicationServer.onStartup(ApplicationServer.java:300)
    at com.sun.enterprise.server.PEMain.run(PEMain.java:294)
    at com.sun.enterprise.server.PEMain.main(PEMain.java:220)
    Caused by: org.omg.CosNaming.NamingContextPackage.AlreadyBound: IDL:omg.org/CosNaming/NamingContext/AlreadyBound:1.0
    at org.omg.CosNaming.NamingContextPackage.AlreadyBoundHelper.read(AlreadyBoundHelper.java:60)
    at org.omg.CosNaming._NamingContextStub.bind(_NamingContextStub.java:67)
    at com.sun.jndi.cosnaming.CNCtx.callBindOrRebind(CNCtx.java:552) ... 15 more
    |#]------------------------------------------------------------------------
    Dont know where to bind or rebind if there is any naming exception.I just created service locator..but i dont know where to rebind it
    Please help regarding this.Appreciate your time
    Thanks,
    Siris

    The global JNDI name assigned to each Remote EJB in sun-ejb-jar.xml must be unique across all the applications deployed to the application server. This message shows that more than Remote ejb uses the global JNDI name "ejb/CustomerFacadeBean" :
    #|2006-05-23T13:09:03.833-0500|SEVERE|sun-appserver-pe8.2|javax.enterprise.sys tem.core.classloading|_ThreadID=10;|LDR5012: Jndi name conflict found in [customerbook]. Jndi name [ejb/CustomerFacadeBean] for bean [CustomerFacadeBean] is already in use.|#]
    Double-check all your sun-ejb-jar.xmls to remove the conflict , then undeploy all your apps and deploy again.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Need Help creating new user in Active Directory

    I am trying to create a new user in active directory via a java application. I have included the code that I am using. I am able to successfully bind to Active Directory. I have been able to change passwords, and delete users, but I have not been able to create a user.
    ldapHost : "mta101.DOM101.CEL.ACC.AF.MIL"
    domainName: "dc=dom101,dc=cel,dc=acc,dc=af,dc=mil"
    existing account: CN=Brett K. Humpherys,OU=Users,OU=CEL
    I get the following error on the createSubcontext statement:
    javax.naming.directory.InvalidAttributeValueException: [LDAP: error code 21 - 00000057: LdapErr: DSID-0C09098B, comment: Error in attribute conversion operation, data 0, v893 ; remaining name 'CN=test1,OU=Users,OU=CEL'
    I have commented out the password portion and change the ObjectCategory to a 32 and get the same error.
        public GblStatus createAccount7(DbaDb dbConn,
                                        String jsrcName,
                                        String personName,
                                        String username,
                                        String password)
          Hashtable ldapEnv = new Hashtable(11);
          ldapEnv.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
          ldapEnv.put(Context.PROVIDER_URL, "ldap://" + this.ldapHost + ":636");
          ldapEnv.put(Context.SECURITY_AUTHENTICATION, "simple");
          ldapEnv.put(Context.SECURITY_PROTOCOL, "ssl");
          ldapEnv.put(Context.REFERRAL, "ignore");
          ldapEnv.put(Context.SECURITY_PRINCIPAL,"cn=" + this.adminAcct + ",cn=users," + this.domainName);
          ldapEnv.put(Context.SECURITY_CREDENTIALS, this.adminPwd);
           try
            // Create the initial context
            DirContext ctx = new InitialDirContext(ldapEnv);
            BasicAttributes attrs = new BasicAttributes();
            BasicAttribute ocs = new BasicAttribute("objectclass");
            ocs.add("top");
            ocs.add("person");
            ocs.add("organizationalPerson");
            ocs.add("user");
            attrs.put(ocs);
            BasicAttribute gn = new BasicAttribute("givenName", "test1");
            attrs.put(gn);
            BasicAttribute sn = new BasicAttribute("sn", "");
            attrs.put(sn);
            BasicAttribute cn = new BasicAttribute("cn", "test1");
            attrs.put(cn);
            BasicAttribute uac = new BasicAttribute("userAccountControl", "66048");
            attrs.put(uac);
            BasicAttribute sam = new BasicAttribute("sAMAccountName", "test1");
            attrs.put(sam);
            BasicAttribute disName = new BasicAttribute("displayName", "test1");
            attrs.put(disName);
            BasicAttribute userPrincipalName = new BasicAttribute
                                          ("userPrincipalName", "[email protected]");
            attrs.put(userPrincipalName);
            BasicAttribute instanceType = new BasicAttribute("instanceType", "4");
            attrs.put(instanceType);
            BasicAttribute objectCategory = new BasicAttribute
                      ("objectCategory","CN=User,CN=Schema,CN=Configuration," + domainName);
            attrs.put(objectCategory);
            String newVal = new String("\"password\"");
            byte _bytes[] = newVal.getBytes("Unicode");
    byte bytes[] = new byte[_bytes.length - 2];
    System.arraycopy(_bytes, 2, bytes, 0, _bytes.length - 2);
    BasicAttribute attribute = new BasicAttribute("unicodePwd");
    attribute.add((byte[]) bytes);
    attrs.put(attribute);
    ctx.createSubcontext("CN=test1,OU=Users,OU=CEL", attrs);
    ctx.close();
    catch (NameAlreadyBoundException nex)
    System.out.println("User ID is already in use, please select a different user ID ...");
    catch (Exception ex)
    System.out.println("Failed to create user account... Please verify the user information...");
    ex.printStackTrace();
    return new GblStatus();
    Any help would be much appreciated.

    Hi .,
    me too got up with same problem., can anyone help me.??
    Someone help me to create attributes in AD using LDAP
    package LDAPpack;
    import javax.naming.*;
    import javax.naming.directory.*;
    import javax.naming.ldap.InitialLdapContext;
    import javax.naming.ldap.LdapContext;
    import java.util.Hashtable;
    class CreateAttrs {
    public static void main(String[] args) {
         Hashtable env = new Hashtable();
              env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
              env.put(Context.PROVIDER_URL, "ldap://10.242.6.166:389/");
              env.put(Context.SECURITY_AUTHENTICATION,"simple");
              env.put(Context.SECURITY_PRINCIPAL, "CN=cname,OU=Users,OU=Dealer,OU=Community,DC=test2,DC=org");
                        env.put(Context.SECURITY_CREDENTIALS, "password-1");
              LdapContext ctx =null;
              try {
                   //ctx = new InitialLdapContext(env,null);
                   try {
    ctx = new InitialLdapContext(env,null);
                   catch(NamingException e) {
    System.out.println("Login failed");
    System.exit(0);
    if(ctx!=null){              
    System.out.println("Login Successful");
    byte[] buf = new byte[] {0, 1, 2, 3, 4, 5, 6, 7}; // same data
         // Create a multivalued attribute with 4 String values
         BasicAttribute oc = new BasicAttribute("objectClassNew", "topNew");
         oc.add("personNew");
         oc.add("organizationalPersonNew");
         // Create an attribute with a byte array
         BasicAttribute photo = new BasicAttribute("jpegPhotoNew", buf);
         // Create attribute set
         BasicAttributes attrs = new BasicAttributes(true);
         attrs.put(oc);
         attrs.put(photo);
         Attributes attrs1 = ctx.getAttributes("CN=cname,OU=Users,OU=Dealer,OU=Community,DC=test2,DC=org");
    System.out.println(attrs1);
    Context result = ctx.createSubcontext("CN=cname,OU=Users,OU=Dealer,OU=Community,DC=test2,DC=org", attrs);
    //i got error here; i attach the error below.
         ctx.close();
    System.out.println("close");
         catch(NamingException e){
              e.printStackTrace();
    ERROR:
    Login Successful
    javax.naming.directory.NoSuchAttributeException: [LDAP: error code 16 - 00000057: LdapErr: DSID-0C090B38, comment: Error in attribute conversion operation, data 0, vece
    ANYONE HELP ME PLS.
    Edited by: vencer on Jun 19, 2008 12:38 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Problem with JSF 1.2 and Tomcat 6

    Hello guys,
    I have here:
    Tomcat 6.0.10
    JSF 1.2_04_b10_p01
    I followed these steps without success:
    http://forum.java.sun.com/thread.jspa?threadID=787962
    http://forum.java.sun.com/thread.jspa?threadID=5156242
    Here what I did:
    1) Removed the following line in $TOMCAT_HOME/conf/server.xml
    <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />2) Add the following lines to $TOMCAT_HOME/conf/web.xml
         <context-param>
         <param-name>com.sun.faces.expressionFactory</param-name>
         <param-value>org.apache.el.ExpressionFactoryImpl</param-value>
         </context-param>3) Add the following libs to $TOMCAT_HOME/lib
    jsf-api.jar
    jsf-impl.jar
    jstl-1.2.jar
    4) Add the following lines to $MYAPP/WEB-INF/web.xml
         <listener>
              <listener-class>
                   com.sun.faces.config.ConfigureListener
              </listener-class>
         </listener>
         <listener>
              <listener-class>
                   com.sun.faces.application.WebappLifecycleListener
              </listener-class>
         </listener>And here is "the final product":
    INFO: Initializing Sun's JavaServer Faces implementation (1.2_04-b10-p01) for context '/protocolo'
    10/04/2007 08:18:47 com.sun.faces.config.ConfigureListener registerELResolverAndListenerWithJsp
    SEVERE: Error Instantiating ExpressionFactory
    java.lang.ClassCastException: org.apache.el.ExpressionFactoryImpl cannot be cast to javax.el.ExpressionFactory
         at com.sun.faces.config.ConfigureListener.registerELResolverAndListenerWithJsp(ConfigureListener.java:1563)
         at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:419)
         at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
         at org.apache.catalina.core.StandardContext.start(StandardContext.java:4336)
         at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:761)
         at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:741)
         at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
         at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:825)
         at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:714)
         at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490)What I need to do? Someone can help me?
    Thank you.

    Thank you for the answer rlubke,
    Well this happened because I had compiled the project with the jstl-1.1
    The workaround to make jsf 1.2 run on tomcat 6 really works.
    But now I have a problem because the JNDI tree in tomcat is read-only ( ro )
    and I need to bind a object in the JNDI so an exception happens:
    WARNING: Ocorreu um erro inexperado:
    javax.naming.NamingException: Context is read only
             at org.apache.naming.NamingContext.checkWritable(NamingContext.java:903)
             at org.apache.naming.NamingContext.bind(NamingContext.java:831)
             at org.apache.naming.NamingContext.bind(NamingContext.java:171)
             at org.apache.naming.NamingContext.bind(NamingContext.java:187)
             at org.apache.naming.SelectorContext.bind(SelectorContext.java:171)
             at javax.naming.InitialContext.bind(InitialContext.java:400)Here is the code:
    try{
         Context newContext = new InitialContext();
         newContext.bind( dataSourceWrappedID, wrappedDs );
         newContext.close();
    }catch(NameAlreadyBoundException nabe){
         // ok no problem..
    }catch(NamingException ne){
         if ( log.isWarnEnabled() ){
              log.warn("Ocorreu um erro inexperado:", ne);
    }You know how to make the JNDI tree in tomcat read-write ?
    Thank you a ton. :-)

Maybe you are looking for