UnmarshalException ClassNotFoundException on method parameter

Context:
- I am running the same app (MyApp.jar) on two machines; they communicate via RMI. Although they are both the same application, I will refer to the "client" and "server" app here, where the client app is that which is making the remote method call.
- The app uses a custom proprietary library Library.jar- The server app invokes a method in the library that initiates the RMI export of Foo and its registration with the remote RMI registry.
- The client app invokes a method in the library with a parameter x of type SomeParameterType. This method invocation causes the stub for remote object Foo to be looked up, and a remote method FooRemote#someMethod(SomeParamaterType) to be invoked passing parameter x.
Results:
- When parameter x is a subtype of SomeParameterType that is included in Library.jar, everything works fine
- When parameter x is a subtype of SomeParameterType that is defined at the app layer and NOT included in Library.jar, the following exception results:
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
     java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
     java.lang.ClassNotFoundException: myapp.SubtypeOfSomeParameterType (no security manager: RMI class loader disabled)I have verified that myapp.SubtypeOfSomeParameterType is in MyApp.jar on both machines.
Other considerations:
-     I am actually channeling RMI over a proprietary communications protocol, but I don�t think this should affect the unmarshalling on the server side
Questions:
-     Is it possible that the unmarshalling is using a class loader that only knows about classes in Library.jar, perhaps because the remote object was exported by a class in that library and not by a class at the app layer.
-     Is there something else I�m not considering?
P.S. I�m hoping for something good from that ejp guy. He seems pretty active on this forum.

OK, I got you. I'll suppose that you are familiar with the mechanics of class loading in Java. If not, then you may want to read the following article first:
http://www-128.ibm.com/developerworks/java/library/j-dyn0429/
The problems may arise if MyApp.jar and Library.jar are loaded by different class loaders on the server side. For example, let me assume that Library.jar is placed into the jre/lib/ext directory and MyApp.jar is placed into the classpath parameter in the command line. In that case, the classes from Library.jar will be loaded using the ExtClassLoader whereas the classes from the MyApp.jar will be loaded using the AppClassLoader, the ExtClassLoaded being actually the parent of the AppClassLoader.
Furthermore, let me assume that the thread exporting the remote server object from Library.jar had it's context class loader set to the ExtClassLoader at the moment it was exported. This can easily be done using the corresponding setter method of the Thread class (note that the main Thread of a standalone Java application has it's context class loader set to the AppClassLoader, what will also be the case for all threads spawned by the main thread unless the context class loader is explicitly set to a different value).
Now let's see what happens when a client makes a call to the server (without dynamic class loading). On the server side, the RMI engine reads bytes from the input stream and starts a thread for serving the request. The context class loader of this thread is the same one as the context class loader of the thread which exported the remote object. In this case, it's ExtClassLoader. So, the RMI engine will try to reconstruct the input parameter using the ExtClassLoader. But, hey, the required class is in the MyApp.jar, loaded by the AppClassLoader, it can not be loaded by the ExtClassLoader. This is where the ClassNotFoundException comes from.
So, here I've illustrated a scenario where you may get a ClassNotFoundException although it seems that all classes are available to the server. Your particular case may of course slightly differ from this scenario, but may have basically the same origin. I'd suggest you to analyse which classes are loaded by which class loaders on the server side and look whether context class loaders are changed for whatever reason.
Regards,
Miran

Similar Messages

  • Invoking a web service - cannot resolve method parameter

    I am getting a failure trying to invoking a method called sl_Access on a web service.
    (Same code worked in Workshop 7.1, but fails in Workshop 8.0. The WDSL has not
    changed.) WLW is not able to revolve a method parameter called piCustNo. The service
    call works in WLW 7.1, but not 8.0.
    Any insight on how to fix this problem?
    The service call
    private AnonType_sl_AccessResponse response = null;
    nlastid = response.piLastId;
    the service definition from wsdlControl.jcx ----
    * @jc:protocol form-post="false" form-get="false" http-soap="true"
    public AnonType_sl_AccessResponse sl_Access (int piCustno);
    console error output -----
    Submitted at Wednesday, October 8, 2003 2:15:22 PM EDT
    Exception in sl_Access
    com.bea.control.ServiceControlException:
    SOAP-ENV:Client
    An error was detected in the Web Service request. (10894)
    Cannot resolve method sl_Access parameter ns:piCustno (10933)e91a6247e9b693c3:-1b6d127:f811fed2db:-8000#17
    at com.bea.wlw.runtime.core.control.ServiceControlImpl.invoke(ServiceControlImpl.jcs:846)
    at com.bea.wlw.runtime.core.dispatcher.DispMethod.invoke(DispMethod.java:359)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:420)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:393)
    at com.bea.wlw.runtime.jcs.container.JcsProxy.invoke(JcsProxy.java:387)
    at $Proxy11.sl_Access(Unknown Source)
    at com.ovid.service.AccessService.getRepl(AccessService.java:93)
    at com.ovid.service.AccessService.processBatch(AccessService.java:71)
    at Controller.runAccess(Controller.jws:399)

    see:
    http://newsgroups.bea.com/cgi-bin/dnewsweb?cmd=article&group=weblogic.developer.interest.workshop&item=1730
    Joe Smith wrote:
    >
    I am getting a failure trying to invoking a method called sl_Access on a web service.
    (Same code worked in Workshop 7.1, but fails in Workshop 8.0. The WDSL has not
    changed.) WLW is not able to revolve a method parameter called piCustNo. The service
    call works in WLW 7.1, but not 8.0.
    Any insight on how to fix this problem?
    The service call
    private AnonType_sl_AccessResponse response = null;
    nlastid = response.piLastId;
    the service definition from wsdlControl.jcx ----
    * @jc:protocol form-post="false" form-get="false" http-soap="true"
    public AnonType_sl_AccessResponse sl_Access (int piCustno);
    console error output -----
    Submitted at Wednesday, October 8, 2003 2:15:22 PM EDT
    Exception in sl_Access
    com.bea.control.ServiceControlException:
    SOAP-ENV:Client
    An error was detected in the Web Service request. (10894)
    Cannot resolve method sl_Access parameter ns:piCustno (10933)e91a6247e9b693c3:-1b6d127:f811fed2db:-8000#17
    at com.bea.wlw.runtime.core.control.ServiceControlImpl.invoke(ServiceControlImpl.jcs:846)
    at com.bea.wlw.runtime.core.dispatcher.DispMethod.invoke(DispMethod.java:359)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:420)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:393)
    at com.bea.wlw.runtime.jcs.container.JcsProxy.invoke(JcsProxy.java:387)
    at $Proxy11.sl_Access(Unknown Source)
    at com.ovid.service.AccessService.getRepl(AccessService.java:93)
    at com.ovid.service.AccessService.processBatch(AccessService.java:71)
    at Controller.runAccess(Controller.jws:399)

  • Field-Symbols as Method Parameter

    Hi all,
    is there a way to create a field symbol within a method and export this field-symbol directly as a method parameter?
    The problem is that we can't pass a field symbol as method parameter unless it's assigned, but we would like to assign the field symbol within a method and give the result back to the calling program.
    We have managed to create a field symbol within the method and give back the result as a reference (we used the type ANY).
    We would like to pass the result field-symbol directly as a Method parameter.
    Any ideas?
    Best regards Dominik

    Hi all,
    thanks for you help. I managed to do the method calls with reference parameters but I'd like to do it with fieldsymbols instead.
    Your suggentions for field-symbold worked, but I could use them only with primitive datatypes.
    In my requirements the table must be created within the method, so the caller doesn't know the tablestructure.
    If a dummy table is assigned to the field-symbol before the call, the error "Two internal tables are neither compatible nor convertible" is produced.
    Is there a solution?
    Thanks in advance
    Dominik
    class ZZX0_CL_TEST definition
      public
      final
      create public .
    public section.
      class-methods FIELD_SYMBOLS_TAB_TEST
        changing
          !FS type ANY .
    METHOD FIELD_SYMBOLS_TAB_TEST .
      DATA: it_t000 TYPE TABLE OF t000.
      FIELD-SYMBOLS <field_symbol> TYPE ANY TABLE.
      ASSIGN it_t000 TO <field_symbol>.
      fs = <field_symbol>.
      EXIT.
    ENDMETHOD.
    REPORT zzx0_mini.
    DATA: it_mara  TYPE TABLE OF mara.
    START-OF-SELECTION.
    * Tabellen test
      FIELD-SYMBOLS: <fs> TYPE STANDARD TABLE.
      ASSIGN it_mara TO <fs>.
    *  ASSIGN it_t000 TO <fs>.
      CALL METHOD zzx0_cl_test=>field_symbols_tab_test
        CHANGING
          fs = <fs>.
      EXIT.

  • Member variable verses method parameter to pass information

    Hi all,
    Is the a performance penalty in using method parameter, such as a String, to pass information into multiple methods( method1(String X), method2(String X), etc ) in a class verses using a class member variable to pass the information to the methods?
    Thanks.

    Never, ever, ever make a decision as to what should be parameter and what should be field based on this kind issue. If the value is reasoably part of the state of the object it should stored (or referenced by) a field. Otherwise it should not and so your left with it being a parameter or an atribute of some other object.
    There is little if any performance cost in passing a parameter (on the order of 10's to 100's of nanoseconds on modern computers and JVM's. Optimizing in this area will only noticeably impact performance of such calls if it needs to get performed 100's of thousands or millions of times per second. That generally excludes everything any of us is likely to write.
    Chuck

  • Method parameter names

    I'm using jwsdp-2.0 and jdk1.4
    my question is
    How can i change method parameter names that generated on WSDL file ?
    when I'm trying to use (-g) option with javac command i have the same result.

    The parameter names aren't included in the bytecode.
    Therefor it is impossible to get them.
    Not with reflection, not with other tools.
    I'm afraid, but you'll have to scan the source.

  • Cannot send complex type as method parameter

    Cannot send complex type as method parameter
    Hi!
    I'm using a kSOAP 1.2 client and i'm having trouble executing a method that takes an object
    of complex type as parameter:
    method:
    public void addSquareDetail(SquareDetail sd){/stuff}
    -SquareDetail is a java bean class that implements KvmSerializable
    - a mapping was added to classmap
    -legacy namespace is not an issue (i AM able to execute the following methods successfully
    over kSOAP):
    -getting one SquareDetail object
    -getting a vector of squareDetail objects
    Here's how i'm trying to call the 'send' method:
         ClassMap classMap = new ClassMap();
    classMap.addMapping("urn:SquareWebService/types", "SquareDetail", (new
    SquareDetail()).getClass());
    System.out.println("add one SquareDetail");
    request = new SoapObject(serviceURN, "addSquareDetail");
    sd = new SquareDetail();
    request.addProperty("SquareDetail_1", sd);
    tx = new HttpTransport(this.endPointURL, "addSquareDetail");
    tx.debug = true;
    tx.setClassMap(classMap);
    tx.call(request); //exception here
    (above:)
    private String endPointURL = "http://localhost:8080/SquareWebService/SquareWebService";
    protected static final String serviceURN = "urn:SquareWebService/wsdl";
    Error(from server, Sun ONE App Server7):
    SoapFault - faultcode: 'env:Server' faultstring: 'Internal Server Error (deserialization
    error: unexpected XML reader state. expected: END but found: START: someInt)' faultactor:
    'null' detail: null
    Here are request/response dumps:
    -request---------
    <SOAP-ENV:Envelope xmlns:n0="urn:SquareWebService/types"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <addSquareDetail xmlns="urn:SquareWebService/wsdl" id="o0" SOAP-ENC:root="1">
    <SquareDetail_1 xmlns="" xsi:type="n0:SquareDetail">
    <someFloat xsi:type="SOAP-ENC:float">1.5</someFloat>
    <someInt xsi:type="xsd:int">-1</someInt>
    <someString xsi:type="xsd:string">someString from SquareDetail</someString>
    <propertyCount xsi:type="xsd:int">4</propertyCount>
    </SquareDetail_1>
    </addSquareDetail>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    response------------
    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns0="urn:SquareWebService/types"
    xmlns:ns1="http://java.sun.com/jax-rpc-ri/internal"
    env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><env:Body><env:Fault><faultcod
    e>env:Server</faultcode><faultstring>Internal Server Error (deserialization error:
    unexpected XML reader state. expected: END but found: START:
    someInt)</faultstring></env:Fault></env:Body></env:Envelope>
    So, apparently, the request message is not understood by the server. what exactly is it
    missing, and how can i add/correct that? (my guess in SquareDetail_1 xmlns="" should be
    "urn:SquareWebService/types", although it's just a guess AND i don't know how to make kSOAP
    get it in there)
    I'm not sure what kind of SOAP parser my app server utilizes, but i'm guessing it's an
    apache product (how can i tell?). I also have a WSDL file available, should anyone be
    willing to look at it, please let me know
    thanks
    -nikita

    Don't know if it will help but Can you check if the serializable object has a public empty no args constructor with an empty call to super()
    Also make sure that a type mapping registry is added with a reference to the serializable object in it.
    Please paste The WSDL as well

  • Default method parameter values

    I really, really think that they should incorporate default method parameter values in the next major release.
    It is time-consuming, obstructing and confusing to have methods with 1...n parameters.
    I.e.
    public void doStuff(int id)
        doStuff(id,"",false,Collections.EMPTY_LIST, new Date());
    public void doStuff(int id, String name)
    doStuff(id,name,false,Collections.EMPTY_LIST, new Date());
    public void doStuff(int id, String name, boolean sort)
    doStuff(id,name,sort,Collections.EMPTY_LIST, new Date());
    public void doStuff(int id, String name, boolean sort, List values)
    doStuff(id,name,sort,values, new Date());
    public void doStuff(int id, String name, boolean sort, List values, Date date)
    doStuff(id,name,sort,values, date);
    }Not to mention the amount of JavaDoc-tags it requires.
    Wouldn't it just be simpler, more understandable and easier to have it as:
    public void doStuff(int id, String name : "", boolean sort : false, List values : Collections.EMPTY_LIST, Date date : new Date())
        //Do the stuff here
    }Suggestions?

    I agree that getting default method parameter values implemented will be a good thing.
    If you really have a large number of methods (>5) that usally just add a parameter with a default value, you could introduce a "Parameter Object" that contains the defaults for the parameters. The drawback is of course an extra indirection to get to the parameter.
    class MyParameterClass() {
      String name = "";
      boolean sort = false;
      List values = Collections.EMPTY_LIST;
      Date date = new Date();
    myMethod(String arga, String argb) {
       return myMethod(arga, argb, new MyParameterClass());
    myMethod(String arga, String argb, MyParameterClass params) {
    }arga and argb are there to illustrate you might have parameters you don't have defaults for. (Yes, you could include them in the constructor of MyParameterClass instead.)

  • How to figure out class of method parameter given a VariableElement?

    Background:
    I have a class that extends AbstractElementVisitor6<String, VisitorContext>
    In visitExecutable() I do something like this...
    try {
        // processingMethod is a member variable of the visitor
        processingMethod = true; 
        MyAnnotation foo = e.getAnnotation(MyAnnotation.class);
        if (foo != null) {
            List<? extends VariableElement> parameters = e.getParameters();
            for (Element enclosee : parameters) {
                enclosee.accept(this, context);
            // do other stuff
            return null;
        return null;
    } finally {
        processingMethod = false;
    }I then end up in visitVariable(VariableElement ve, P). Which is good.
    However, I have been running in circles for at least a day now in the javadoc, trying to figure out how to get from a VariableElement to knowing what the class of the parameter is. I have figured out a way (correct or not) of knowing if it's a primitive type...
    ve.asType() instanceof PrimitiveType But I'm stuck on figuring out what the class of the thing is. The closest thing I can see is if I can somehow turn the VariableElement into a TypeElement, I can use getQualifiedName(), but I'm haven't found that, and I'm not sure if that's the right answer either.
    Here's the pseudocode of visitVariable...
    public String visitVariable(VariableElement e, VisitorContext context) {
        if(processingMethod) {
            // if it's a primitive type - OK
            //  do the right thing
            // else
            //   figure out what the class of e is   HELP!
            //   do the right thing  
            return null;
    }In summary...
    How do I get the class of a method parameter from a VariableElement?
    Thanks

    When would this not be possible? Intersections types. See [JLS 3rd 4.9|http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.9] Specifically
    "It is not possible to write an intersection type directly as part of a program; no syntax supports this."
    Also, I'm curious about the string representation in the first place. I assume there's not direct handout of class objects because we're in the compiler and can't assume that a type is a valid "thing" yet? e.g. it may not have been compiled yetCorrect.
    I was just thinking about how to represent the information, when it occurred to me that I probably ought to just reuse type mirrors and/or elements. Would you recommend this strategy? This is an interesting area of writing annotation processors. In order to apply any (what we call) extra-lingustic constraints and generate error messages when someone breaks the rules, you normally need the elements and types in order to make assertions about types being correct etc. I normally do this in the data collection phase, and don't collect any data for uses that are erroneous. I haven't tried doing the error checking after the collection phase.
    When you are generating the source code, (after all the data is collected) all you need is CharSequences (normally Strings). In fact extracting those from elements and types at the point that is writing the source file can make the code more complex than it needs to be, so I prefer to just have everything in Strings at this point. It makes the code that is generating code a little easier to understand. I often build an inner class to hold all the strings (in fields or in collections as appropriate) which I have collected from each annotated element, so there is some structure there.
    Are there any examples or other advice out there for doing this that you can point to?There are a few examples. Check out the [hickory project on java.net|https://hickory.dev.java.net/] You might find some useful tools there to assist writing your processor (such as prisms ) and [writing you unit tests|https://hickory.dev.java.net/nonav/apidocs/index.html?net/java/dev/hickory/testing/Compilation.html] . Hickory's unit tests include several examples of annotation processors, [this one|https://hickory.dev.java.net/source/browse/hickory/trunk/code/test/net/java/dev/hickory/incremental/ServiceProviderProcessor.java?rev=22&view=markup] illustrates the points I am making, and there are also some in code samples in the javadoc, for example [the same thing again |https://hickory.dev.java.net/nonav/apidocs/index.html?net/java/dev/hickory/incremental/StateSaver.html].
    Bruce

  • Inline Javadoc tag to link to a method parameter description?

    I would like some way to refer to method parameters while writing Javadoc comments.
    Currently, I can have something like:
       * Print a message.
       * @param message The message to print, defaults to <code>"hello world!"</code> if <code>null</code>.
       * @param upperCase If <code>true</code>, <code>message</code> will be converted to {@link String#toUpperCase() upper case} before printing.
      public static final void printMessage(String message, boolean upperCase) {
        String outMessage = (message != null) ? message : "hello world!";
        if (upperCase) outMessage = outMessage.toUpperCase();
        System.out.println(outMessage);
      }The problem is that in the section "@param upperCase If <code>true</code>, <code>message</code>", there is nothing to concretely identify "<code>message</code>" as a parameter, and link it to it's associated @param block description.
    Also, currently, if I refactor my code by renaming the "message" method parameter in Eclipse, it will also automatically rename the Block level @param in the Javadoc, which is great, but fails to notice and similarly rename the <code>message</code> reference in the upperCase description text. This should be fixable with a solution to this.
    An Inline version of @param could be created, like "{@param message the text}" which would work similarily to {@link}, creating a navigable HTML link to the @param block description for the message parameter, with "the text" as the text of the link (optional). This has the slight disadvantage of not being able to link to parameters for other methods. And perhaps overloading @param with different behavior when used as Inline vs Block isn't the best idea, though it could also be named something else ("{@paramlink}" ?).
    Alternatively, the {@link} tag could be extended to allow referencing not just a method, but a parameter somehow. Something like "{@link #printMessage(String, boolean)@message the text}"?

    Hello everyone,
    At the moment the only way to navigate from an app to an Admin section is to rely on document.referrer and build the url where you want to navigate. This approach was already mentioned in this forum, but we also have a functional example in sample applications from bcapi sdk: Redirect to dashboard page, _redirectToDashboard function (line 102).
    redirect_uri query parameter is designed to allow Open Platform applications to have multiple start pages.
    In the future we intend to provide a way to communicate with parent frame through messages. For instance, using the sdk you would be able to do something like:
    BCAPI.sendAdminMessage("redirect_to", {"url": "/Utilities/ShopSettings.aspx"});
    Regards,
    Radu

  • Generic method - UnmarshalException (ClassNotFoundException)

    The mechanism was working fine until I added a generic method to the interface. Now it fails on a call to the new method.
    Here's the relevant code: public interface MyServer extends Remote {
        <T extends pub.beans.Bean> T getBeanAs ( Class<T> clazz, int key )
        throws RemoteException;
    public final class MyServerImpl implements MyServer {
        public synchronized <T extends pub.beans.Bean> T
                     getBeanAs ( final Class<T> clazz, final int key )
        throws RemoteException {
            Object bean = null;
            if( clazz == AbcBean.class )  {
                Abc obj = getObj( key );
                if( obj != null )  {
                    AllBeanTranslator x = new AllBeanTranslator();
                        * Translates an entity bean at the core of obj to external form.
                        * Core Data Object is class AbcDO.
                        * Returned object is class AbcBean.
                    bean = x.translateDO( obj.getData() );
            }  else  {  // ...
            return clazz.cast( bean );
    class Client  {
       public static void main ( final String[] args )
        throws Exception {
            System.setProperty("java.security.policy", "./security.policy" );
            if( System.getSecurityManager() == null ) {
                System.setSecurityManager(new RMISecurityManager());
            MyServer server = (BseServer)Naming.lookup( "MyServer" );
            AbcBean aBean = server.getBeanAs( AbcBean.class, 48 );
    // exception ^^^
    }This throws an exception on a class that the Client should know nothing about: AbcDO. The AbcBean hierarchy never references it. Here's the exception stack: Exception in thread "main" java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
         java.lang.ClassNotFoundException: beans.AbcDO
         at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:178)
         at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:178)
         at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
         at $Proxy0.getBeanAs(Unknown Source)
         at Client.main(Client.java:61)
    Caused by: java.lang.ClassNotFoundException: beans.AbcDO
         at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:247)
         at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:434)
         at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
         at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
         at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
         at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197)
         at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575)
         at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
         at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
         at java.beans.PropertyChangeSupport.readObject(PropertyChangeSupport.java:478)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
         at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1849)
         at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
         at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
         at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
         at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
         at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
         at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
         at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
         at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:306)
         at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:155)
         ... 4 moreAnother thing that puzzles me: Why no stub? When I saw that I turned on Stub Generation (I'm using Genady's RMI Eclipse Plug-in) but that caused a world of problems so I turned it back off.

    Just making them transient isn't the end of the solution, btw,
         * ChangeSupport serializes any serializable listeners.
         * If the listener is serializable but unknown to the codebase
         * causes UnmarshalException so best make these transient.
        protected transient PropertyChangeSupport pcs;
        protected transient VetoableChangeSupport vcs;After de-serialization pcs and vcs are null and of course the listeners are gone. AbcDO class uses events internally so they need to be re-established. Here's what I did, though I can think of at least two other solutions.
      // Normal constructor - not run during de-serialization
      protected AbcDO ( )  { 
          this.pcs = new PropertyChangeSupport( this );
          addPropertyChangeListener( this );
          this.vcs = new VetoableChangeSupport( this );
          addVetoableChangeListener( new AbcValidator() );
          this.SubObj = new SubObj ();
          this.SubObj .addPropertyChangeListener( this );
       * Re-establish transients after de-serialization.
       * Note how much this looks like the ctor.
       * @return this ready to rock again
       * @throws ObjectStreamException
      private Object readResolve ( )  throws ObjectStreamException  {
          this.pcs = new PropertyChangeSupport( this );
          addPropertyChangeListener( this );
          this.vcs = new VetoableChangeSupport( this );
          addVetoableChangeListener( new AbcValidator() );
          if( this.SubObj != null ) // should be impossible - subObj is final
              this.SubObj .addPropertyChangeListener( this );
          return this;
      }     Note that readResolve() may not be appropriate for a non-final class (see Effective Java). Note also that subObj needs its PropertyChangeSupport re-established.

  • Bind an inputFile value to a data control methods parameter

    Hello I am trying to create a InputFile (ADF Faces) which is linked to a data control method. The method reads a specified file and returns the content which is then displayed in table form.
    <br><br>
    I have a filereader Class with the following method:
    <i>public List<FileInQuestion> returnFileContents(String fileName)</i>
    <br><br>
    I have created a data control based on this Class. From the JSF page, under the data control palette I can drag on may parameter 'FileName' (as input text) and my method (as command button) and finally the return type 'FileInQuestion' (as read only table). This all works fine and when I type a filename in and hit the button it displays the contents in a table.
    <br><br>
    Now the problem is that I want to base the input parameter on the value of the InputFile component. But when I drag and drop the 'fileName' parameter onto the canvas, it doesn't give me the option to create as an input file!
    <br><br>
    Please could someone tell me how I manually link (bind) the inputFile component to the 'fileName' parameter?
    <br><br>
    Sorry if a bit long winded!!
    <br><br>
    Thanks Dan
    Message was edited by:
    user593073

    Thanks Frank but I need to get at the text value returned from the inputfile component. I did what you said with the following results:
    <br><br>
    I started with a inputtext field, command button and read only table. When I entered a value (in this case 'C:\data\contacts.txt' ) into the inputtext field and hit the command button the table displayed the expected results (for logic please see my 1st post).
    <br><br>
    I then convert the inputtext component to a inputfile component in the way you suggested. I now rerun the application, browse to the same file and hit the command button, and then nothing!! no results.
    <br><br>
    I'm I missing something here?
    <br><br>
    Thanks
    <br><br>
    Dan

  • ABAP OO: how to pass a internal table with objects as a method parameter

    Hello all,
    I have a class "ZCL_VEHICLE", this class contains the attribute WHEELS.
    This attribute contains objects of the class ZCL_WHEEL.
    (definition: data WHEELS TYPE TABLE OF REF TO zcl_wheel.).
    I now need a method that gives this table back (as return or export parameter). How can I define a parameter for this method that will contain this table?
    Thanks for the help.
    Best regards,
    Wim

    Hi Wim
    Excuse me! I understood you wanted to define it in a program, not in a class.
    You can define your type into CLASS (use the same statament: go to TYPES (there's a pushbotton on status gui).
    TYPES: MY_WHEELS TYPE TABLE OF REF TO .....
    Now you can use this type to create a parameter like that, but you can use that type for an object of class defined as PRIVATE.
    Infact if your object is public, you'll use it in a your program, so you'll probably have to define a variable like the type defined in the class.
    It shouldn't make sense to define the same type for two times or more (one in the class, the others in each program uses your class). So you should define your type in dictionary (all abap object could use it).
    If you think to have to use your class in few program (perhaps in olny one), you shuold consider to create your class as local class.
    Max
    Message was edited by: max bianchi

  • Method parameter & variable in program - "is not type compatible"

    Hi All,
    Sorry for my dummy question but by checking a few threads I couldn't find answer.
    I have a method with a paramter and calling it I get error message:
    "variable" is not type-compatible with formal parameter "parameter"
    'variable' --> data element: 'zchar2' (CHAR 2)
    'parameter' --> data element: 'zchar10' (CHAR 10)
    It's clear that 'zchar2' and 'zchar10' are different.
    What is not clear to me why cannot I import a 2 character string into a parameter of 10 characters.
    There's no error if I change the parameter's type from 'zchar10' to 'c' in the method. However I don't want this since the parameter must have 10 characters or less (and no more).
    How can I define the parameter in the method properly (I don't want to manipulate 'variable')? What is the solution?
    Thanks,
    Csaba
    Additionally:
    Tried char10, string10 - it didn't help...
    Edited by: Csaba Szommer on Mar 19, 2011 7:17 PM

    Naveen,
    Thanks for your answer.
    I want to import char2 from program (from where the method is called) into the method via a char10 parameter (export / import depends on from which point we see it).
    CALL METHOD dummy=>dummy
      EXPORTING parameter (remark: char10) = variable (remark: char2).
    Thanks,
    Csaba
    Edited by: Csaba Szommer on Mar 19, 2011 7:25 PM

  • ABAP objects, drilling down into methods/parameter/method/parameter...

    Hello all,
    When creating or changing purchase orders using the enjoy transactions ME21N and ME22N, I want to force the users to have the same delivery address on every line item. I have found and activated the BADI ME_PROCESS_PO_CUST. I have added some code in method CHECK and put a breakpoint on that code. The transaction is stopping on my breakpoint. So far so good.
    Parameter IM_HEADER is of type IF_PURCHASE_ORDER_MM,
    that has method GET_ITEMS,
    that has parameter RE_ITEMS that is a table of  of type PURCHASE_ORDER_ITEMS,
    method GET_DATA
    with parameter RE_DATA
    with fields ADRNR &  ADRN2
    From inside of the method CHECK of BADI, what syntax do I need to create an internal table of the line item fields that are in parameter RE_DATA of method GET_DATA?  I am just starting to work with ABAP objects.  Any help would be greatly appreciated.
    Thanks
    Bruce

    Uwe,  thanks for the quick response.
    Your solution,
    DATA: lt_items      TYPE purchase_order_items,
               ls_item       TYPE purchase_order_item.
    CALL METHOD im_header->get_items
       receiving
         re_items = lt_items.
    Short version:
      lt_items = im_header->get_items( ).
      LOOP AT lt_items INTO ls_item.
      do something
      ENDLOOP.
    got me very close to the solution.  The table lt_items contain the number of entries corresponding to the actual line items.  But the data element ls_item does not contain the fields I'm expecting from:
    method GET_DATA ,
    parameter RE_DATA,
    type MEPOITEM.
    How do I populate ls_item with the 197 fields from structure MEPOITEM?
    If I knew more about ABAP objects, I'm sure I could easily change the code myself.  But today, I need the generosity of others to help me solve this.
    Thanks
    Bruce

  • Why method parameter end with three dots

    i generate hibernate pojos + hybernate mapping + dao. in dao class i have some doubt in coding please clear.
    package org.triology.blog.hibernate;
    import org.triology.blog.GenericDAO;
    import java.io.Serializable;
    import java.lang.reflect.ParameterizedType;
    import java.util.List;
    import java.util.Map;
    import org.hibernate.Criteria;
    import org.hibernate.FlushMode;
    import org.hibernate.Query;
    import org.hibernate.LockMode;
    import org.hibernate.Session;
    import org.hibernate.criterion.Restrictions;
    import org.hibernate.criterion.Criterion;
    import org.hibernate.criterion.Example;
    * Generated at Wed Jul 30 16:57:35 IST 2008
    * @author Salto-db Generator v1.0.16 / Pojos + Hibernate mapping + Generic DAO
    * @see http://www.hibernate.org/328.html
    public abstract class AbstractHibernateDAO<T, ID extends Serializable> implements GenericDAO<T, ID> {
    private Session session;
    private Class<T> persistentClass;
    public AbstractHibernateDAO() {
    this.persistentClass = (Class<T> ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
    public void setSession(Session session) {
    this.session = session;
    protected Session getSession() {
    if (session == null)
    session = HibernateUtil.getSessionFactory().getCurrentSession();
    return session;
    public Class<T> getPersistentClass() {
    return persistentClass;
    @SuppressWarnings("unchecked")
    public T getById(ID id) {
    return (T) getSession().get(getPersistentClass(), id);
    @SuppressWarnings("unchecked")
    public T getById(ID id, boolean lock) {
    if (lock) {
    return (T) getSession().get(getPersistentClass(), id,
    LockMode.UPGRADE);
    } else
    return getById(id);
    @SuppressWarnings("unchecked")
    public T loadById(ID id) {
    return (T) getSession().load(getPersistentClass(), id);
    public void save(T entity) {
    getSession().save(entity);
    public void update(T entity) {
    getSession().update(entity);
    public void saveOrUpdate(T entity) {
    getSession().saveOrUpdate(entity);
    public void delete(T entity) {
    getSession().delete(entity);
    public void deleteById(ID id) {
    getSession().delete(loadById(id));
    @SuppressWarnings("unchecked")
    public List<T> findAll() {
    return findByCriteria();
    * Use this inside subclasses as a convenience method.
    @SuppressWarnings("unchecked")
    protected List<T> findByCriteria(Criterion... criterion) {
    Criteria crit = getSession().createCriteria(getPersistentClass());
    for (Criterion c : criterion) {
    crit.add(c);
    return crit.list();
    * Find by criteria.
    @SuppressWarnings("unchecked")
    public List<T> findByCriteria(Map criterias) {
    Criteria criteria = getSession().createCriteria(getPersistentClass());
    criteria.add(Restrictions.allEq(criterias));
    return criteria.list();
    * This method will execute an HQL query and return the number of affected entities.
    protected int executeQuery(String query, String namedParams[], Object params[]) {
    Query q = getSession().createQuery(query);
    if (namedParams != null) {
    for (int i = 0; i < namedParams.length; i++) {
    q.setParameter(namedParams, params[i]);
    return q.executeUpdate();
    protected int executeQuery(String query) {
    return executeQuery(query, null, null);
    * This method will execute a Named HQL query and return the number of affected entities.
    protected int executeNamedQuery(String namedQuery, String namedParams[], Object params[]) {
    Query q = getSession().getNamedQuery(namedQuery);
    if (namedParams != null) {
    for (int i = 0; i < namedParams.length; i++) {
    q.setParameter(namedParams[i], params[i]);
    return q.executeUpdate();
    protected int executeNamedQuery(String namedQuery) {
    return executeNamedQuery(namedQuery, null, null);
    @SuppressWarnings("unchecked")
    public List<T> findByExample(T exampleInstance, String[] excludeProperty) {
    Criteria crit = getSession().createCriteria(getPersistentClass());
    Example example = Example.create(exampleInstance).excludeZeroes().enableLike().ignoreCase();
    for (String exclude : excludeProperty) {
    example.excludeProperty(exclude);
    crit.add(example);
    return crit.list();
    in above class my doubt is
    * Use this inside subclasses as a convenience method.
    @SuppressWarnings("unchecked")
    protected List<T> findByCriteria(Criterion... criterion) {
    Criteria crit = getSession().createCriteria(getPersistentClass());
    for (Criterion c : criterion) {
    crit.add(c);
    return crit.list();
    why we pass findByCriteria parameter end with three dots (Criterian...)
    Edited by: BalaTTPL on Jul 31, 2008 8:53 AM

    protected List<T> findByCriteria(Criterion... criterion) {
        Criteria crit = getSession().createCriteria(getPersistentClass());
        for (Criterion c : criterion) {
            crit.add(c);
        return crit.list();
    }The "Criterion..." argument just means that you can call the method with any number (zero or more) of Criterion references. Within the method criterion is treated like an array - for instance in the for loop.
    The notation is known as "varargs" and is described in the JDK1.5 [Tech notes|http://java.sun.com/javase/6/docs/technotes/guides/language/varargs.html].

Maybe you are looking for

  • How to organize/configure email accounts on iMac

    I'm a brand new Mac user, and I really would appreciate some opinions on how to efficiently organize/configure my email accounts. -previously on Windows XP at home and work, I had an 'office email' address and and a family email address at home that

  • UGH. many problems, after 3 replacements during the summer

    So, during summer i got 3 replacements, about 7 days apart, after first getting it. A few months ago it started being ridiculous again. Problems: 1) I've used the DVD drive (it's a burner too) 4 times. 2 of those times i had to reinstall the OS; I th

  • Access a file

    Hello, i have big problem. I want to read a file and i don't know the location. I have a jar file and i don't know its location. In the jar file is a class which need to read a text file. The text file is in the same directory. Maybe my configuration

  • Taglib validator error

              Hi           I am using WLS8.1 on win2k. When requesting a JSP page, I get the error below.           The same page works fine in WLS 6.1.           Ideas would be appreciated.           Cheers           Matt           java.io.IOException:

  • ASP url, post method

    Hi all, I' m working on a web crawler to crawl information about company. I need to get information from a web company register http://www.ur.sk. Url with all needed information looks like this one: http://www.ur.sk/index.asp?lang=&stranka=3&ID=0&ico