Using Reflection - Method.invoke()

Hi all,
Facing a problem in using the Reflection API. Can anyone tell me how to use the invoke, which is available with Method. Problem statement. - I want to create a method. And then invoke that method using method1. invoke. But this can take only the following arguments - (Object, Object [ ] ). I cant figure out why I need to pass on an object ? and an array of objects ?

If you read the docs for Method.invoke, you'll see that the first argument is the object on which you wish to invoke the method, and the second argument is the parameters (with primitives wrapped appropriately).
foo.bar("abc", 123);
// becomes
meth.invoke(foo, new Object[] {"abc", new Integer(123) }); (if I haven't screwed up the syntax of the array initialization)
http://java.sun.com/docs/books/tutorial/reflect/

Similar Messages

  • Using java.lang.reflect.Method.invoke on a static method?

    This is probably a FAQ, but I am finding it impossible to construct a search which answers this question for me.
    How do I call java.lang.reflect.Method.invoke on a static (e.g. class) method? Is it even possible?
    Thanks,
    dwh

    Is this of any help?
    http://www.esus.com/javaindex/j2se/jdk1.2/javalang/reflection/reflection.html
    Cheers,
    Joris

  • How to stop/kill/interrupt a thread stuck on reflection method invoke

    Hi all,
    I have a thread that loads some class using reflection and invokes a method in it.
    I want to be able to stop that thread if needed by the user.
    For some reason, interrupt on that thread doesn't do anything - thread is still inside the invoke call.
    Is there any way to stop it?

    The only really safe way to have isolated code is to a seperate process you can kill.
    I wouldn't suggest using Thread.stop unless you have to, but that may be the case here. Stopping the thread this way might be worse than just discarding the Thread and moving on. (depending on what it is doing) i.e. another option is to ignore the thread and hope it doesn't matter. ;)
    However, before you do that I suggest you call Thread.getStackTrace() and log it. This can be useful in diagnosing WHY your thread needed to be kill and possibly give you a chance to fix it next time.

  • How to use java.lang.Class.getMethod() and java.lang.reflect.Method.invoke(

    I want to call a specified method of one class dynamically. I use the method
    "getMethod()" in package "java.lang.Class" to get method and "invoke()" in
    " java.lang.reflect.Method " to invoke method.
    The problem is as following :
    1. There are two argument in this method "getMethod(String MethodName , Class[] paremterTypes)" in package "Class". I have no idea about the second parameter " Class[] parameterTypes ".what does the argument exactly mean ?
    2. There are two argument in the method "invoke(object obj, object[] obj)" in package "Method".
    I have no idea about the second parameter "object[] obj ".what is mean ?
    I pass " null " value to it and it works.But i pass anothers ,jvm will throw exception.

    I have a generic Method Executer that has a method like
    public Object execute(String className, String methodName, Object args)
        String fullClassName = packageName + className ;
        Class delegateClass = Class.forName(fullClassName);
        BaseDelegate delegate = (BaseDelegate)delegateClass.newInstance();
        Method method = null;
        if (args == null)
            method = delegateClass.getMethod(methodName, new Class[] {});
            obj = method.invoke(delegate,new Object[] {});
        else
            method = delegateClass.getMethod(methodName, new Class[] {args.getClass()});
            obj = method.invoke(delegate, new Object[]{args});
       }This seems to have problems when I call the method from a class like:
    execute("CategoryDelegate", "getCategoryById", new Integer(4144));(I get a NoSuchMethodException)
    The method I am trying to execute in CategoryDelegate looks like:
    public Category getCategoryById(int categoryId) throws DelegateExceptionI think it has to deal with the difference in the way we handle Primitive Wrappers and Objects. Wrapper we have to use Interger.TYPE and with the rest of the Objects we have to use obj.class.
    Am I doing something wrong here? Any suggestions to make it work for primitive wrappers as well as Objects?

  • Problem in using the MBean.invoke() method

    I am using the method call:
    MBeanServer.invoke() which calls an appropriate method on the Remote MBean which is a synchronous call. However if the remote method takes longer than 5 seconds to execute, I get the following error
    javax.management.ReflectionException
         at org.jingle.jmxremote.server.RemoteDynamicMBean.invoke(RemoteDynamicMBean.java:317)
         at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(Unknown Source)
         at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(Unknown Source)
         at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(Unknown Source)
         at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(Unknown Source)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at com.sun.jmx.mbeanserver.StandardMetaDataImpl.invoke(Unknown Source)
         at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(Unknown Source)
         at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(Unknown Source)
         at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(Unknown Source)
         at com.sun.jmx.remote.ws.server.actions.JMXInvokeManagedResourceOperationAP.processAction(JMXInvokeManagedResourceOperationAP.java:80)
         at javax.management.remote.ws.JMXManagementProcessor.processManagement(JMXManagementProcessor.java:268)
         at javax.management.remote.ws.JMXManagementProcessor.processManagement(JMXManagementProcessor.java:203)
         at javax.management.remote.ws.JMXServiceEndpoint.invoke(JMXServiceEndpoint.java:127)
         at javax.management.remote.ws.JMXServiceEndpoint.invoke(JMXServiceEndpoint.java:55)
         at com.sun.xml.ws.server.provider.ProviderPeptTie._invoke(ProviderPeptTie.java:63)
         at com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher.invokeEndpoint(SOAPMessageDispatcher.java:278)
         at com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher$SoapInvoker.invoke(SOAPMessageDispatcher.java:586)
         at com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher.receive(SOAPMessageDispatcher.java:141)
         at com.sun.xml.ws.server.Tie.handle(Tie.java:88)
         at com.sun.xml.ws.transport.http.server.WSHttpHandler.process(WSHttpHandler.java:171)
         at com.sun.xml.ws.transport.http.server.WSHttpHandler.handleExchange(WSHttpHandler.java:119)
         at com.sun.xml.ws.transport.http.server.WSHttpHandler.handle(WSHttpHandler.java:95)
         at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:65)
         at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:56)
         at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:68)
         at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:513)
         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.InterruptedException
         at org.jingle.jmxremote.server.ResultContainer.hasException(ResultContainer.java:89)
         at org.jingle.jmxremote.server.RemoteDynamicMBean.invoke(RemoteDynamicMBean.java:306)
         ... 35 more
    Could you please help me in resolving this issue:
    Is this 5 second time out configurable?
    Is there some way I can by pass this problem?

    jingle is an implementation of the jmx-remote interface.
    The jingle implementation allows you to create an proxy of the MBeanServer on the MBean side. So the MBeanServer methods can be called using this proxy object rather than the the MBeanServerConnection object.
    The reason i am using this proxy object is because i want to register the mbean to the remote mbean server.

  • Working around unchecked conversions when using reflection

    I think I've convinced myself that there's no way around this issue when using reflection and Generics, but here's the issue:
    Suppose I've got a method that uses reflection to compare an arbitrary property in
    an arbitrary pair of beans (of the same class).
    public static <T> int compare(T bean0, T bean1, String prop) throws Exception {
         Method m = bean0.getClass().getMethod(
                   "get" + prop.substring(0,1).toUpperCase() +
                   prop.substring(1));
         Object o0 = m.invoke(bean0);
         Object o1 = m.invoke(bean1);
         if (o0 instanceof Comparable &&
             o1 instanceof Comparable &&
             (o1.getClass().isAssignableFrom(o0.getClass()) ||
              o0.getClass().isAssignableFrom(o1.getClass()))) {
              return ((Comparable)o0).compareTo(o1); // compiler warning
         } else {
              return o0.toString().compareTo(o1.toString());
    }There's no way that, in general, when using reflection to invoke methods, that you can coerce the types to avoid compile-time type safety warnings. I think the above code is guarranteed not to throw a runtime ClassCastException, but there's no way to write the code so that the compiler can guarrantee it. At least that's what I think. Am I wrong?

    Ok it looks like you're dealing with a classloader issue. when you call that method, it is the equivelant of calling
    Class.forName("Box", true, this.getClass().getClassLoader())The exception is thrown when your class's classloader cannot find the class box. try putting 'null' there
    Class.forName("Box", true, null)and it will request the bootstrap classloader to load the class. just make sure you have permission :
    If the loader is null, and a security manager is present, and the caller's class loader is not null, then this method calls the security manager's checkPermission method with a RuntimePermission("getClassLoader") permission to ensure it's ok to access the bootstrap class loader. (copied from the API)

  • Method.invoke causes IllegalArgumentException with subclass instance

    Is there a way to use an instance of a subclass when using reflection to invoke a method?
    Given the following code, I want to be able to use reflection to invoke the "doSomething" method within the Foo class. However, I want to use an instance of Bar as the parameter value when using reflection (since an instance of Bar is implicitly an instance of Foo; I have also tried casting the Bar instance, b, to Foo but this does not work). Doing this yields an IllegalArgumentException.
    What am I missing? What am I doing wrong? What do I have to do in order to use an instance of Bar with "invoke"?
    // Foo.java
    package junk;
    public class Foo
        private void doSomething(Foo f)
            System.out.println("Doing something with a " + f.getClass().getName());
        public static void main(String[] args)
            Foo f = new Foo();
            Bar b = new Bar();
            f.doSomething(f);   // Outputs "Doing something with a junk.Foo"
            f.doSomething(b);   // Outputs "Doing something with a junk.Bar"
            Class[] paramTypes = new Class[] { f.getClass() };
            Object[] paramValues = new Object[] { b };
            b.invokePrivateFooMethod("doSomething", paramTypes, paramValues); // Doesn't work
    // Bar.java
    package junk;
    import java.lang.reflect.Method;
    import java.lang.reflect.InvocationTargetException;
    public class Bar extends Foo
        public void invokePrivateFooMethod(String methodName,
                                           Class[] paramTypes,
                                           Object[] paramValues)
            try
                Foo localF = new Foo();
                Class classToUse  = localF.getClass();
                Method methodToUse = classToUse.getDeclaredMethod(methodName, paramTypes);
                methodToUse.setAccessible(true);    // override of private modifier
                methodToUse.invoke(classToUse, paramValues);
            catch (IllegalAccessException e)
                e.printStackTrace();
            catch (NoSuchMethodException e)
                e.printStackTrace();
            catch (InvocationTargetException e)
                e.printStackTrace();
    }

    Sorrry for the confusion. It's always the little things...
    I neglected to use an instance of Foo to invoke the method.
    See corrected code below:
    // Bar.java
    package junk;
    import java.lang.reflect.Method;
    import java.lang.reflect.InvocationTargetException;
    public class Bar extends Foo
        public void invokePrivateFooMethod(String methodName,
                                           Class[] paramTypes,
                                           Object[] paramValues)
            try
                Foo localF = new Foo();
                Class classToUse  = localF.getClass();
                Method methodToUse = classToUse.getDeclaredMethod(methodName, paramTypes);
                methodToUse.setAccessible(true);    // override of private modifier
                // NOTE:  Use localF, NOT classToUse!
                methodToUse.invoke(localF, paramValues);
            catch (IllegalAccessException e)
                e.printStackTrace();
            catch (NoSuchMethodException e)
                e.printStackTrace();
            catch (InvocationTargetException e)
                e.printStackTrace();
    }

  • NullPointerException thrown when using get method in CMR relationship outsi

    We are using weblogic 9.1 CMP entity beans with BEA's XA oracle driver. We have a bean called User that has a many address beans. When calling the getAddresses method on a UserLocal a NullPointerException gets thrown if the stateless session bean method that is marked as @LocalMethod(transactionAttribute=Constants.TransactionAttribute.SUPPORTS). If we change it to REQUIRED the method returns addresses successfully. Does anyone have any ideas as to what could be causing this? Below is the stack trace.
    My best guess is that an exception is occurring and when weblogic tries to handle the exception EJBRuntimeUtils.throwEJBException encounters the NullPointerException.
    javax.ejb.EJBException: EJB Exception: : java.lang.NullPointerException
    at gov.nasa.echo.dataaccessobjects.user.echo_user_User_l47u68__WebLogic_CMP_RDBMS_addresses_Set.<init>(echo_user_User_l47u68__WebLogic_CMP_RDBMS_addresses_Set.java
    :93)
    at gov.nasa.echo.dataaccessobjects.user.echo_user_User_l47u68__WebLogic_CMP_RDBMS.getAddresses(echo_user_User_l47u68__WebLogic_CMP_RDBMS.java:1161)
    at gov.nasa.echo.dataaccessobjects.user.echo_user_User_l47u68_ELOImpl.getAddresses(echo_user_User_l47u68_ELOImpl.java:770)
    at gov.nasa.echo.subsystems.user.UserTypeMap.convertUser(UserTypeMap.java:66)
    at gov.nasa.echo.subsystems.user.UserSubsystem.getUserByUserId(UserSubsystem.java:321)
    at gov.nasa.echo.subsystems.user.UserSubsystem.getUsersByUserId(UserSubsystem.java:302)
    at gov.nasa.echo.services.authentication.AuthenticationServiceBean.login(AuthenticationServiceBean.java:442)
    at gov.nasa.echo.services.authentication.AuthenticationServiceBean_plcr77_ELOImpl.login(AuthenticationServiceBean_plcr77_ELOImpl.java:1001)
    at gov.nasa.echo.v8.AuthenticationServicePortImpl.login(AuthenticationServicePortImpl.java:105)
    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:585)
    at weblogic.wsee.component.pojo.JavaClassComponent.invoke(JavaClassComponent.java:91)
    at weblogic.wsee.ws.dispatch.server.ComponentHandler.handleRequest(ComponentHandler.java:68)
    at weblogic.wsee.handler.HandlerIterator.handleRequest(HandlerIterator.java:127)
    at weblogic.wsee.ws.dispatch.server.ServerDispatcher.dispatch(ServerDispatcher.java:84)
    at weblogic.wsee.ws.WsSkel.invoke(WsSkel.java:60)
    at weblogic.wsee.server.servlet.SoapProcessor.handlePost(SoapProcessor.java:66)
    at weblogic.wsee.server.servlet.SoapProcessor.process(SoapProcessor.java:44)
    at weblogic.wsee.server.servlet.BaseWSServlet$AuthorizedInvoke.run(BaseWSServlet.java:124)
    at weblogic.wsee.server.servlet.BaseWSServlet.service(BaseWSServlet.java:53)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:225)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:127)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:272)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:165)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3153)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:1973)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1880)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1310)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:179)
    ; nested exception is: java.lang.NullPointerException
    at weblogic.ejb.container.internal.EJBRuntimeUtils.throwEJBException(EJBRuntimeUtils.java:141)
    at weblogic.ejb.container.internal.BaseLocalObject.handleSystemException(BaseLocalObject.java:643)
    at weblogic.ejb.container.internal.BaseLocalObject.handleSystemException(BaseLocalObject.java:604)
    at weblogic.ejb.container.internal.BaseLocalObject.postInvoke1(BaseLocalObject.java:347)
    at weblogic.ejb.container.internal.BaseLocalObject.postInvokeTxRetry(BaseLocalObject.java:286)
    Truncated. see log file for complete stacktrace

    Jason Gilman wrote:
    We are using weblogic 9.1 CMP entity beans with BEA's XA oracle driver. We have a bean called User that has a many address beans. When calling the getAddresses method on a UserLocal a NullPointerException gets thrown if the stateless session bean method that is marked as @LocalMethod(transactionAttribute=Constants.TransactionAttribute.SUPPORTS). If we change it to REQUIRED the method returns addresses successfully. Does anyone have any ideas as to what could be causing this? Below is the stack trace
    My best guess is that an exception is occurring and when weblogic tries to handle the exception EJBRuntimeUtils.throwEJBException encounters the NullPointerException.
    Open an official support case. This has nothing to do with jdbc.
    Joe
    >
    >
    javax.ejb.EJBException: EJB Exception: : java.lang.NullPointerException
    at gov.nasa.echo.dataaccessobjects.user.echo_user_User_l47u68__WebLogic_CMP_RDBMS_addresses_Set.<init>(echo_user_User_l47u68__WebLogic_CMP_RDBMS_addresses_Set.java
    :93)
    at gov.nasa.echo.dataaccessobjects.user.echo_user_User_l47u68__WebLogic_CMP_RDBMS.getAddresses(echo_user_User_l47u68__WebLogic_CMP_RDBMS.java:1161)
    at gov.nasa.echo.dataaccessobjects.user.echo_user_User_l47u68_ELOImpl.getAddresses(echo_user_User_l47u68_ELOImpl.java:770)
    at gov.nasa.echo.subsystems.user.UserTypeMap.convertUser(UserTypeMap.java:66)
    at gov.nasa.echo.subsystems.user.UserSubsystem.getUserByUserId(UserSubsystem.java:321)
    at gov.nasa.echo.subsystems.user.UserSubsystem.getUsersByUserId(UserSubsystem.java:302)
    at gov.nasa.echo.services.authentication.AuthenticationServiceBean.login(AuthenticationServiceBean.java:442)
    at gov.nasa.echo.services.authentication.AuthenticationServiceBean_plcr77_ELOImpl.login(AuthenticationServiceBean_plcr77_ELOImpl.java:1001)
    at gov.nasa.echo.v8.AuthenticationServicePortImpl.login(AuthenticationServicePortImpl.java:105)
    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:585)
    at weblogic.wsee.component.pojo.JavaClassComponent.invoke(JavaClassComponent.java:91)
    at weblogic.wsee.ws.dispatch.server.ComponentHandler.handleRequest(ComponentHandler.java:68)
    at weblogic.wsee.handler.HandlerIterator.handleRequest(HandlerIterator.java:127)
    at weblogic.wsee.ws.dispatch.server.ServerDispatcher.dispatch(ServerDispatcher.java:84)
    at weblogic.wsee.ws.WsSkel.invoke(WsSkel.java:60)
    at weblogic.wsee.server.servlet.SoapProcessor.handlePost(SoapProcessor.java:66)
    at weblogic.wsee.server.servlet.SoapProcessor.process(SoapProcessor.java:44)
    at weblogic.wsee.server.servlet.BaseWSServlet$AuthorizedInvoke.run(BaseWSServlet.java:124)
    at weblogic.wsee.server.servlet.BaseWSServlet.service(BaseWSServlet.java:53)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:225)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:127)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:272)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:165)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3153)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:1973)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1880)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1310)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:179)
    ; nested exception is: java.lang.NullPointerException
    at weblogic.ejb.container.internal.EJBRuntimeUtils.throwEJBException(EJBRuntimeUtils.java:141)
    at weblogic.ejb.container.internal.BaseLocalObject.handleSystemException(BaseLocalObject.java:643)
    at weblogic.ejb.container.internal.BaseLocalObject.handleSystemException(BaseLocalObject.java:604)
    at weblogic.ejb.container.internal.BaseLocalObject.postInvoke1(BaseLocalObject.java:347)
    at weblogic.ejb.container.internal.BaseLocalObject.postInvokeTxRetry(BaseLocalObject.java:286)
    Truncated. see log file for complete stacktrace

  • Problem to calling readObject(java.io.ObjectInputStream) using reflection

    Hi,
    I am facing the following problem
    I have an Employee class its overridden the following below methods
    private void readObject(java.io.ObjectInputStream inStream) {
         inStream.defaultReadObject();
    I am trying to call this method using reflection.
    my code is like this
         Class fis= Class.forName("java.io.FileInputStream");
         Constructor fcons = fis.getConstructor(new Class[]{String.class});
         Object fisObj = fcons.newInstance(new Object[]{"C:\\NewEmployee.ser"});
         Class ois= Class.forName("java.io.ObjectInputStream");     
         Constructor ocons = ois.getDeclaredConstructor(new Class[]{InputStream.class});
         Object oisObj = ocons.newInstance(new Object[] {fisObj});
         Method readObj = aClass.getDeclaredMethod("readObject", new Class[]{ois});
         readObj.setAccessible(true);
         Object mapObj = readObj.invoke(employeeObj,new Object[]{oisObj});
    The above code is call the readObject method, but it is failing while executing inStream.defaultReadObject() statement
    I am getting the following exception
    java.lang.reflect.InvocationTargetException
    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:585)
    at HackEmployee.reflect(HackEmployee.java:49)
    at HackEmployee.main(HackEmployee.java:131)
    Caused by: java.io.NotActiveException: not in call to readObject
    at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:474)
    at Employee.readObject(Employee.java:77)
    ... 6 more
    can anybody help me?
    ~ murali

    Hi,
    Here is the simple example.
    public class Employee implements Serializable {
    static final long serialVersionUID = 1L;
    static final int _VERSION = 2;
    private int eno;
    private String empName;
         private String paaword;
         private void readObject(java.io.ObjectInputStream inStream)
    throws IOException, ClassNotFoundException {
         int version = 0;
         BufferedInputStream bis = new BufferedInputStream(inStream);
         bis.mark(256);
         DataInputStream dis = new DataInputStream(bis);
         try {
              version = dis.readInt();
              Debug.println(Debug.INFO, _TAG, "Loading version=" + version);
         } catch(Exception e) {
              dis.reset();
         switch(version) {
              case 0:
              case 1:
                   inStream.defaultReadObject();
                   migrateDefaultEmployeeToEncryptionPassword();
                   break;
              case _VERSION:
                   inStream.defaultReadObject();
                   break;
              default:
                   throw new IOException("Unknown Version :" + version);
         private void writeObject(ObjectOutputStream aOutputStream)
    throws IOException {
         aOutputStream.writeInt(_VERSION);
         aOutputStream.defaultWriteObject();
    Now I am writing a tool that need to read data and print all the field and values in a file.
    So I am trying the same with reflecton by calling readObject(ObjectInputStream inStream).
    But here I am facing the problem, it is geving java.lang.reflect.InvocationTargetException while calling migrateDefaultEmployeeToEncryptionPassword(.
    Hope you got my exact scenerio.
    Thanks for your replay
    ~ Murali

  • Help required regarding performance improvement using reflection.

    Good Day Fellow programmers,
    I need some help .
    I am working on a project in which it is quite unavoidable to use Reflection and i am getting some performance issues regarding that . The program is not meeting the exceptions and problem is due to reflections .
    Its sought of OR mapper in which i have to fetch the data from the database and corresponding to every row from the resultset there is a Helper class object which will hold data from the table row in itselt in some fields.
    Now my application gets the class name ,field name etc from a XML file so i dont know their method names before hand .
    Now since every class instance corresponds to a row in the database and i have to call get and set methods of each class instance so the performance keeps on degrading as the no of columns and no of rows increase .
    I cant use any exisiting application (hibername etc) as i am doing some processing in between.
    I had use method caching techinique but still invoke is taking too much time.
    Can somebody suggest some improvement regading this and regarding creating multiple instances of the same object
    Please Help
    Thanks
    Saurabh

    The program is not meeting the expectations
    and the problem is due to reflection.Do we know this for certain?
    ... my application gets the class name, field name
    etc. from an XML file so i don't know their method names
    beforehand .
    Now since every class instance corresponds to a row
    in the database and i have to call get and set
    methods of each class instance so the performance
    keeps on degrading as the number of columns and rows increase .
    Can somebody suggest some improvement regarding this
    and regarding creating multiple instances of the same object Class.forName() will be using a hash already, so there is probably not much room for improvement.
    Class.newInstance() probably does not take significantly more processing than a simple "new Fubar();".
    Umpteen reflective method invokations (one per column) for each row/instance - Are you saying these are the problem?
    You can test this easy enough.
    If you comment out the reflective method invocations and leave the rest of your code untouched,
    does your application processing speed up significantly?

  • Creating user view using 'createView' method of RemoteSession class

    Hi
    I am trying to create a user view using createView method of RemoteSesson class.
    the code is as follows:
    remoteSession = (RemoteSession)SessionFactory.getSession(REMOTE_HOST, ADMIN_ID, encryptedPassword);
    HashMap map = new HashMap();
    map.put("type", "User");
    map.put("viewId", "User");
    GenericObject obj =
    remoteSession.createView("#ID#3DA2A7588B5510DC:-4D08423:10AAD335A14:-7FEE", map);
    I get the following error on the server side:
    WavesetException: Missing object type
    com.waveset.util.WavesetException: Missing object type
         at com.waveset.util.WavesetException.checkBreakpoint(WavesetException.java:366)
         at com.waveset.util.WavesetException.<init>(WavesetException.java:133)
         at com.waveset.rpc.GenericMessageHandler.createView(Unknown Source)
         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:585)
         at com.waveset.rpc.GenericMessageHandler.request(Unknown Source)
         at com.waveset.rpc.SimpleRpcHandler.doRequest(SimpleRpcHandler.java:164)
         at com.waveset.rpc.SimpleRpcHandler.doRequest(SimpleRpcHandler.java:128)
         at org.openspml.server.SOAPRouter.doPost(SOAPRouter.java:500)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Thread.java:595)
    Could anyone tell me what is wrong with this code?
    Thanks!

    hi carlos,
    yes it is possible. as a reference please have a look at this document How to Reference External JAR Files in Web Dynpro DC in SAP NW Portal 7.3
    basically the steps are the same (adding dependency, public parts, etc.) for a ejb or java project.
    regards,
    christian

  • Human Task Events's Validation Callback Errored out  while using EJB method

    Hi All,
    We are using weblogic version 10.3.5. and Jdev 11.1.1.5.0
    In our BPM Process we have human tasks,in human task Events,we are using Validation Callback to save and get some information.To save and get information we are ejb.
    1)We have created one BaseTaskValidator.java which implements ITaskValidationCallback.
    2)we have override the validateTaskOperation() method in BaseTaskValidator.java
    3)We have created one more TaskReminderService.java extends BaseTaskValidator
    4)In TaskReminderService.java,when we trying to get information from Database with help of EJB we are getting the below error.
    [2012-10-14T21:05:47.610+05:30] [soa_server1] [ERROR] [] [oracle.soa.services.workflow.task] [tid: [ACTIVE].ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: Amar.Kant] [ecid: 1416ca41dee3590b:5c59d6e4:13a59f6159b:-8000-0000000000021e0b,0] [APP: soa-infra] [composite_name: ARCN] [component_name: CNRequestTask] [component_instance_id: 204583] [composite_instance_id: 1470009] <.> Error in invoking task validation callbacks.[[
    Error in invoking task validation Java callback com.atc.arcn.callbacks.BaseTaskValidator.performCallbacks for task 204583. The task is associated with workflow default/ARCN!1.0/CNRequestTask.
    Make sure that the task validation callback class is specified correctly without any errors. The class name should be fully qualified. Also make sure that the class and its dependencies are available in the classpath.
    ORABPEL-30099
    Error in invoking task validation callbacks.
    Error in invoking task validation Java callback com.atc.arcn.callbacks.BaseTaskValidator.performCallbacks for task 204583. The task is associated with workflow default/ARCN!1.0/CNRequestTask.
    Make sure that the task validation callback class is specified correctly without any errors. The class name should be fully qualified. Also make sure that the class and its dependencies are available in the classpath.
         at oracle.bpel.services.workflow.task.impl.TaskValidationCallbackInvoker.executeJavaCallback(TaskValidationCallbackInvoker.java:195)
         at oracle.bpel.services.workflow.task.impl.TaskValidationCallbackInvoker.performCallbacks(TaskValidationCallbackInvoker.java:104)
         at oracle.bpel.services.workflow.task.impl.TaskService.initiateTask(TaskService.java:1190)
         at oracle.bpel.services.workflow.task.impl.TaskService.initiateTask(TaskService.java:666)
         at oracle.bpel.services.workflow.task.impl.TaskService.initiateTask(TaskService.java:614)
         at sun.reflect.GeneratedMethodAccessor4268.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
         at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
         at oracle.bpel.services.workflow.common.WorkflowServiceCacheEventAdvice.invoke(WorkflowServiceCacheEventAdvice.java:91)
         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
         at oracle.bpel.services.workflow.test.workflow.ExceptionTestCaseBuilder.invoke(ExceptionTestCaseBuilder.java:155)
         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
         at oracle.bpel.services.common.dms.MethodEventAspect.invoke(MethodEventAspect.java:70)
         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
         at oracle.bpel.services.common.dms.MethodPhaseEventAspect.invoke(MethodPhaseEventAspect.java:82)
         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
         at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
         at $Proxy250.initiateTask(Unknown Source)
         at oracle.bpel.services.workflow.task.ejb.TaskServiceBean.initiateTask(TaskServiceBean.java:70)
         at sun.reflect.GeneratedMethodAccessor4267.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
         at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
         at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
         at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
         at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
         at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
         at com.bea.core.repackaged.springframework.jee.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:37)
         at weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:54)
         at com.bea.core.repackaged.springframework.jee.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:50)
         at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
         at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
         at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
         at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
         at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
         at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
         at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
         at $Proxy280.createProcessInstanceTask(Unknown Source)
         at oracle.bpm.services.instancemanagement.ejb.InstanceManagementServiceBean_sqa2w0_IInstanceManagementServiceRemoteImpl.__WL_invoke(Unknown Source)
         at weblogic.ejb.container.internal.SessionRemoteMethodInvoker.invoke(SessionRemoteMethodInvoker.java:40)
         at oracle.bpm.services.instancemanagement.ejb.InstanceManagementServiceBean_sqa2w0_IInstanceManagementServiceRemoteImpl.createProcessInstanceTask(Unknown Source)
         at oracle.bpm.services.instancemanagement.ejb.InstanceManagementServiceBean_sqa2w0_IInstanceManagementServiceRemoteImpl_WLSkel.invoke(Unknown Source)
         at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:174)
         at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:345)
         at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
         at oracle.bpm.services.instancemanagement.ejb.InstanceManagementServiceBean_sqa2w0_IInstanceManagementServiceRemoteImpl_1035_WLStub.createProcessInstanceTask(Unknown Source)
         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 weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:85)
         at $Proxy404.createProcessInstanceTask(Unknown Source)
         at oracle.bpm.papi.ora.util.ApplicationExecution11G.beginExecution(ApplicationExecution11G.java:50)
         at fuego.papi.utils.ApplicationExecution.beginExecution(ApplicationExecution.java:29)
         at oracle.bpm.workspace.model.common.ExecutionBean.handleExternalInstanceExecution(ExecutionBean.java:171)
         at oracle.bpm.workspace.model.application.ApplicationBean.execute(ApplicationBean.java:148)
         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 com.sun.el.parser.AstValue.invoke(Unknown Source)
         at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
         at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:46)
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
         at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
         at org.apache.myfaces.trinidad.component.UIXCollection.broadcast(UIXCollection.java:148)
         at org.apache.myfaces.trinidad.component.UIXTable.broadcast(UIXTable.java:279)
         at oracle.adf.view.rich.component.UIXTable.broadcast(UIXTable.java:145)
         at oracle.adf.view.rich.component.rich.data.RichTable.broadcast(RichTable.java:402)
         at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:102)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)
         at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:96)
         at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:148)
         at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:102)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)
         at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:96)
         at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:148)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)
         at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:102)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)
         at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:96)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)
         at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:102)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)
         at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:96)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:902)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:313)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:186)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.help.web.rich.OHWFilter.doFilter(Unknown Source)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
         at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:175)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
         at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
         at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
         at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
         at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
         at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
         at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    Caused by: java.lang.reflect.InvocationTargetException
         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 oracle.bpel.services.workflow.task.impl.TaskValidationCallbackInvoker.executeJavaCallback(TaskValidationCallbackInvoker.java:191)
         ... 344 more
    Caused by: java.lang.NullPointerException
         at com.atc.arcn.util.TaskReminderService.getTaskDetails(TaskReminderService.java:72)
         at com.atc.arcn.util.TaskReminderService.setReminderDuration(TaskReminderService.java:64)
         at com.atc.arcn.util.TaskReminderService.setReminderDuration(TaskReminderService.java:56)
         at com.atc.arcn.callbacks.BaseTaskValidator.processInitiate(BaseTaskValidator.java:96)
         at com.atc.arcn.callbacks.BaseTaskValidator.validateTaskOperation(BaseTaskValidator.java:52)
         ... 349 more
    Please help on this issue.It is little bit urgent for us to resolve.
    Thanks in advanced.

    Thanks for reply Ravi.
    The NullPointerException is beacuse of JNDI problem,we resolved that issue.We are able to create the ejb instance but with that instance when we are trying to call ejb method,we are getting the below error in console and the BPM instance is not getting created.
    We are able to create the instance of the EJB Bean.But when we try to call the method of EJB Bean(getTaskDetailsByTaskName(taskName)),the BPM instance is not getting created from BPM workspace.If we comment the code for the method of EJB Bean(getTaskDetailsByTaskName(taskName)) able to create the instance from BPM workspace.When we checked the log file this error,it is
    Caused by: fuego.papi.exception.CannotCreateInstanceException: Cannot create instance in process 'default/ARCN!1.0*/ARCN'.
         at oracle.bpm.papi.ora.helper.ExceptionHelper.wrapException(ExceptionHelper.java:58)
         at oracle.bpm.papi.ora.util.ApplicationExecution11G.beginExecution(ApplicationExecution11G.java:56)
         at fuego.papi.utils.ApplicationExecution.beginExecution(ApplicationExecution.java:29)
         at oracle.bpm.workspace.model.common.ExecutionBean.handleExternalInstanceExecution(ExecutionBean.java:171)
         ... 102 more
    Caused by: BPM-70204
    Exception
    exception.70204.type: error
    exception.70204.severity: 2
    exception.70204.name: Error creating process instance.
    exception.70204.description: Error creating instance for target process default/ARCN!1.0*/ARCN.
    exception.70204.fix: Verify server log to find the problem cause.
         at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:205)
         at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:345)
         at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
         at oracle.bpm.services.instancemanagement.ejb.InstanceManagementServiceBean_sqa2w0_IInstanceManagementServiceRemoteImpl_1035_WLStub.createProcessInstanceTask(Unknown Source)
         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 weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:85)
         at $Proxy407.createProcessInstanceTask(Unknown Source)
         at oracle.bpm.papi.ora.util.ApplicationExecution11G.beginExecution(ApplicationExecution11G.java:50)
         ... 104 more
    Could you please suggest me on this issue.
    Thanks,
    Narasimha

  • Typecasting using Reflection

    Hi !
    How do I type cast classes using reflection?
    I use my own classloader and load a few classes, say 'myinterface', 'myinterfaceimpl' and 'someclass' in that custom classloader.
    'myinterface' class is public where as the implementation class, 'myinterfaceimpl', access is private. 'someclass' has a method whose return type is 'myinterface', and it returns an object of instance 'myinterfaceimpl' (which is an innerclass).
    1. My application starts with the system classpath (where the above 3 classes are not present).
    2. My classloader loads these 3 classes.
    3. Using reflection, I invoke the specified method in 'someclass', whose return type is 'myinterface'.
    4. Now I am unable to invoke a public method defined in the interface, since the implementation class level access is private. I get an IllegalAccessException, when I try to invoke a method in the object returned.
    5. I feel it would work, if I can somehow typecast the object returned from the method invocation to the interface class and then invoke the method.
    6. The same scenario works when I don't use reflection and have them in the classpath.
    Any help would be greatly appreciated. I saw a few postings related to this in the forum, but I am unable to find an answer.
    Best Regards,
    Ramesh.

    4. Now I am unable to invoke a public method defined
    in the interface, since the implementation class level
    access is private. I get an IllegalAccessException,
    when I try to invoke a method in the object returned.Private methods cannot be used to implement methods that the interface specifies to be public, as far as I know. A class that claimed to implement an interface that way should not compile.
    5. I feel it would work, if I can somehow typecast the
    object returned from the method invocation to the
    interface class and then invoke the method.
    6. The same scenario works when I don't use reflection
    and have them in the classpath.Perhaps the class you have doesn't claim to implement the interface, but just happens to have methods with the same signature, although some of them are private? If that's the case then you have a design problem that should not be worked around this way. Fix the class to implement the interface properly and you won't have to deal with any of this nonsense.

  • Jxl -need help to solve error generated while using createWorkbook() method

    I need to copy a template excel file(template will hold the file name) to another new generated excel file (book.xls).
    And I was trying this, -
    FileInputStream fis = new FileInputStream(template);
    jxl.Workbook jwbook = Workbook.getWorkbook(fis);
    Sheet jsheet[] = jwbook.getSheets();
    int sheetNum = jwbook.getNumberOfSheets();
    FileOutputStream fos = new FileOutputStream(pathName + File.separator + "book.xls");
    WritableWorkbook outputWorkbook;
                outputWorkbook = Workbook.createWorkbook(fos, jwbook);error showing :-
    java.lang.NoSuchMethodError: common.Assert.verify(Z)V
         at jxl.biff.XFRecord.<init>(XFRecord.java:356)
         at jxl.write.biff.CellXFRecord.<init>(CellXFRecord.java:50)
         at jxl.write.WritableCellFormat.<init>(WritableCellFormat.java:87)
         at jxl.write.WritableWorkbook.<clinit>(WritableWorkbook.java:55)
         at jxl.Workbook.createWorkbook(Workbook.java:344)
         at jxl.Workbook.createWorkbook(Workbook.java:326)
         at custom.localopal.actions.TestExcel.processAction(TestExcel.java:581)
         at custom.localopal.actions.TestExcel.main(TestExcel.java:1373)
         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:324)
         at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)Here,-
    template is a filename,
    pathname is "c://Test",
    'template' is also in the same path.
    Can any one please help me to identify the problem? What is the reason of the error and how it can be solved?

    It looks like the error is on the below line ;
    java.lang.NullPointerException
      at oracle.apps.ap.oie.audit.server.AuditReportLinesVORowImpl.isPersonalLine(AuditReportLinesVORowImpl.java:449)
    Please check what is the reason for the error.
    I am seeing many issues with VO substitution these days which is because the extended VORowImpl is not calling super for those attribiutes which is overridden in the stanard VORowImpl.
    Please have a read on the below blog and see whether that is applicable to your VO extension.
    Johny's Tips: OAF: Transient Attributes not getting populated in Extended VO
    If not, please attach the standard and the custom VO files
    Cheers
    AJ

  • Method.invoke hangs?

    I'm trying to send a Class over a network, then invoke a Method inside the class.
                            final Method command = clazz.getDeclaredMethod("exec");
                            try {
                                System.out.println("Invoked0");
                                command.invoke(null);
                                System.out.println("Invoked1");
                            } catch (Exception e) {
                                throw new RuntimeException(e);
                            }Only Invoked0 prints, and there is no Exception. Whats wrong?
        class CommandClassLoader extends ClassLoader {
            public Class<?> defineClass0(String name, byte[] b, int off, int len) {
                return defineClass(name, b, off, len);
        }

    Oops, didn't realize I was throwing there, its printing a NPE.
    java.lang.NullPointerException
            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 colby.client.Client$1$2.run(Client.java:63)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
            at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
            at java.util.concurrent.FutureTask.run(FutureTask.java:138)
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)
            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
            at java.lang.Thread.run(Thread.java:619)That doesn't really make sense though? Why would it be happening there?

Maybe you are looking for