ClassCastException while passing object from one context to another

I am hoping that someone will bear with me as I think it is my knowledge of classloaders that is tripping me up. I am using Spring and have a SecurityContextImpl object that I want to pass from one web app (WA2) to another web app (WA1). In WA2 I do the following:
ServletContext wa1Context = getServletContext().getContext("WA1");
wa1Context.setAttribute("SPRING_SECURITY_CONTEXT" , SecurityContextImpl);WA1 then tries to get the SPRING_SECURITY_CONTEXT and cast it to a SecurityContext object. This is where I get the ClassCastException. I have:
crossContext="true"in my context.xml fragment. My reading tells me that I may be able to get around this by copying all the spring jars into my Tomcat lib folder but I seem to have to copy so much in there (Spring, hibernate, atomikos etc.) that it does not seem to be a good solution; I gave up before copying all the dependencies it asked for. Is there another way around this problem?
What I really want to do is find an easy way to copy this one object from WA2 into WA1.

Thanks for taking the time to test this. I also tried with a String and was successful but still cannot get it to work with my SecurityContextImpl. I also tried passing a String wrapped in a custom bean with a single string property. I get the same ClassCastException. I think that using a String works because it is native to the JVM and somehow bypasses the class loading issue but as I say, my knowledge of classloaders is null.
Here is the exact code I am running in WA1 and WA2:
In WA2 (context is /forum):
ServletContext servletContext = httpRequest.getSession().getServletContext().getContext("/");
servletContext.setAttribute("SPRING_SECURITY_CONTEXT", httpRequest.getSession().getAttribute("SPRING_SECURITY_CONTEXT"));
logger.debug("It was of type [" + httpRequest.getSession().getAttribute("SPRING_SECURITY_CONTEXT").getClass().getName() + "]");In WA1 (A JSP sitemesh decorator with context "/"):
Object object = getServletContext().getAttribute("SPRING_SECURITY_CONTEXT");
System.out.println("IN DECORATOR, OBJECT IS OF TYPE [" + object.getClass().getName() + "]");
SecurityContext securityContext = (SecurityContext) object;The log output is:
DEBUG uk.co.prodia.prosoc.security.spring.cas.login.CheckDecoratorKnowsAboutLogin  - It was of type [org.springframework.security.context.SecurityContextImpl]
IN DECORATOR, OBJECT2 IS OF TYPE [org.springframework.security.context.SecurityContextImpl]

Similar Messages

  • Getting error , while passing parameters from one page to another page

    Hello friends,
    i am getting error, while passing parameters from one page to another page, below code i wrote.
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    ArrayList arl=new ArrayList();
    EresFrameworkAMImpl am=(EresFrameworkAMImpl)pageContext.getApplicationModule(webBean);
    ERecordImpl ERecordObj=new ERecordImpl();
    HashMap hMap = new HashMap();
    hMap.put("1",ERecordObj.getTransactionName());
    hMap.put("2",ERecordObj.getTransactionKey());
    hMap.put("3",ERecordObj.getDeferredMode());
    hMap.put("4",ERecordObj.getUserKeyLabel());
    hMap.put("5",ERecordObj.getUserKeyValue());
    hMap.put("6",ERecordObj.getTransactionAuditId());
    hMap.put("7",ERecordObj.getRequester());
    hMap.put("8",ERecordObj.getSourceApplication());
    hMap.put("9",ERecordObj.getPostOpAPI());
    hMap.put("10",ERecordObj.getPayload());
    // hMap.put(EresConstants.ERES_PROCESS_ID,
    if(pageContext.getParameter("item1")!=null)
    pageContext.forwardImmediately(EresConstants.EINITIALS_FUNCTION,
    OAWebBeanConstants.KEEP_MENU_CONTEXT,
    null,
    hMap,
    true,
    OAWebBeanConstants.ADD_BREAD_CRUMB_YES
    Error(71,2): method forwardImmediately(java.lang.String, byte, null, java.util.HashMap, boolean, java.lang.String) not found in interface oracle.apps.fnd.framework.webui.OAPageContext
    Thanks
    krishna.

    Hi,
    You have imported the wrong class for HashMap.
    Import
    com.sun.java.util.collections.HashMap; instead of java.util.HashMap
    Thanks,
    Gaurav

  • Error while transporting objects from one package to another

    Hi Everyone,
    I am using a FM 'HR_INFOTYPE_OPERATION' to update a value into a table pa0584 table.
    If i try to upload all the values i am getting a return value like " No of Entries exceeds more than 20".
    So please help me out.
    Thanks
    Vijay

    Hi,
    You can merge your different requests into a single request. goto se09  select any one of your request and in menu,
    Utilities -> Reorganize -> Merge Requests. or press CTRL + F12.
    hope this helps u.,
    Thanks & Regards,
    Kiran

  • Pass a object from one jar to another jar file

    I have a common jar file which will communicate to the server for data validation purpose.But after validation it has to invoke different different jar file based on its response from the server.So, I might have a object which has to pass from the common jar file to a specific jar file.So, I like to know what will be the best procedure to achieve it.
    Please help me out.

    arpitak wrote:
    Yes,jar file holds class files.one of class files wants to trigger a method of a class file which resides in different jar file.this is the situation I tried to describe.Let consider there are three jar files like JAR A,JAR B ,JAR C.Here JAR A is a common jar where other two jar could be used as a plug in. So based on the condition any one of them (JARS) will be triggered by the common jar(JAR A).this is the situation.The class file of JAR A will trigger some method or main method of the JAR B/JAR C.So,here how could I pass a object from one jar to another is my main question.
    Is it clear now?
    I need a solution for this very urgently.Are you looking for a plug-in framework? That is, dynamically discovering and loading plugins. I am not experienced in developing or using plugins. However Googling "java plugin" brings up JPF.
    If you just have multiple jars that have different classes, the JVM will load the appropriate classes if it can find the jars through the standard classloader on the classpath or through a customer classloader.

  • OBIEE 11g How to pass variable from one prompt to another prompt in dashboard page.

      How to pass variable from one prompt to another prompt in dashboard page.
    I have two prompt in dashboard page as below.
    Reporttype
    prompt: values(Accounting, Operational) Note: values stored as
    presentation variable and they are not coming from table.
    Date prompt values (Account_date, Operation_date)
    Note:values are coming from dim_date table.  
    Now the task is When user select First
    Prompt value  “Accounting” Then in the
    second prompt should display only Accounting_dates , if user select “operational”
    and it should display only operation_dates in second prompt.
    In order to solve this issue I made the
    first prompt “Reporttype” values(Accounting, Operational) as presentation
    values (custom specific values) and default presentation value is accounting.
    In second prompt Date are coming from
    dim_date table and I selected Sql results as shown below.
    SELECT case when '@{Reporttype}'='Accounting'
    then "Dates (Receipts)"."Acct Year"
    else "Dates (Receipts)"."Ops
    Year"  End  FROM "Receipts"
    Issue: Presentation variable value is not
    changing in sql when user select “operation” and second prompt always shows
    acct year in second prompt.
    For testing pupose I kept this presentation
    variable in text object of dashboard and values are changing there, but not in
    second prompt sql.
    Please suggest the solution.

    You will want to use the MoveClipLoader class (using its loadClip() and addListener() methods) rather than loadMovie so that you can wait for the file to load before you try to access anything in it.  You can create an empty movieclip to load the swf into, and in that way the loaded file can be targeted using the empty movieclip instance name.

  • Passing Variables from one View to another

    First of all Hi this is my first post on the sap forums.
    Aplogies if I have come to the wrong place or if this question is very easy, but I am new to abap and web dynpro and have found myself struggling a little bit.  So I stumbled across this site and thought I would ask for help.
    My problem is this, I have 2 variables on my MAIN view, one called MONTH and the other called YEAR.  What I want to do is on a button click on the MAIN view pass the values of these variables to another view called SUMMARY_RPT and then use these variables in an SQL query I have on this view.
    Anybody out there that can help ?
    Many Thanks,
    George

    Hi George,
    Welcome to webdynpro abap community. To pass data from one view to another, you can should create two attributes (type string) in the attribute tab of of the component controller. Now these will act as global variable for you. Now you can access these attribute in your view in this way:
    wd_comp_controller->gv_val "gv_val is the name of the attribute
    Populate the value in it and use it anywhere you want.
    There is one more way to do the same.
    Create a node under context in component controller and create 2 attributes(type string) after that. Map this node to both the views. Now get the value of month , year and set these attribute with the same values with the help of code wizard in view 1. Now in the view2 simply read those attribute and you'll get the value of month and year which was entered in the first view. Read the attribute with the help of code wizard. Now you can use them accordingly.
    I would suggest you to use 1st method as it is better performance wise.
    I hope it helps.
    Regards
    Arjun

  • How to move object from one cont. to another

    Hi I am not able to move object from one container to another container in work order driver. while when i am same line of code in JMS driver its working fine and also log genarated for the same. but in work ordre driver it is not working. here is my code which i m using for the same.ple help me out
    <do-move-src-object class-name="ValeUser">
    <arg-dn>
    <token-local-variable name="var-str-nwoContent"/>
    </arg-dn>
    <arg-dn>
    <token-text xml:space="preserve">\</token-text>
    <token-global-variable name="dirxml.auto.treename"/>
    <token-text xml:space="preserve">\</token-text>
    <token-global-variable name="hrfeed.inactive.container"/>
    </arg-dn>
    </do-move-src-object>
    thanks
    Adarsh Kumar

    Idmlearner,
    sorry, but you are still posting in the wrong forum. You should ask
    these questions in the Identity Manager forum
    Shaun Pond

  • Is there any way to pass value from one SWF to another ?

    I am doing project using flash, now I cant pass a value from one SWF to another, is there any way to pass value from one SWF to another.
    thanks

    Hi,
    Just to confirm here do you simply want to communicate between two SWFs without involving Flash Media Server. If this is the case one good way of doing it is to use a local connection. It can be used for direct communication between two separate instances of the flash player. However if you want to involve multiple clients sharing a common variable then you may have to use Shared Object for this. Please let me know what is the actual use case, is it multiple clients sharing a common variable or different player instances communicating between themselves.
    Thanks,
    Abhishek

  • HT201250 how can i pass information from one mac to another mac by using the time capsule

    how can i pass information from one mac to another mac by using the time capsule

    If you want to transfer files, settings, etc., you must open Migration Assistant (Applications > Utilities) in the Mac that you want to transfer the files and follow the instructions

  • How can you move the objects from one server to another?

    how can you move the objects from one server to another?

    Hi,
    Collecting objects for Transporting
    1. rsa1->transport connection
    2. left panel choose 'object type', middle panel choose 'infocube' and 'select objects'
    3. then choose your infocube and 'transfer'
    4. will go to right panel, choose collection mode 'manual' and grouping only 'necessary objects'
    5. after objects collection finished, create request
    6. If they are $TMP, then change the package.
    7. When you click the Save on the change package, it will prompt for transport. Here you can provide an existing open transport request number, or if you like here itself you can create a new one.
    8. You can check the request in SE09 to confirm.
    Releasing Transport Request  
    Lets say you are transporting from BWD to BWQ
    Step 1: In BWD go to TCode SE10
    Step 2: Find the request and release it (Truck Icon or option can be found by right click on request #)
    Note: First release the child request and then the parent request
    Steps below are to import transport (generally done by basis )
    Step 1: In BWQ go to Tcode STMS
    Step 2: Click on Import queue button
    Step 3: Double Click on the line which says BWQ (or the system into which transport has to be imported)
    Step 4: Click on refresh button
    Step 5: High light the trasnport request and import it (using the truck icon)
    Transport
    http://help.sap.com/saphelp_nw2004s/helpdata/en/b5/1d733b73a8f706e10000000a11402f/frameset.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/0b/5ee7377a98c17fe10000009b38f842/frameset.htm
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/media/uuid/224381ad-0701-0010-dcb5-d74236082bff
    Hope this helps.
    thanks,
    JituK

  • How do I move an object from one photo to another and then change the scene, i.e.  winter to sum?

    How do I move an object from one photo to another and then change the scene, i.e.  winter to summer?

    OK.
    Open the picture with the new scene. This will be your canvas.
    Open the picture with object A, select it with one of the selection tools, go to Edit>copy
    Go back to the new scene/canvas, Go to Edit>paste
    Repeat for object B
    Use the move tool to position A & B, each on its own layer. Use the corner handles of the bounding box to resize, if necessary
    You should have 3 layers: Background layer, and the 2 layers with A & B
    Note: It's best if the resolution of the 3 picture files is the same value.

  • What are Parameters? How are they differenet from Variables? Why can't we use variables for passing data from one sequnece to another? What is the advantage of using Parameters instead of Variables?

    Hi All,
    I am new to TestStand. Still in the process of learning it.
    What are Parameters? How are they differenet from Variables? Why can't we use variables for passing data from one sequnece to another? What is the advantage of using Parameters instead of Variables?
    Thanks in advance,
    LaVIEWan
    Solved!
    Go to Solution.

    Hi,
    Using the Parameters is the correct method to pass data into and out of a sub sequence. You assign your data to be passed into or out of a Sequence when you are in the Edit Sequence Call dialog and in the Sequence Parameter list.
    Regards
    Ray Farmer

  • Move objects from one tablespace to another

    Hello
    Running Oracle 10g rel 2 and I would like to move all objects from one tablespace to another. There are Primary Key indexes to other tables in this tablespace. The size grew too large and I want to reduce the size.
    Thank you.

    Good afternoom Sir!
    I believe that below "ask tom - moving tables across tablespaces" may help you.
    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:47812348053
    Regards,
    Marcello M.

  • Moving object from one client to another using transport requests...

    Hi,
    If we want to move one object from one client to another, we go to se09 and release it. I know this. But after release what are the next steps to move it from one system to another ?
    Regards,
    Rajesh

    Hello Rajesh
    If the two systems share a <u>common</u> transport directory then you can simply go to transaction <b>STMS</b>, double-click on the <b>import queue</b> (target system), then choose menu <b>Extras -> Other Requests -> Add.</b>
    The transport request will be added to the import buffer. Next you can import the request.
    If the two systems do not share a common transport directory you can use RFC-enabled function module <b>EPS_FTP_PUT</b> to copy the data and cofile from the source to the target system (check for <b>DIR_TRANS</b> directories using transaction AL11).
    Regards
      Uwe

  • Moving Object from One container to another in workOrder Dri

    Hi , I am able to Move Object from One container to another container in workOrder Driver.
    here is my code which i am using
    <do-move-src-object class-name="ValeUser">
    <arg-dn>
    <token-local-variable name="var-str-nwoContent"/>
    </arg-dn>
    <arg-dn>
    <token-text xml:space="preserve">\</token-text>
    <token-global-variable name="dirxml.auto.treename"/>
    <token-text xml:space="preserve">\</token-text>
    <token-global-variable name="hrfeed.inactive.container"/>
    </arg-dn>
    </do-move-src-object>
    Thanks
    Adarsh Kumar

    Originally Posted by AndersG
    Idmlearner,
    > am able to Move Object from One container to another container
    > in workOrder Driver.
    >
    Possibly better asked in support.identity-manager
    - Anders Gustafsson (Sysop)
    The Aaland Islands (N60 E20)
    Novell has a new enhancement request system,
    or what is now known as the requirement portal.
    If customers would like to give input in the upcoming
    releases of Novell products then they should go to
    http://www.novell.com/rms
    Identity Manager - NOVELL FORUMS
    If you are not a nntp user.
    Thomas

Maybe you are looking for

  • RMI : error on JRE 1.6 but not on JRE 1.5 ???

    Hello, I've got a problem with my application since i use JRE 1.6 My application run perfectly with JRE 1.5 !!! My code is first : LocateRegistry.createRegistry(port); NamingManager.setInitialContextFactoryBuilder(new InitialServerContextFactory());

  • Print view of a PO

    How can we see the print view of a Purchase order in 4.0 System ? Thanks Tharani

  • Visual Studio 2008 does not open .rptproj 2008 projects

    I have installed - SQL Server 2008 original version with SP1 and the Business Intelligence Development Studio - Visual Studio 2008 with SP1. I am told that Reporting Services 2008 is part of the Business Intelligence Development Studio 2008, however

  • Macbook pro keeps freezing or blue screen of death

    I got my mackbook pro in april,all rammed up etc.I bought this laptop just to play poker on.Poker programs only work with windows[but knew about bootcamp,i'm running XP on it].The problems i'm having ,is that, once a day at least it shuts down itself

  • Uninstall sql2005 when side-by-side with sql 2008r2 and sql2012

    Hi We have a large server with sql 2005, sql2008 r2 and sql2012 installed side-by side. We no longer use 2005 and would like to remove it from the server, is this safe to do on a standard uninstall or can it have a detrimental affect on the 2008 and