Problem in accessing two different InitialContexts simultaneously

Hi All
I have a strange problem the scenario is as below
I have two different web logic servers as server1 and server2
The Realm on server1 is user1 and password is pwd1
The Realm on server1 is user2 and password is pwd2
In my application on server1 I created the database connection with DataSource lookup by setting InitialContext values as java.naming.security.principal to user1 and java.naming.security.credentials to pwd1 and i have done some data base transaction .
In between i need to made a remote EJB call which is on server2 so i created an other
InitialContext by setting java.naming.security.principal to user2 and java.naming.security.credentials to pwd2 and this 2nd context i am closing after placing the HomeObject in a HashMap.
After completing the EJB call I have to continue the remaining database transactions by getting the connection from lookup.
Here i am getting the following error
*Caused by: java.sql.SQLException: Pool connect failed : java.lang.SecurityException: [Security:090398]Invalid Subject:user2*
If any one has faced the same problem or know the solution to this problem please help me in solving this.
Thanks in Advance.

The thread that establishes an initial context with a WLS server gets infected with the security credential of the initial context. Anything that thread does afterwards will be using that credential. A typical solution to this would be to obtain and cache the current subject on the thread before getting the second initial context, and then resume the subject when you need to go back to work with the first initial context. You may want to look into weblogic.Security.Security class for the APIs that you need to accomplish this.
Regards,
Dongbo
Edited by: user650694 on Dec 12, 2008 10:31 AM

Similar Messages

  • Users are not able to access two different SAP portals at a time

    Hi Experts,
    Users are not able to access two different SAP portals at a time, if users login the OLD SAP Portal then they are not able to access NEW SAP Production Portal asking user id's & Password while doing ECC & APO transactions.
    If user clear the Internet Explorer cache then for time being they can access but its not the permanant solution.
    Can any one please help me on this.
    Thanks,
    Jay

    Hello Jay,
    here we are facing this problem, this company users not able to access both the portals at at time
    If you want to access HTC and Armed at the same time you gotta complete SSO Config or User mapping between these two Portals. You can refer to the below link for more details.
    http://help.sap.com/saphelp_nw04/helpdata/en/f8/3b514ca29011d5bdeb006094191908/content.htm
    Thanks
    SM

  • Using Berkeley With Two Different Environment Simultaneously

    I am trying to use Berkeley with two different environment simultaneously in one program. But I am getting an error message of Databases left open. The first environment close with no error but the 2nd environment, having an error like this,
    Exception in thread "main" java.lang.IllegalStateException: Unclosed Database: element_primary_key_index\\192.168.150.211\glassfish3\Berkeley\environment\Testing11
    Unclosed Database: class_catalog\\192.168.150.211\glassfish3\Berkeley\environment\Testing11
    Unclosed Database: element_database\\192.168.150.211\glassfish3\Berkeley\environment\Testing11
    Databases left open: 3
         at com.sleepycat.je.Environment.close(Environment.java:383)
         at com.svi.tools.gfs3v10domain.database.GFS3v10ReadWriteDatabase.closeUpload(GFS3v10ReadWriteDatabase.java:155)
         at com.svi.tools.gfs3v10domain.GFS3v10Domain.closeReadWrite(GFS3v10Domain.java:160)
         at com.svi.tools.gfs3v10.util.GFS3v10UploadUtil.closeUpload(GFS3v10UploadUtil.java:97)
         at com.svi.tools.gfs3v10.GFS3v10.closeUpload(GFS3v10.java:115)
         at com.svi.tools.gfs3v10uploader.util.Uploader.uploadFiles(Uploader.java:89)
         at com.svi.tools.gfs3v10uploader.GFS3v10Uploader.mainMethod(GFS3v10Uploader.java:109)
         at com.svi.tools.gfs3v10uploader.GFS3v10Uploader.main(GFS3v10Uploader.java:52)
    Please someone help me with my problem. Thanks in advance.

    Hi Mark,
    Here is my sample program for the problem:
    import java.io.File;
    import com.sleepycat.bind.serial.StoredClassCatalog;
    import com.sleepycat.je.Database;
    import com.sleepycat.je.DatabaseConfig;
    import com.sleepycat.je.Environment;
    import com.sleepycat.je.EnvironmentConfig;
    import com.sleepycat.je.EnvironmentLockedException;
    import com.sleepycat.je.SecondaryConfig;
    import com.svi.tools.gfs3v10domain.objects.GFS3v10DomainElementData;
    import com.svi.tools.gfs3v10domain.objects.GFS3v10DomainElementKey;
    import com.svi.tools.gfs3v10domain.views.utils.ElementByPrimaryKeyCreator;
    * Read Write Database used for every thing else.
    public class MethodsSample implements GFS3v10Database {
         * Environment where the Database resides.
         private Environment environment = null;
         private boolean isClose = false;
         String environmentString;
         * Class Catalog for Stored Classes.
         private static StoredClassCatalog classCatalog;
         * Element Database.
         private static Database elementDatabase;
         * Element Database by Primary Key.
         private static Database elementByPrimaryKeyDatabase;
         private static Database catalogDatabase;
         * Default Constructor.
         public MethodsSample() {
    * Alternate Constructor.
    * @param homeDirectory Location where the Database is Located.
    public MethodsSample(String homeDirectory) {
         environmentString = homeDirectory;
         openEnvironment(homeDirectory);
         openDatabase();
    @Override
         * Opens the Read Write Database.
         * @param homeDirectory Location where the Database is Located.
    public void openEnvironment(String homeDirectory) {
         EnvironmentConfig environmentConfig = new EnvironmentConfig();
    environmentConfig.setTransactional(true);
    environmentConfig.setAllowCreate(true);
    environmentConfig.setDurability(DURABILITY);
    while (environment == null) {
         try {
              environment = new Environment(new File(homeDirectory), environmentConfig);
         } catch(EnvironmentLockedException ele) {
              try {
                             Thread.sleep(500);
                        } catch (InterruptedException e) {
    @Override
         * Opens the Database.
    public void openDatabase() {
         DatabaseConfig databaseConfig = new DatabaseConfig();
         databaseConfig.setDeferredWrite(true);
    databaseConfig.setAllowCreate(true);
    catalogDatabase = environment.openDatabase(null, CLASS_CATALOG + environmentString, databaseConfig);
    classCatalog = new StoredClassCatalog(catalogDatabase);
    elementDatabase = environment.openDatabase(null, ELEMENT_DATABASE + environmentString, databaseConfig);
    SecondaryConfig secondaryConfig = new SecondaryConfig();
    secondaryConfig.setDeferredWrite(true);
    secondaryConfig.setAllowCreate(true);
    secondaryConfig.setSortedDuplicates(true);
    secondaryConfig.setKeyCreator(new ElementByPrimaryKeyCreator(classCatalog, GFS3v10DomainElementKey.class, GFS3v10DomainElementData.class, String.class));
    elementByPrimaryKeyDatabase = environment.openSecondaryDatabase(null, ELEMENT_PRIMARY_KEY_INDEX + environmentString, elementDatabase, secondaryConfig);
    @Override
         * Gets the Environment.
         * @return Environment.
    public Environment getEnvironment() {
         return environment;
    @Override
         * Gets the Class Catalog.
         * @return Class Catalog.
    public StoredClassCatalog getClassCatalog() {
         return classCatalog;
    @Override
         * Gets Element Database.
         * @return Element Database.
    public Database getElementDatabase() {
         return elementDatabase;
    @Override
         * Gets Element By Primary Key Database.
         * @return Element By Primary Key Database.
    public Database getElementByPrimaryKeyDatabase() {
         return elementByPrimaryKeyDatabase;
    @Override
         * Closes Database and then Environment.
    public void closeUpload() {
         System.out.println("1st Jar environment closing = " + environmentString);
         elementByPrimaryKeyDatabase.close();
         elementDatabase.close();
         classCatalog.close();
         catalogDatabase.close();
         environment.close();
         isClose = true;
    public Boolean isClose() {
         return isClose;
         @Override
         public void closeOthers() {
    for the Main:
    public class sample {
         public static void main(String[] args) {
              String environment1 = "\\\\192.168.160.184\\glassfish\\berkeley\\environment\\home\\Multiple\\Testing11";
              String environment2 = "\\\\192.168.150.211\\glassfish3\\Berkeley\\environment\\Testing11";
              openCloseEnvironment(environment1, environment2);
         public static void openCloseEnvironment(String environment1, String environment2) {
              MethodsSample forEnvironment1 = new MethodsSample(environment1); //Opens the Databases
              MethodsSample forEnvironment2 = new MethodsSample(environment2); //Opens the Databases
              forEnvironment1.closeUpload();
              forEnvironment2.closeUpload();
    // same error happens no matter what sequence for closing
    Thank you.

  • One file to two different folders simultaneously?

    Is there a way to copy one file to two different folders simultaneously?
    Maybe a script?
    Drew

    Thanks for the response Baltwo.
    Maybe I shouldnt have said 'simultaneously'.
    What I'm trying to achieve is this.
    I drop a file into one folder and it automatically copies to ano folder (a redundant back up of the first folder)
    Is that possible at all?
    Drew

  • Can we access two different Siebel BO in Same OPA Rule Base

    Hi all,
    can we access two different BO's from same rule base.
    what i means is,can we pass siebel data to OPA Rule Base from two different BO's .
    Thank you for your help in advance.

    There are two approaches to do this and they both involve making some small changes on the Siebel side.
    You can create an Integration Object which contains all the business components that you want to send to OPA if you are using an Integration Object mapping.
    If you would prefer to use a Business Object mapping then you will have to create a new Business Object which combines the BCs of all the Business Objects that you want to send to OPA.
    As you can see, although one approach involves Integration Objects and one involves Business Objects they both work by creating a single object which is an amalgamation of the information that you want to send to OPA.
    Cheers
    Frank

  • Is there any way to scroll two different documents simultaneously?

    Hi all, scroll two different documents simultaneously  - it will be helpul while doing corrections / checking documents. Is there any plugin available for this?

    I use two computers (don't laugh). I set up the laptop next to my desktop monitor and use one hand on each keyboard.
    Consider using (if appropriate) compare tools as well. You can export both documents to RTF and use Word to compare them if all you care about is textual differences. You can export both documents to PDF and use Acrobat to compare them if you need to see graphic differences as well.
    Ken

  • HT204053 Two different accounts simultaneously on my apple tv?

    Can I use two different accounts simultaneously on my apple tv? (one for iCloud and one for iTunes store)

    Welcome to the Apple Community.
    If you mean for redownloading content such as TV shows etc, then no because this is controlled by your store settings.

  • Using Two different drivers  simultaneously

    I want to use two different type 4 drivers i.e. one driver of ms-access and one of ms-sql server 7 simultanoeously in one java program.please tell me how can i do this ?

    i need to load two drivers for my java program. i need to connect to oracle database and count the no of rows and then connect to sql database and count number of rows.print them on command prompt.
    can someone simplify this code??
    package connectDatabase;
    * @author
    import java.sql.*;
    public class ConnectTo
         public void OracleDB()
              Connection dbconn;
              try {
                DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
                String connString="jdbc:oracle:thin:@SYS_IP:1521:oracl";
                dbconn = DriverManager.getConnection(connString, "uname","pwd" );
            catch(SQLException sqlex)
                 sqlex.printStackTrace();
            catch(Exception excp)
                excp.printStackTrace();
         public void SqlDB()
              Connection conn;
              try { 
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 
                String url = "jdbc:odbc:connectDB"; 
                conn = DriverManager.getConnection(url,"uname","pwd");  
              catch (Exception e)
                System.err.println("An Exception occured! " +e.getMessage()); 
    }

  • Problem in importing two different classes with same name...

    I have to import two different classes in my program with the same name....
    import org.apache.lucene.document.Document;
    import org.w3c.dom.Document;
    //    I AM USING THE DOCUMENT FROM W3C PACKAGE HERE....
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                     DocumentBuilder builder = factory.newDocumentBuilder();
                     InputSource is = new InputSource( new StringReader( tempString ) );
                     d = builder.parse( is );
                     NodeList images = d.getElementsByTagName("img");
                     int length = images.getLength();
                     for(int i = 0;i<length;i++)
                         Node image = images.item(i);
                         String tempAltText = image.getAttributes().getNamedItem("alt").getNodeValue();
                         altText = altText.concat(" ").concat(tempAltText);
                     }and the error i am getting is
    [javac] C:\Documents and Settings\sumit-i\WolframWorkspaces\Base\WolframNutch\src\java\com\wolfram\nutch\indexer\InfoCenterFilter.java:20: org.apache.lucene.document.Document is already defined in a single-type import
        [javac] import org.w3c.dom.Document;
        [javac] ^
        [javac] C:\Documents and Settings\sumit-i\WolframWorkspaces\Base\WolframNutch\src\java\com\wolfram\nutch\indexer\InfoCenterFilter.java:132: incompatible types
        [javac] found   : org.w3c.dom.Document
        [javac] required: org.apache.lucene.document.Document
        [javac] d = builder.parse( is );
        [javac] ^
        [javac] C:\Documents and Settings\sumit-i\WolframWorkspaces\Base\WolframNutch\src\java\com\wolfram\nutch\indexer\InfoCenterFilter.java:133: cannot find symbol
        [javac] symbol  : method getElementsByTagName(java.lang.String)
        [javac] location: class org.apache.lucene.document.Document
        [javac] NodeList images = d.getElementsByTagName("img");
        [javac] ^
        [javac] Note: Some input files use unchecked or unsafe operations.
        [javac] Note: Recompile with -Xlint:unchecked for details.
        [javac] 3 errorsany idea ..how to resolve it
    Edited by: ping.sumit on Jul 16, 2008 3:39 PM
    Edited by: ping.sumit on Jul 16, 2008 3:40 PM

    now i changed the code to
    import org.apache.lucene.document.Document;
    import org.w3c.dom.Document;
    org.w3c.dom.Document d = null;
    try{
         System.out.println("in author");
                   URL url = new java.net.URL(urlString);
                   java.net.URLConnection conn = url.openConnection();
                   BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
                   while ((in.readLine()) != null)
                        //tempString = tempString.concat(in.readLine());
                        String temp = in.readLine();
                        tempString = tempString + " " + temp;
                   System.out.println("the string in author" + tempString);
                    in.close();
                    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                     DocumentBuilder builder = factory.newDocumentBuilder();
                     InputSource is = new InputSource( new StringReader( tempString ) );
                     d = builder.parse( is );
                     NodeList images = d.getElementsByTagName("img");and their is only one error i am getting ...and that is
    [javac] C:\Documents and Settings\sumit-i\WolframWorkspaces\Base\WolframNutch\src\java\com\wolfram\nutch\indexer\InfoCenterFilter.java:20: org.apache.lucene.document.Document is already defined in a single-type import
        [javac] import org.w3c.dom.Document;
        [javac] ^
        [javac] Note: Some input files use unchecked or unsafe operations.
        [javac] Note: Recompile with -Xlint:unchecked for details.
        [javac] 1 error

  • Accessing two different wls instances in Apache

    Hi!
    Does anyone know if it is possible to connect to two different instances of wls
    5.1 sp 6 (same IP, different ports) from an apache front-end under the same <VirtualHost>-instance,
    using mod_wl_ssl.so?

    Thanks for your reply.
    It's not the CuCo being initial but my attribute and the collection wrapper of the value node has only one entry, the empty one which is added in the INIT-method of the context node. So it feels like a second instance of my CuCo as inside the other view I have my collection, attribute etc.
    This is my coding to get the CuCo:
    DATA: lr_cucosearch       TYPE REF TO   zl_iccmp_bp_cucosearch_impl.
    lr_cucosearch ?= get_custom_controller( 'ICCMP_BP_SEARCH/CuCoSearch' ).
    This coding I use in both views. This is wrong? I debugged and it looked like it would search for an instance and then return it instead of creating a second one.
    Am I mistaken?
    Thanks.

  • To execute a script in two different instances simultaneously

    Hello All,
    Is it possible to execute a script on different instances simultaneously?
    Like, can we create a user on different instances simultaneously using a script?
    Thanks in advance..!
    Thanks and Regards, Readers please vote for my posts if the questions i asked are helpful.

    Hi,
    Registered Servers meets your requirements.
    The Query Editor window in SQL Server Management Studio can connect to and query multiple instances of SQL Server at the same time. The results that are returned by the query can be merged into a single results pane, or they can be returned
    in separate results panes. As an option, Query Editor can include columns that provide the name of the server that produced each row, and also the login that was used to connect to the server that provided each row. For more information about how to execute
    multiserver queries, see
    Execute Statements Against Multiple Servers Simultaneously (SQL Server Management Studio).
    To execute queries against all the servers in a local server group, right-click the server group, point to click
    Connect, and then click New Query. When queries are executed in the new Query Editor window, they will execute against all servers in the group, using the stored connection information including the user authentication context. Servers
    registered by using SQL Server Authentication but not saving the password will fail to connect.
    More information, see: http://msdn.microsoft.com/en-us/library/ms188231.aspx
    Thanks.
    Tracy Cai
    TechNet Community Support

  • Can I access two different libraries on the same computer with the remote app?

    I am in the process of upgrading our home network. There is going to be an airport express in each of the main rooms of our house all running to a switch connected to our AirPort Extreme. The reason for this is so we can stream our music in any or all of the rooms we choose.  I'm going to have a Windows 7 PC running iTunes constantly also connected so that we will have access to the entire library on any of our devices.  My entire library will be housed on an external hard drive that will be connected to the Extreme. Here is where it gets tricky. My wife has a separate library that we want to have access to as well. It is going to be housed on a separate external hard drive connected to the Extreme via a USB hub. I don't want to combine our libraries because hers is absolute chaos and mine is very well organized. Without having to have a second  computer running iTunes constantly, is there a way we can access both libraries simultaneously with the remote app? Either by running two instances of iTunes on one computer or some other way I'm not realizing. As it works right now, if we're both running iTunes on our laptops, then I can go onto my iPad and see both full libraries on the remote app. I want to do that, but with just one computer.

    I doubt it is possible to run two instances of iTunes on the computer at the same time.  To do so would require two users to be signed in and running iTunes under each user.
    The better solution would be to either clean up and merge the two libraries or have iTunes running on a second computer.

  • HT2542 Accessing two different itunes accounts on the one mac... help please.

    My wife and I have two separate itune accounts which we use on our ipads, iphones etc both with around 500 downloaded songs, tv programmes, films.  We recently purchased a mac and wabt to be able to access all our media on the mac without having to constantly log in as different people.  Is this possible?

    Yes you can.
    The fact you cannot access your son's library from your User account is intentional. User accounts on your Mac are nearly as separate from each other as your Macs are from anyone else's on the planet. To copy music from his account to yours, first copy it to the Shared folder, then log into your account and import the music. Then, you can erase it from Shared.
    The Shared folder exists at /Users/Shared.
    Read
    iTunes: How to share music between different accounts on a single computer
    OS X Mavericks: Set up users on your Mac

  • Problems with Syncing two different libraries on one mac

    Ever since I downloaded itunes 11 onto my mac I am having problems with syncing.  We have two libaries on our mac and can still easily move between the two, each keeping our own playlists, and music/podcast libaries.  The problem is with the syncing to our ipods. The playlists stay separated, but unfortunately the sync update pulls both music libraries and puts it on each of our ipods.  Having very different music tastes, this is a drag. 
    A second issue - there is still that problem of having issues with purchased music not staying in playlists (on ipod) after syncing.
    I've tried looking around the itunes tutorials and articles but wasn't having luck.  any feedback would be greatly appreciated.
    Oh, in case it matters, one of us is using an Iphone and the other an ipod touch.

    you might have to find a third party program to get those songs off her ipad onto the computer, apple doesnt support that unless they are purcahsed from itunes store because of DRM (Digital Rights Media) another word for copy write. so theres not a whole lot of hope for that, but you can always create a new user on your computer
    >user>+ icon>Create new user make it admin
    -if they are how ever purchased from itunes you would still make that new user, plug the device into itunes and authorize the computer by clicking store on the top of your screen where file edit and view are, Store>authorize this computer
    once thats done you'll then plug that device in to the computer and on the left side of itunes you'll see devices and "Device name" the device its self, right click or control click the name and choose transfer purchases, anything that has ever been purchased of gotten for free will sync onto the computer,
    you cant just simplay pull the songs off the device to the computer, doesnt work like that

  • Problem connecting to two different databases from form

    Hi all,
    i am using 6i forms which needs to be connected to oracle 9i and 10g databases which is having different ip address(residing in different machines).i can connect to 10g database after configuring tnsnames.ora in my machine but still i cannot connect to 9i database. could anyone tell me what could be the reason.
    thanks
    mish

    Hi Paul.
    thanks for your help. i could able to solve the problem. since there was a change in the ip address (administrators do it sometimes!!) i couldn't connect. now its fine. thanks once again . have a great day.
    thanks
    mish

Maybe you are looking for

  • How many elements can I insert into a form?

    When creating my form I received a notice that I had reached the maximum number of elements for my form!  I was near the end stages of my design, Ouch!  What can I do?  Is it possible to cut and past sections of my form to create a new form(s) and li

  • To find BOM from a closed Planned Order in REM process.

    Hi, Pl. let me know how to find Planned order no. and its BOM which has been closed? In mb51 we get only Order no. which is not the pld ord and we cannot get the bom. pl. help.

  • Auto create dependency between ViewController and ApplicationController

    Hi all, When you create a new ADF Mobile app, you will automatically create two projects: ViewController and ApplicationController. I noticed that these are not related, that is, a dependency between these is not created in the ViewController. I thin

  • Trigger returning different date formats.

    Posted from Windows forum: We just reticently received a update to an .net application from a vendor. When our client machines (Windows XP) run the app we receive 2 different date formats returned from an post insert table trigger. The correct format

  • Urgent--Importing Audit Plan in Audit Management Module

    Hi All, Can anyone know what are the prerequisite for Audit management. i am getting problem while importing an audit plan from XML. The import button ( import FROM XML) is disabled. Is there anything I need to activate so that the import button will