Dynamic Proxies vs. Generated Code

I've seen reference a couple times here about stub serialization issues in
WebLogic implementations that use dynamic proxies for the stubs. It sounds
like recent WebLogic versions have switched back to generated code. Is this
the case?
If so, I thought dynamic proxies were Serializable. So long as your
InvocationHandler is serializable, isn't this the case?
Thanks,
Bob

"Bob Lee" <[email protected]> writes:
I've seen reference a couple times here about stub serialization issues in
WebLogic implementations that use dynamic proxies for the stubs. It sounds
like recent WebLogic versions have switched back to generated code. Is this
the case?WLS 7.0 now uses generated code, but it is bytecode generated by the
server or client on the fly (not as a result of rmic).
If so, I thought dynamic proxies were Serializable. So long as your
InvocationHandler is serializable, isn't this the case?Not necessarily and indeed in order to preserve wire compatibility we
can't. Note that we switched back to generated code for performance
reasons. Generated code is faster than dynamic proxies.
andy

Similar Messages

  • Dynamic Proxies

    I'm trying to implement a way of monitoring method calls on certain objects so that I am able of enforcing security constraints on these calls.
    Considering the functionality provided by the reflection API, I thought that dynamic proxies would be a viable solution.
    But they have one major restriction:
    A dynamic proxy implements interfaces and thus can only be casted to one of these interfaces.
    So what can I do if I need a proxy on class instances which do not implement any interface?
    I have read a few older threads dealing with this problem, but I couldn't find any satisfying solution.
    There where some ideas of runtime creation of byte code and creating classes from it.
    Another way would possibly be runtime compilation of dynamically created code.
    But aren't there any less cumbersome ways for implementation?
    Regards,
    Volker.

    The idea with the class loader sounds interesting. Although I would have to implement it in a way so that it creates proxies for all classes ever loaded into the JVM. What I am trying to prevent is the following:
    Let's say there is an object "secure" which needs access control and there is another object "caller"with a reference to a "proxy" object monitoring the "secure" instance.
    The initial creation of proxies would be no problem since the critical objects are stored in a object database where they can only be retrieved from by explicit query calls. Implementing my own query method allows me to exchange the result of the query with proxy objects which then are returned to the caller.
    Now "caller" invokes a method on proxy, let's say proxy.doSomething(this) and passes itself as a parameter to the call. Now let's assume "caller" is granted access to the method and the call is delegated to "secure".
    In the process of method execution a method of "caller" is invoked (e.g. the equals method to check if the passed parameter is contained in a Collection) which is possible since "caller" has been passed in as a parameter.
    Now the caller.equals(Object o) method could possibly recieve an unprotected instance of the secure object or any other unprotected object which requires access control via the parameter o.
    Thus I need some way to dynamically generate a proxy class for "caller" which monitors access to its methods and checks if there are any unprotected instances passed as parameters to it and then exchange these instances with another proxy object.
    This is exactly the reason why I need to generate proxies for arbitrary classes (not interfaces) dynamically.
    Trying to solve the problem with my own class loader would require me to create proxy objects for all classes, even those from the Java API. I am not sure if this effort pays. Anyway it would probably cause severe performance problems.
    Another solution would be dynamically subclassing objects and overwriting each method to perform security checks. But this is inconvenient since it is not guaranteed that i can subclass a given class and furthermore I couldn't prevent access to public fields which may exist.
    Perhaps there is another solution to the problem.

  • A Listener solution based on Generics and Dynamic Proxies

    Listeners are common in the java world, espacially in swing. It is easy to implement a listener, and it is easy to call an existing method that notifies all registered listeners, but it's laborious to implement this notification code itself.
    I present a small, typesafe solution called GenericListeners based on Dynamic Proxies and Generics that reduces the notification code to just a single line of code:
    IGenericListeners<FooListener> fooListeners = GenericListeners.create(FooListener.class);If FooListener looks like
    public interface FooListener {
      public onEnter(int id);
      public onExit();
    }then you can register and call Listeners with
    fooListeners.addListener(foo);
    fooListeners.call().onEnter(1);If you are interested, please have a look at
    http://www.sebastian-baltes.de/SebWiki/Wiki.jsp?page=GenericListeners
    What do you think about this?
    Message was edited by:
    Sebastian_Baltes

    Interesting point, and so I've done some tests:
    0:00:01.391 - plainest implementation
    0:00:02.469 - GenericListeners
    0:00:03.422 - javax.swing.event.EventListenerListI used a test that registers a listener and calls it 10,000,000 times in a for loop on Java 6, AMD Athlon 3000.
    I would say that GenericListeners performs well, especially compared to the EventListenerList that is used in all swing components. The problem with EventListenerList is that it stores different classes of listeners at once and has to find the right ones every time you raise an event. For my tests, I only stored one single listener into the list.
    You can imagine how bad the performance of the swing implementation would be if you have a real life example with a lot of different listener classes.

  • How to use generated code from "Import Web Services" with Cairngorm Framework

    I recently downloaded Flex Builder 3 beta 2 and tried out the
    wizard that lets you import web services. The code that is
    auto-generated makes if fairly straight forward to consume web
    services using the object types defined in the WSDL. No longer does
    the developer need to decode the XML payload! The only problem I am
    having is how does you integrate the auto- generated code with the
    Cairngorm framework? This seems like a huge question for anyone who
    might want to leverage Cairngorm and the auto-generated proxy code
    in the same project (like me).
    Here are the problems that I see so far.
    1) How do you configure the generated service class to work
    with the Cairngorm service locator? The service constructor only
    accepts a “LCDS destination string” which implies that
    you must use Lifecycle data services. Unfortunately, the project I
    am trying to retrofit currently uses a WebService and does not use
    data services. All I really need to do is change the endpoint URL
    (ie from local to a development server). This issue is noted in the
    bug https://bugs.adobe.com/jira/browse/FB-8456. What I think is
    needed is a way to set the endpointURI in the Services.mxml file.
    2) Even if I come up with a hack around #1, I do not receive
    a callback to my IResponder even though I register it immediately
    after the method call. I can register and listener function within
    my business delegate and receive the callback, but my Command
    object, which implements IResponder, does not receive the call back
    even though it is registered. From what I read in the ASDocs it
    should but it doesn’t for me!
    These are the issues I have observed in 3 hours of messing
    with this. I hope this makes sense. I would love to integrate
    auto-generated web service proxies into Cairngorm but I don’t
    see a straight forward way without re-architecting Cairngorm. Has
    any one else run across this issue? If so, do you have any insights
    on how to proceed? Any help is appreciated.

    Since I posted this question, I have abandoned the notion of
    auto-generated web services and embraced the good old FDS concept
    where the RemoteObject meta-tag does all the conversion work for
    me. We are now using the Granite DS package and it is working well
    for us. I would love to consume web services, but it just isn't
    worth the hassle when all you have to do with Granite (and FDS) is
    cast your return objects to the proper object type.
    BTW, since this posting, I have investigated competing Flex
    app frameworks. After my research, I checked out the PureMVC
    framework. Wow!! Cairngorm always left me with an uneasy feeling
    and I guess I am not alone. Apparently, Cliff Hall felt the same
    way. That is why he started the project. I like his approach alot
    more than Cairngorm especially since it includes notifications
    which allow me to broadcast my own app level events independent
    from the AS Event framework. Check out PureMVC. For what it is
    worth, it has my humble endorsement. Cliff was even gracious enough
    to acknowledge the other Adobe Consulting guys for their work. Good
    for you Cliff, I respect that. Check out a better way at
    http://www.puremvc.org/

  • Replace dynamic proxies and reflection with invokedynamic

    I have an application that extensively uses reflection and dynamic proxies. It was built on Java 6. Now, I rebuilt it on Java 7, and I am thinking of replacing all reflection and proxies with new invokedynamic.
    Can anybody tell me if it's worth the trouble? I mean, will I get any significant performance boost, and will it complicate or simplify my source code?
    Also, can you recommend some good tutorials or articles to get me started? I found some, but they confuse me more then they help :-). I think I have an idea how to replace reflection calls, but can't really figure out how to replace dynamic proxies (is there a replacement for InvocationHandler, or something like that?).
    Thanks for any help.

    the MethodHandle javadocs have pretty straightforward examples on usage http://docs.oracle.com/javase/7/docs/api/java/lang/invoke/MethodHandle.html . It looks like you can use Lookup.unreflect to convert a Method to a MethodHandle (this seems like the most straightforward conversion for existing code): http://docs.oracle.com/javase/7/docs/api/java/lang/invoke/MethodHandles.Lookup.html#unreflect(java.lang.reflect.Method) .

  • Dynamic Proxies - being forced to recompile client if server changes

    all,
    I am using WLS 6.1 sp 2.
    I have a bean deployed on a particular instance of Weblogic.
    This bean is being accessed by a bean from a different instance.
    The calling applications ear contains a jar containing the Interface classes, Helper Classes, Stub classes (included since I have read server does not allow dynamic download of stubs), XML (I guess from 6.1 onwards weblogic uses dynamic proxies).
    The problem is that every time my server implementation changes just replacing and redploying the client jar doesn't work. I have to recompile my calling application with the new client jar.
    Regards
    Ashish

    ejp wrote:
    What's that test for? That method only returns null if you write a null. Are you doing that? or are you expecting a null at EOS? You won't get that, you will get an EOFException.The tutorial that I read from said that if the server closes before the client that the client will read a null before it can close. So it throws a EOFException instead of a null at the EOS? How should I modify it then so that it checks for end of file yet still reads the input?
    ejp wrote:
    That should work unless there is something else you haven't shown us. Only other things that I can think of is that both the server and the client are on thier own threads because it is a multi-client server, that is not my actual code from my program (I just removed the parts that won't effect whats going on and are fluff), and that this would be the second time that I am sending that Object to the client. Once when my program starts and then the next in the code example I gave you. But thats pretty much it. I pass other Objects fine between the server and clients, I am just having trouble with this guy. Also, this Object implements Serializable and all Objects contained within it also do as well.
    Edited by: ShadowAssassain on Jul 24, 2008 7:43 AM

  • OS patches necessary for generated code when switching to Studio 10

    Hello,
    Studio 10 requires a couple of OS patches. We wonder, if this requirement also applies to the generated code?
    I'm especially concerned about the SUNWlibC and Linker patches. I'd very much appreciate any help on this!
    Thanks,
    Kai

    The runtime patch fixes a few small bugs in the library, but the major fix is for exception handling on the AMD64 platform. You didn't say originally what platform you were on.
    I would not expect to see this kind of failure with a program built with Sun Studio 10 on Solaris 8.
    This kind of failure can occur if you link any system libraries statically. All system libraries, from /usr/lib or from the compiler installation area, should be linked dynamically. (The shared libraries that ship with the compiler are freely redistributable, as documented in the "runtime.libraries" file in the <install-dir>/READMEs directory.)
    First make sure that in the entire program, including all shared libraries that you use, that system libraries are linked dynamically (.so) and not statically (.a). You might have to inspect the build logs to be sure.
    If static system libraries are not the problem, get the current C++ compiler patch from the Sun Studio patch page
    http://developers.sun.com/prodtech/cc/downloads/patches/index.html
    and see if that helps. If not, and if you have a service contract, your Sun service representative can get you a pre-release version of the C++ runtime library patch 119963-01 for you to try.

  • Error while generating code in brf+ function

    Hi all,
    i am getting error while generating code in function in bRF+
    am using weight fields ..if i dont use quantity fields am able to generate code .
    please help.
    Thanks.

    Can you provide more details? What exactly is the error?
    I think we have provided a note for the issue. With the details it should be possible to identify the note number.

  • OWB Error while generating Code for a mapping

    I have a simple mapping loading from a source to a flat file. When I try to generate code it gives me the following Error
    VLD-2357: Target Data File name not specified for file <target Flat file name>.
    I am new to OWB so any help on the same will be greatly appreciated. How can I specify target Data File name in the mapping configuration under Flat file operators
    Thanks
    Anish

    If you configure the mapping in the UI from the main design tree and select the name of your file operator under the tree node 'Flat File Operators' on the right hand side panel the properties should be displayed - one of these properties is 'Target Data File Name', enter the name of your target data file name.
    Cheers
    David

  • Error while deploying generated code from sup to iPhone

    Hi
    I generated the code using Sap unwired platform for Objective-c.  I followed the steps specified in the below link
    http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc01213.0153/doc/html/mqu1264543829068.html
    for deploying the generated code into iPhone simulator, i am getting the following error
    Undefined symbols:
      "_OBJC_CLASS_$_SUPEntityAlias", referenced from:
          objc-class-ref-to-SUPEntityAlias in SUP101_Customer.o
          objc-class-ref-to-SUPEntityAlias in SUP101_LogRecordImpl.o
    Can any one help me in this
    Edited by: KiranSanka on Dec 2, 2010 1:18 PM
    Edited by: KiranSanka on Dec 3, 2010 7:26 AM

    Hi
    While compiling did you get a warning? something along the line "missing required architecture i386 in fileu201D? if so refer this link http://stackoverflow.com/questions/1456185/build-error-missing-required-architecture-i386-in-file
    Regards
    Jinesh

  • Error while generating code for deployment

    I am getting the following error:
    Error generating findTest1ByMarks(java.lang.Integer) query for Bean Test1(Abstract scheme name=Test1) Error=query cannot be pushed down
    Query="select ..."
    Could someone help me?
    I am trying to generate code of Container Managed Entity Bean in WSAD 5.0.
    Thanks

    If you configure the mapping in the UI from the main design tree and select the name of your file operator under the tree node 'Flat File Operators' on the right hand side panel the properties should be displayed - one of these properties is 'Target Data File Name', enter the name of your target data file name.
    Cheers
    David

  • Auto generated code in makefile

    For our product we have a TCL script that reads a series of text files and generates C++ classes for easy access to database records. Our code has been in use for make years and works very well. We have always used a solaris command prompt dmake to compile, which first generates the C++ files then complies them. It uses a series of enviroment variables which a user must set before compilation.
    I recently tried to create a Sun Studio Express based on NetBeans 6.5.rc1 project from a make file. This has worked for every other makefile except for this one. The others do not have any auto generated code.
    To run sun studio I in a command prompt source in the environments then run netbeans. Then I choose to build the product but I get an error. I then try to copy the command it is running into telnet window and it works fine. Does anyone have an idea on why in the sun studio I get and error while the telnet window works fine.

    I think the problem is that the SunStudio IDE runs the build command in a wrong directory.
    Can you verify that the working directory is correct?
    (it is in project properties: Build > Make)
    Also you can find this directory in the message in the output, when you try to build the project.
    That's the message, that you copied to the terminal window.
    Thanks,
    Nik

  • I have new Adobe premier Elements13 and Photoshop elements 12, but Cannot access website to generate code and register

    I have new Adobe premier Elements13 and Photoshop elements 12, (Download from Amazon) but Cannot access website to generate code and register. Please help if you can.
    I do not know how to find my PC specific code, nor can I simply use another PC if the programs are then only for use on that (not my main) PC!. I have entered the correct serial/codes which came in the download files but simply cannot go further as each time I try it fails to connect with the website?
    Vince

    Please post Photoshop Elements related queries over at
    http://forums.adobe.com/community/photoshop_elements

  • Need help with flashvars in cs5.5 html generated code

    how could use flashvars in cs5.5 html generated code, there are tutorial in net about flashvars but its all cs4 with javascript in it while cs5.5 html code doesn't have. here is the code for non-IE generated by cs5.5
    <!--[if !IE]>-->
    <object type="application/x-shockwave-flash" data="sample.swf" width="800" height="800">
    <param name="movie" value="sample.swf" />
    <param name="quality" value="high" />
    <param name="bgcolor" value="#000000" />
    <param name="play" value="true" />
    <param name="loop" value="true" />
    <param name="wmode" value="window" />
    <param name="scale" value="showall" />
    <param name="menu" value="true" />
    <param name="devicefont" value="false" />
    <param name="salign" value="" />
    <param name="allowScriptAccess" value="sameDomain" />
    <!--<![endif]-->
    <a href="http://www.adobe.com/go/getflash">
    <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
    </a>
    <!--[if !IE]>-->
    how can I put flashvars in html and as3?

    <!--[if !IE]>-->
    <object type="application/x-shockwave-flash" data="sample.swf" width="800" height="800">
    <param name="movie" value="sample.swf" />
    <param name="quality" value="high" />
    <param name="bgcolor" value="#000000" />
    <param name="play" value="true" />
    <param name="loop" value="true" />
    <param name="wmode" value="window" />
    <param name="scale" value="showall" />
    <param name="menu" value="true" />
    <param name="devicefont" value="false" />
    <param name="salign" value="" />
    <PARAM NAME=FlashVars VALUE="imageFilename=images%2Fimage1%2Ejpg">
    <param name="allowScriptAccess" value="sameDomain" />
    <!--<![endif]-->
    <a href="http://www.adobe.com/go/getflash">
    <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.g if" alt="Get Adobe Flash player" />
    </a>
    <!--[if !IE]>-->
    and you can read via flash AS3:
    http://www.permadi.com/tutorial/flashVars/indexAs3.html

  • NoSuchMethodError in findMethodInfo(__methodSig) in ejbc generated code

    Hi All,
    Happy new year!
    Does anyone know when weblogic.ejbc calls "findMethodInfo(__methodSig)" in its
    generated "*HomeImpl.java" classes?
    This is causing my code to end in a NoSuchMethodError exception.
    The generated code for the included beanManaged.AccountHome does not include this
    call, while the code generated for my code does.
    Can anyone tell me why?
    Anyone from the Weblogic people?
    Thanks,
    Boogie

    boogie wrote:
    Rob Woollen <[email protected]> wrote:
    boogie wrote:
    Thanks for the reply, Rob.
    So the "findMethodInfo()" is caused by the presence of multiple interfacesat
    compile time.It's probably caused because ejbc generates code for version 1 of your
    interface
    but you then deploy a jar that loads version 2 of your interface.
    <boogie>
    i'm using the same interface. however, at compile time, the interface is both
    on the classpath (since i've just compiled it) and in the pre-ejbc jar file (which
    i'm passing to weblogic.ejbc).If it's in the classpath and in the ejb.jar, then ejbc finds the version in the classpath and
    generates code against it.
    from what you've said, i gather this is why ejbc
    puts in a "findMethodInfo()" call in the --HomeImpl.java files that it generates.
    </boogie>
    <boogie>
    SCENARIO 1: I use my build script.
    condition: the home interface is found and compiled, the EJB classes placed in
    a temporary jar file, then passed to EJBC (with -keepgenerated flag)
    output: the generated MyBeanHomeImpl.java calls "findMethodInfo()" and i get NoSuchMethodError
    exception at runtime
    If the version in the classpath and the version in the jar file were exactly the same, then ejbc
    would run fine. It fails when they are different. ejbc is generating code for a method that
    appears in the version that it is loading.
    -- Rob
    >
    SCENARIO 2: I manually build.
    condition: i jar the files manually, pass the jar to weblogic.ejbc (with -keepgenerated)
    without specifying a classpath; the current classpath doesn't include the compiled
    home interface;
    output: the generated MyBeanHomeImpl.java doesn't call "findMethodInfo()", code
    runs as expected
    SO, i need to build with scenario 1 AND still make it run at runtime. i don't
    have multiple copies of the EJB classes/interfaces at deployed or in the classpath
    runtime, but i keep getting the NoSuchMethodError exception because of the "findMethodInfo()"
    call that weblogic.ejbc insists on making. what can I do to solve this problem?
    thanks!
    really appreciate the help!
    </boogie>
    -- Rob
    Rob Woollen <[email protected]> wrote:
    There's some sort of mis-match between the interfaces that ejbc is
    finding
    (and
    generating code for) and the interfaces being deployed.
    I would check your classpath and remove all occurrences of the homeinterface
    class. It should only be in the jar file. Then re-run weblogic.ejbc
    -- Rob
    Boogie wrote:
    Hi All,
    Happy new year!
    Does anyone know when weblogic.ejbc calls "findMethodInfo(__methodSig)"in its
    generated "*HomeImpl.java" classes?
    This is causing my code to end in a NoSuchMethodError exception.
    The generated code for the included beanManaged.AccountHome does
    not
    include this
    call, while the code generated for my code does.
    Can anyone tell me why?
    Anyone from the Weblogic people?
    Thanks,
    Boogie

Maybe you are looking for

  • AP Invoice Open Interface Problem

    Hi, Im trying to load invoices through the open interface for AP. I am getting some invoices in but for some reason a large volume of the invoices are being rejected. The open interface is not logging any errors in ap_interface_rejections or on the i

  • I had to create a new Apple ID but it won't let me update apps because my old account keeps showing up how do I stop that

    I had to create a new Apple ID but it won't let me update apps it keeps showing my old account how do I stop that from happening

  • Add-In Installation: check logon.ticket_client (see note 994785)

    Hi all, We have successfully setup BI to portal connectivity and it is working fine with just one exception that is BEx Broadcast is not functional. Step 8 and 12 of RSPOR_SETUP are in RED. STEP 8: Status 8: Configure User Management in Portal      

  • SLD and Management console

    Hello, It seems that both System landscape directory and SAP management console have some overlapping features. The services can be started or stopped in both. Is it true? Does anyone know the difference between these 2 and where does Solution manage

  • Where is apple canada service

    its under warranty and I used the Service and Repair>Request Online Service. The UPS gave me a shipping box for the ipod so the only thing I need to do now is put the ipod in the shipping box and call the UPS for shipping and they will send it now fo