JNDI auto-Bind on Startup

I have a EJB 3 application that is using JNDI to use an LDAP server. However the application will be deployed in an environment where the LDAP server information (especially authentication) will not be available to it.
I have read that JNDI does not persist objects across server shutdown, so what I'd like to do is store the LDAP server specifics in a config file that will automatically be bound to the JNDI start when JBOSS starts. Ideally this would not require me to know anything about the implementation environment and could be a 'hands off' approach where as long as the file exists in the JBOSS directory the names will automatically bind.
Is there a way to bind a JNDI object at JBOSS startup (similar to the way you would define a datasource) in a seperate file and then lookup that predefined object, extract the LDAP server information and use it?
I am imagining something along the lines of this
InitialContext ctx = new InitialContext();
LDAPConfigParams configParams = (LDAPConfigParams) ctx.lookup( "LDAPParams" );
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, configParams.getContextFactory());
env.put(Context.PROVIDER_URL, configParams.getUrl());
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, configParams.getUserName());
env.put(Context.SECURITY_CREDENTIALS, configParams.getPassword());
env.put("java.naming.ldap.attributes.binary", "objectGUID");
InitialContext ldapContext = new InitialContext( env );
// use ldapContext as normal here

Although no one was able to help me, the lack of responses inspired me to look into other solutions.
JBoss supports JMX through mbeans. mbeans are managed by JBoss at startup time. There are (at least) two types of mbeans available in JBoss. I decided to extend a SubDeployerSupport mbean and implementing the XSLSubDeployerMBean. This enables me to get a hook into each new item being deployed (file added/modified) into the deploy directory.
You can configure the files it looks at by overriding the accepts(DeploymentInfo) method to filter out files that don't match on the particular suffix your interested in.
I created a custom xml file for my LDAP data sources that has the extension -ldap.xml, and configured my accepts function to trigger init on these types of functions. This gives me a hook into the config files of type -ldap.xml (either at boot or redeploy). I can then extract the XML and create JNDI objects corresponding to my LDAP config.
The only downside to this is that it ties me to the JBoss application server. Can anyone suggest a similar way to do this without requiring JBoss?

Similar Messages

  • ITunes auto launches on startup (no iPod/Phone connected)

    For the last couple of weeks (perhaps longer) I've noticed iTunes launches itself whenever I restart my MacBook Pro.
    There is no iPhone connected at the time.
    Everything is up to date in software.
    I've removed iTunes helper from my login items.
    I'm at a loss.
    Your assistance in resolving this matter would be very much appreciated.
    Cheers!
    Darcy

    I just tried restarting again, this time with iTunes last closed on my music tab rather than the store tab, where I realized it had been parked for some time.
    iTunes still auto launched on startup, though after a longer delay than usual.
    AND after I quit iTunes, it auto launched itself again. That was a first.
    For what it's worth.

  • Stop auto launching at startup??

    How do I get Spotify to stop auto launching at startup of my desktop?  I have looked all over and cannot find the option.
    Thanks.

    Here's another "me too" followed by what I've done so far. In Windows 7, about three weeks ago my Spotify started loading at startup.I checked preferences, for some reason the option had changed on its own to load at startup. I reset to "do NOT load" at startupThe next time I rebooted, it started up on its own again. I checked settings, they had changed back again. Again I fixed my preferencesThe NEXT time I rebooted, it happened again! This time I not only changed the setting back to NOT load at startup, I also opened MSCONFIG and checked the TWO, count-em, TWO entries of Spotify to prevent loading at startup. Pop up box suggested restartiing the computer. I did, no Spotify loaded. Yay...for now...however,Two hours later I took my laptop with me on a business visit. When I turned on the computer, Spotify loaded AGAIN.I again opened MSCONFIG and found FOUR, count-em, FOUR entries of Spotify I had to check to prevent loading at startup.This is getting very frustrating. It's my belief that some recent upgrade to Spotify is causing this, as it only started a few weeks ago. Someone with Spotify needs to check into this! Help me Obi Wan!!

  • ER: restricting auto binded objects types 11g.

    When we want to create an autobind between a backing bean and a JSF web page, bindings code is created for all object on the page. Even panel box, faced etc.
    There is many lines of code on backing bean. We d'ont even use one time for many object type.
    In general we use input text, list item etc. Others are unnecessery.
    In my opinion if there is a configuration which supplies to chose binded item types it will be very good.
    lines of code will be decreased in backing bean and complexy is decreased too.
    For example just input test item can be autobind.
    Thanks.

    Hi,
    When I first started out with this, I thought the autobind function was pretty neat as I thought it would save me time and effort from having to bind objects myself. Boy, was I wrong. Adding/removing anything from the Jspx page while debugging requires a restart. That was enough to stop me from using it further.
    When you create a new JSF Page, click on *"Page Implementation"* and make sure you have the *"Do Not Automatically Expose UI Components in a Managed Bean"* selected. That way, you won't get into the trouble you are in. I agree with Frank that you should only bind components when and if you need to only. If you have already created the page and would like it to stop automatically binding each UI component, follow the steps below:
    1) Open your JSPX page in source code view, remove the commented line below.
    <!--oracle-jdev-comment:auto-binding-backing-bean-name:backingBeanYours-->Optionally, you can replace it with the following code to point to your managed bean that handles the user actions.
    <!--oracle-jdev-comment:preferred-managed-bean-name:managedBeanYours-->2) Open faces-config.xml in source code view, and look for your backingBean that is auto Binding each UI component. Within its <managed-bean>...</managed-bean> tags, you will see another oracle-jdev comment like the one below. Remove that as well.
    <!--oracle-jdev-comment:managed-bean-jsp-link:1YourPage.jspx-->JDev should stop autobinding / removing UI components from the backing bean now.
    Regards,
    Chan Kelwin

  • Can I select which components will have auto binding turned on?

    To be honest, the only reason I don't use JDeveloper full time is due to this reason only.
    Can I select which components will have auto binding turned on?
    I don't see the need or reason to bind every single component in the page to your backing bean.
    This can clutter up your backing bean and all the searching for the bindings that I do care about is a real time waster.
    I've looked at the preferences and settings without much luck, thus I'd appreciate any thoughts on this topic.
    Thanks,
    --Todd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    To make sure I understand your response, your refering to Managed Beans as your Backing Beans - I thought the two were the same thing.
    Moving on, that is a good idea and I'll try it right now in a test project.
    Thanks,
    --Todd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • AUto-binding via DHCP LDAP info

    In OSX 10.5 (client) there was an option in Directory Utility called "Add DHCP-supplied LDAP servers to automatic search policies". 10.6 (client) doesn't appear to have this option.
    Can anyone tell me if I can set 10.6 clients to auto-bind to an OD domain based on DHCP info or do I need to manually join from each client (and then re-join if the server name changes)?

    Looks like this feature has been discontinued.
    http://support.apple.com/kb/HT3844
    I've very disappointed as I've come to rely on this feature at many of the school districts that I manage.
    There are ways to script binding to a server, but I loved the DHCP feature as I could change out an LDAP server during a school year and just update DHCP in one place to switch all of my clients to the new server.
    -Henry

  • How add auto binding backing bean to a jspx page

    A few times during development, I didn't check "automatically expose UI components to in a manage bean" when the jspx page was first created.
    Can someone tell if there is a way to add auto binding backing bean to the page later?
    Thanks

    Hi Deborah,
    when your JSPX page is active, select menu Design -> Page Properties...
    Click Tab Component Binding
    Select Auto Bind and select (or create with New) your Managed Bean
    Regards,
    Didier.

  • Auto Bind in OMB*Plus

    Hello,
    Can I use the "auto bind" feature to bind a dimension to a table from OMB*plus? How? Or do I need to map it all manually if I want to script it?
    rergards,

    You can use autobind from scripting also, so construct your dimension definition and then using something like;
    OMBALTER DIMENSION 'YOURDIMENSION' IMPLEMENTED BY SYSTEM STAR
    Cheers
    David

  • Apps auto-launch on startup, despite System Prefs and quitting before shutdown.

    All apps that were open before shutdown are relaunching themselves upon startup.
    This behavior occurs even if I quit each application individually before initiating system shutdown.
    This behavior occurs whether I tick or untick the following settings within System Preferences / General:
    • Ask to keep changes when closing documents.
    • Close windows when quitting an application.
    This behavior occurs despite none of the apps being listed within System Prefs / Login Items.
    Examples of auto-launching apps (behavior occured just now with these): TextEdit, Dictionary, Calendar, Contacts, Safari, Firefox, Excel, Acrobat.
    I am the administrator and only user on this machine.
    Early 2011 MacBook Pro 13"
    Mac OS X 8.5
    Build 12F45
    2.7 GHz Intel
    8GB RAM

    Back up all data.
    This procedure will unlock all your user files (not system files) and reset their ownership and access-control lists to the default. If you've set special values for those attributes on any of your files, they will be reverted. In that case, either stop here, or be prepared to recreate the settings if necessary. Do so only after verifying that those settings didn't cause the problem. If none of this is meaningful to you, you don't need to worry about it.
    I've tested these instructions only with the Safari web browser. If you use another browser, they may not work as described.
    Step 1
    If you have more than one user account, and the one in question is not an administrator account, then temporarily promote it to administrator status in the Users & Groups preference pane. To do that, unlock the preference pane using the credentials of an administrator, check the box markedAllow user to administer this computer, then reboot. You can demote the problem account back to standard status when this step has been completed.
    Triple-click anywhere in the following line on this page to select it:
    { sudo chflags -R nouchg,nouappnd ~ $TMPDIR.. ; sudo chown -R $UID:staff ~ $_ ; sudo chmod -R u+rwX ~ $_ ; chmod -R -N ~ $_ ; } 2> /dev/null
    Copy the selected text to the Clipboard by pressing the key combination command-C.
    Launch the Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window (command-V). I've tested these instructions only with the Safari web browser. If you use  another browser, you may have to press the return key after pasting.
    You'll be prompted for your login password. Nothing will be displayed when you type it. You may get a one-time warning to be careful. If you don’t have a login password, you’ll need to set one before you can run the command. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator.
    The command may take a few minutes to run, or perhaps longer if you have literally millions of files in your home folder. Wait for a new line ending in a dollar sign (“$”) to appear, then quit Terminal.
    Step 2 (optional)
    Take this step only if you have trouble with Step 1 or if it doesn't solve the problem.
    Boot into Recovery. When the OS X Utilities screen appears, select
    Utilities ▹ Terminal
    from the menu bar. A Terminal window will open.
    In the Terminal window, type this:
    res
    Press the tab key. The partial command you typed will automatically be completed to this:
    resetpassword
    Press return. A Reset Password window will open. You’re not going to reset a password.
    Select your boot volume ("Macintosh HD," unless you gave it a different name) if not already selected.
    Select your username from the menu labeled Select the user account if not already selected.
    Under Reset Home Directory Permissions and ACLs, click the Reset button.
    Select
     ▹ Restart
    from the menu bar.

  • Using JNDI to bind any object

    Hi,
    I intend to bind a few objects in JNDI context so that they can later be just looked up and then used.
    I can use code like this:
    =========
    Hashtable env = new Hashtable();
    env.put(Context.PROVIDER_URL, SOME_PROVIDER_URL);
    env.put(Context.SECURITY_PRINCIPAL, "user");
    env.put(Context.SECURITY_CREDENTIAL, "passwd");
    Context ctx = new InitialContext(env);
    context.bind("name", object);
    =========
    This object can later be looked up. So far so good. However, this will bind the object in the same VM "only".
    Is there any way of calling something like:
    ====
    someOC4JClass.getNamingService().bind("name", object);
    ===
    so that the underlying naming service takes care of making this object available across JVMs?
    Any help/pointers will be highly appreciated.
    Thanks,
    Ravi

    Ravi -- Currently OC4J's internal JNDI is not a global JNDI shared by all OC4Js. One way to approach this problem would be to bind the objects in some global / common JNDI like OID.
    Thanks -- Jeff

  • Weblogic.jndi.internal.RootNamingNode by Startup

    Hi,
    I have definied a ConnectionPool, but in Startup exception raised:
    Anyone knows why?
    Interesting, I can see my connectionpool in "View JNDI tree" at the Consol. But
    trying to use it from an EJB exception raised:
    java.sql.SQLException: Connection Pool SEOInterBaseConnectionPool does not exist.
    ####<01.03.2001 10:35:39 GMT+01:00> <Info> <JDBC Connection Pool> <pc0194> <rpcserver>
    <main> <system> <> <000000> <Connection for pool "SEOInterBaseConnectionPool"
    created.>
    ####<01.03.2001 10:35:39 GMT+01:00> <Info> <Adapter> <pc0194> <rpcserver> <main>
    <system> <> <000000> <Exception thrown by rmi server(class weblogic.jndi.internal.RootNamingNode)
    [-7684374466692944493S:10.2.3.119:[7001,7001,7002,7002,7001,7002,-1]/9]: weblogic.jndi.internal.RootNamingNode@951a0>
    javax.naming.NameNotFoundException: Unable to resolve weblogic.jdbc.connectionPool
    Resolved: 'weblogic' Unresolved:'jdbc' ; remaining name 'connectionPool'
         at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:803)
         at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:209)
         at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:129)
         at weblogic.jndi.internal.BasicNamingNode.list(BasicNamingNode.java:496)

    Hi,
    I have definied a ConnectionPool, but in Startup exception raised:
    Anyone knows why?
    Interesting, I can see my connectionpool in "View JNDI tree" at the Consol. But
    trying to use it from an EJB exception raised:
    java.sql.SQLException: Connection Pool SEOInterBaseConnectionPool does not exist.
    ####<01.03.2001 10:35:39 GMT+01:00> <Info> <JDBC Connection Pool> <pc0194> <rpcserver>
    <main> <system> <> <000000> <Connection for pool "SEOInterBaseConnectionPool"
    created.>
    ####<01.03.2001 10:35:39 GMT+01:00> <Info> <Adapter> <pc0194> <rpcserver> <main>
    <system> <> <000000> <Exception thrown by rmi server(class weblogic.jndi.internal.RootNamingNode)
    [-7684374466692944493S:10.2.3.119:[7001,7001,7002,7002,7001,7002,-1]/9]: weblogic.jndi.internal.RootNamingNode@951a0>
    javax.naming.NameNotFoundException: Unable to resolve weblogic.jdbc.connectionPool
    Resolved: 'weblogic' Unresolved:'jdbc' ; remaining name 'connectionPool'
         at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:803)
         at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:209)
         at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:129)
         at weblogic.jndi.internal.BasicNamingNode.list(BasicNamingNode.java:496)

  • JNDI object binding failed

    Hi,
    I was trying to create a mail session in weblogic 8.1. The jndi name must be filled with a javax.mail.Session object, and it's supposed to display in JNDI tree with purple icon, right? But when I typed in the jndi name, it came out a failure in JNDI tree (with red icon).
    This was what in my j2ee config (ejb-jar.xml):
    <session id="Email">
         <ejb-name>Email</ejb-name>
         <home>com.gtnet.workflow.enactmentService.ejb.EmailHome</home>
         <remote>com.gtnet.workflow.enactmentService.ejb.Email</remote>
         <ejb-class>com.gtnet.workflow.enactmentService.ejb.EmailBean</ejb-class>
         <session-type>Stateless</session-type>
         <transaction-type>Container</transaction-type>
         <resource-ref id="ResourceRef_1">
              <res-ref-name>EmailSession</res-ref-name>     
              <res-type>javax.mail.Session</res-type>
              <res-auth>Application</res-auth>
         </resource-ref>
    </session>
    And this was what in my weblogic j2ee config (weblogic-ejb-jar.xml):
    <weblogic-enterprise-bean>
         <ejb-name>Email</ejb-name>
         <reference-descriptor>
              <resource-description>
                   <res-ref-name>EmailSession</res-ref-name>
                   <jndi-name>java:/Mail</jndi-name>
                   <!-- Missing principal declaration here -->
              </resource-description>
         </reference-descriptor>
         <jndi-name>ejb/EmailHome</jndi-name>
    </weblogic-enterprise-bean>
    I have tried filling everything as the jndi name, from EmailSession, Mail, ejb.EmailHome, Email, etc, but none worked.
    Could anybody help me please? :)
    Thanks,
    Martha

    Is something failing or are you annoyed (you should be, imo) by the message?
    The server export has not (apparently) failed, but you may have problems marshaling a request that contains an object that itself contains a private remote data member.
    Make sure that the security policy is correct (enables replace object).
    alagappan meyyappan wrote:
    Hi folks,
    I have a problem in binding an RMI object with JNDI it says
    EnableReplaceObject failed.
    RMI implementations hosted by this VM should not be buried in
    java.io.Serializable data.
    EnableReplaceObject failed.
    RMI implementations hosted by this VM should not be buried in
    java.io.Serializable data.
    any help would be high appreciated
    meyyappan

  • How to check JNDI contents after 9iAs startup?

    Dear all:
    How to check JNDI contens after 9iAs server startup ?
    Does the 9iAs have JNDI tree can show all JNDI contents.

    Hi,
    define ValueChange listeners on the component and when the user hits the command link or button to navigate off t he page, check if it has been changed (the listeners would set a bloolean variable). For this to work, the navigation action needs to be handled by the bean too.
    Frank

  • .jsp is auto-binded according to the url-pattern of "*.jsf" ?

    i mean, x.jsp is auto returned if i type x.jsf?
    but failed if i rename x.jsp to x.jspx, that means .jspx is not accepted.
    could someone explain the mechanism for me ?

    Check the servlet mapping in web.xml. You've apparently mapped FacesServlet on *.jsf. With regard to JSP files, you need to check the JspServlet mapping in the web.xml of the application server itself. It is by default *.jsp. If you want to add *.jspx to that, then you need to add another <servlet-mapping> of the JspServlet to your web.xml (or the web.xml of the application server, if you have admin control over that).

  • USB Drives auto-mounting at startup?

    I am new to the Mac, on little issue i have with my wonderful MAC is when i restart\start up the Mac, the USB Drives \ USB jump drives are not automatically mounted like they do in windows.
    In order for it to be found, i have to unplug and reconnect the cable, there has to be away to automount these USB drives, any ideas? thanks.

    Hi, Matt. Welcome to the Discussions.
    This may be an issue with the firmware on the USB devices you cited. The same behavior has been noted with certain FireWire drives: some must be powered on before startup to be recognized, others are not recognized unless they are powered-up after after startup.
    For your USB hard drives, check with the manufacturer to see if there is a firmware upgrade available for the enclosure. For your USB Flash Drives, there's generally no way to update the firmware: you'll have to live with the behavior and connect them after you startup your Mac.
    Note that before either disconnecting or powering off any mounted external drive — FireWire or USB, flash drive or hard drive — Eject the drive using any of the following methods:
    • Click the drive's Eject icon in the Finder Sidebar.
    • Drag the drive's desktop icon to the Trash.
    • Control-click the drive's desktop icon, then select Eject from the resulting context menu.
    • In Disk Utility, select the drive, then either:- Click Eject in the Disk Utility tool bar.
    - Select File > Eject Disk.
    - Press Command-E.Good luck!
    Dr. Smoke
    Author: Troubleshooting Mac® OS X

Maybe you are looking for

  • Rows or columns to be read only

    Hi, I need to set Cells or Rows to Read Only If some attribute doesnt contain any value. First i have to search for records basd on some condition and display it in the table. And the records will be read only if certain attribute/field of the record

  • Replacement of SEARCH ITAB statement in ECC 6.0

    Hello Experts, Can anybody tell me, which statement i can use to replace an obsolete statement i.e. SEARCH ITAB in ECC 6.0? Thanks in advance!! Best Regards, Bhupinder

  • How to read a CD-R on my iMac

    I need to read this Windows Power Point Diaporama on my iMac. How to do? I get the music OR the photos but the  Diaporama does not run at all.  Thank you Yvon

  • Missing songs following last Update

    Following the latest Update I have found that the first 6 albums are now missing from my itunes playlist.  I cannot locate them and they are completely missing from my computer as I also tried to access them using Windows Media Player. Both itunes an

  • Best Settings to Export HD Video Slideshow from iPhoto '09 for YouTube

    Trying unsuccessfully thru trial & error to find the correct settings: in "Custom Export" I select "Movie to MPEG-4" as req'd for YouTube, then click "Options" and select MP4 (NOT the ISMA version) for File Format, then I select one of the two HD Ima