Jva.lang.reflect and Connection objects

I am not sure in wich forum i should post this, i hope this is the right one.
I have a class that have one constructor like this:
classConstructor(String id, Connection conn)
I am trying to load and use it in runtime using the java.lang.reflect package:
String id = "Some value";
Connection conn = dbcm.getConnection(pool);
className = "Name of the class";
Class theClass = Class.forName(className);
Class classArgs[] = { id.getClass(), conn.getClass() }
Constructor constructor = theClass.getConstructor(classArgs);
At this time i get the NoSuchMethodException, because the conn.getClass() returns oracle.jdbc.driver.OracleConnection instead of java.sql.Connection.
Am i doing something wrong here? Is there any way of getting the return value as java.sql.Connection?
Thanks in advance,
Rafael Dittberner
null

Why not use the following:
Class classArgs[] = { String.class, java.sql.Connection.class };
Constructor constructor = theClass.getConstructor(classArgs);
Actually, the constructor is something you may even want to determine (and use) statically if you repeatedly execute this code.

Similar Messages

  • Premise and Connection object

    Is it possible to have different addresses for Premise and Connection Object? If yes, then what configuration is needed??

    [IS-U Master Data|http://help.sap.com/saphelp_utilities472/helpdata/en/f8/196c35a018d041e10000009b38f839/frameset.htm]
    for each connection we can maintain multiple premises.
    Premise address can maintain additional information as like (Additional street data enables you to manage additional information on the street name of the connection object. You can also store different street names. )
    Regards,
    Siva

  • Need clarification  in usage of  premise and connection object

    Hi everyone,
       I  am working on a project and for that i have  do move in  for around 30 customers. i did up to move in . I assumed 5 customers from a single appartment and grouped  them. so i  used same connection object and premise for them. After move- in is done  i checked the Equipment numbers  generated for all the 5 in that group. The  address in equipment display(ie03) and also the customer display (XD03)  is overlapped  with the connection objects address. so it is showing same address for all 5 customers. After that i changed the premise but used the same conection object. But again the customer address is overlapped with the given connection object address. can anyone help me how to solve this if i have a scenario  like this :  5 customers from same appartment. how to create the connection obj and premise .
    Thanks,
    Archana

    Archana,
    Please have a look at the IS-U data model. The connection objects relates to the building and the premises to the appartments. The 5 customers/consumers/business partners live in their own premise. On premise level you may detail the address with such as "1st floor last door to the right".
    Devices (meters) are installed technically in a devlice location that can be is linked to premise and connection object. Finally the utility installation holds all billing relevant data while the contract is the link between the technical master data and the business master data. During a move-in the address list of a BP is completed by the address of the connection object (if customized).
    As you can see there are various factors affecting the address of a business partner and a installed device.
    Kind regards,
    Fritz

  • Reflection and Creating Object

    Can any body help me in this problem i am trying to instantiate an object from a class using reflection , i know that i have to get a constructor object and then call with new instance method that takes an Object[]
    the problem is that the constructor for my object is an Integer[] array , what should i pass inside the Object[] i tried to put the interger[] since its super class is an object in the Object[] but it gave me run time excpetion ?

    import java.lang.reflect.*;
    class MyClass
      public MyClass(Object[] args)
    public class ReflectiveConstructorGetter
      public static void main(String[] args) throws Exception
        Integer[] i = new Integer[] {new Integer(4)};
        Constructor ctor =
          MyClass.class.getConstructor(
            new Class[] {Object[].class});
        ctor.newInstance(new Object[] {i});
    }

  • Functional location not reflected in connection object

    HI...
    I created a functional location in the plant maintanence module..however when i try to check this from the connection object SAP gives me an error sayin the Location does not belon to IS type C(connection Object).
    during FL creation i had specified the category as A (connection Object) and structure indicator as AO_GP (ISU defaults)...wat am i doing wrong..?

    HI MICK
    I  HOPE I  HAVE FOUND UR ANSWER
    JUST  GOI TO
    SPRO-SAP UTIL-MASTER DATACONNEC OBJECTBASIC SETTINGS-
    HERE IN THIS SCREEN  ENETR THE FOLLWONG  ENTRUIES
    IF U  HAVE ONE DELETE ANDMAKENEW AS HERE
    C     AO_GP   A
    C is connection object
    AO_GP  str
    A is fucnt  location  categ
    make it
    and u  will get ur issues solved
    kr
    raj

  • Connection Object validation

    Hi,
    During the migration of Connection Object, the (postal code and street)data does not match 100% with the Regional Structure data. I have turned off the Street validation using the "Flag Street Directory" from ADRCITY but EMIGALL does not let me migrate connection objects whose postal codes does not already exist. Is there a way to turn this validation off or to circumvent this issue? The problem arises because Regional Structure and Connection Object/Premise are being extracted from two different source systems.

    Hi,
    You  need to turn off the flag "city file active" (IMG -> SAP Netweaver -> General Settings -> Set countries ->  Set country-specific checks. Please check the Guildines ISMW for implication in not having the address validation turned off.
    Cheers,
    Fritz

  • Java.lang.IllegalAccessException using Reflection and SSL

    Hi all,
    I am getting the java.lang.IllegalAccessException when trying to access the field's value. I'm passing an object that has it's fields set. I'm trying to determine the object passed to my method, get the object's fields, get the field values and store them in an array for later processing. The italic line is where the error occurs. I'm running SSL and my constructors for the objects that I'm passing are all declared "public".
    Can anyone help me fix this problem or suggest a better way?
    Thanks.
    *my method
        public void setHtFields( Object obj ) throws Exception
            setAction( "view" );
            setRecType( obj.getClass().getName() );
            Field flds[] = obj.getClass().getDeclaredFields();
            String fieldList = "";
            String value = "";
            for ( int x=0; x<flds.length ; x++ )
    value = flds[x].get(obj).toString();            htFields.put( flds[x].getName(), value);
                fieldList +=  flds[x].getName() + "::" + value + "~";
            setFieldValue( fieldList );
            insertRecord();
            return;
    * stack trace
    java.lang.IllegalAccessException
         at java.lang.reflect.Field.get(Native Method)
         at com.yoursummit.utils.historyLogging.setHtFields(historyLogging.java:276)
         at org.apache.jsp.edit_emp_jsp._jspService(edit_emp_jsp.java:99)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
         at java.lang.Thread.run(Thread.java:479)

    The object your are invoking setHtFields on must be declaring some private or protected fields which you can't access.
    If you try printing the thrown IllegalAccessException message, not just a stack trace, you will see which exacly one.

  • Weblogic9.2 (SSL) and stxx issue(java.lang.reflect.InvocationException).sol

    I just thought of sharing my experience in this forum.
    We are migrating one of our application from tomcat to weblogic 9.2 cluster environment which was written struts & stxx. The application works fine when we access using http protocol. The application throws "org.xml.sax.SAXException
         at com.oroad.stxx.transform.document.DefaultSAXSerializer.serializeIt(DefaultSAXSerializer.java:488)
         at com.oroad.stxx.transform.document.DefaultSAXSerializer.serializeRequestAttribute(DefaultSAXSerializer.java:196)" ...
    Caused by: java.lang.UnsupportedOperationException: javax.net.ssl.impl.SSLSessionImpl.getApplicationBufferSize()
         at javax.net.ssl.impl.SSLSessionImpl.getApplicationBufferSize()I(Unknown Source) ... java.lang.reflect.InvocationTargetException
         at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source) when try to access application with https.
    Solution:
    The above issue happening when stxx is trying to serialize weblogic specific object to xml. so, by changing stxx.properties file - stxx.attach.requestAttributes.ignore= (weblogic.*) would resolve the problem. or write your own custom XML bean serializer by override serializeRequestAttribute method of DefaultSAXSerializer class and filter all weblogic attribute.
    Hope the above solution would help in you app development. :-)
    -- Keshav                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Why dont you remove the Security Manager and run this program again and check it once
    really this SecurityManager is creating more problems
    Edited by: teluguswan on Jul 19, 2008 8:11 AM

  • 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?

  • How to store Connection object and call it from other programs.

    Hi,
    I am trying to connect to the database, store the connection object and use this connection object from other standalone java programs.
    Can any one tell me how to do this? I've tried in the following way:
    In the following program I am connecting to the database and saving the connection object in a variable.
    public class GetKT2Connection {
       public static void main(String[] args) {
          String url = "jdbc:odbc:SQLDsn;
          String dbUser = "sa";
          String dbPwd = "sa";
          Connection kt2conn = Connection connection = java.sql.DriverManager.getConnection(url, dbUser, dbPwd);
          if(kt2conn == null) {
             System.out.println("Database Connection Failure!");
          else {
             System.out.println("Connected to Database...");
         GetKTConnectionObj.storeKT2ConnectionObj(kt2conn);
    } Here is the program to save connection object in a variable.
    public class GetKTConnectionObj {
       static Connection kt2Connection = null;
       public static void storeKT2ConnectionObj(Connection conn) {
       kt2Connection = conn;
       public static Connection getKT2ConnectionObj() {
       try {
          return kt2Connection;
       catch(Exception e){
          System.out.println(e);
      return null;
    }Now from the following code I am trying to get the connection object that is stored. But this is throwing NullPointerException.
    public class Metrics_Migration {
      public static void main(String args[]) {
         try {
        java.sql.Connection connection_1 =   GetKTConnectionObj.getKT6ConnectionObj();
         catch(Exception e){
    }

    kt2Connection is null. You need to store it first, to make it not null. Otherwise it will stay null forever. And why on earth are you trying to do this THIS way?
    If you are running the two applications separately, it wont work either.

  • Error in creating Connection Object and Device Location

    Hi ,
    When i am creating Connection Object and Device Location , system is giving dump . all other object are working fine.
    the error is gievn below :
    Error in reading table TE130.
    i checked this the table , its have no entries ( mainly field ISTYP is blank ) and this is the cause of problem .
    Could you please tell me that how to fill this table before creating Connection object and device location. i think some configuration should be needed for this but i dont know how .
    thanks and regards
    Deepak.

    Hi Deepak,
    You can check standard configuration in client 000.
    Meanwhile you can use this settings:
    ISTYP TPLKZ FLTYP NUMKI NUMKE
    C     AO_GP     A     01     OC
    D     AO_GP     G     02     OC
    This is where you define structure indicator for isu technical location category.
    ISTYP correspond to the type of technical location in ISU, C for connection object and D for device location
    The content of TPLKZ is defined in the following menu in SPRO.
    Plant Maintenance and Customer Service
    Master Data in Plant Maintenance and Customer Service
    Technical Objects
    Functional Locations
    Create Structure Indicator for Reference Locations/Functional Locations
    Hope it helps,
    Regards,
    Daniel Valenzuela
    Edited by: Daniel Valenzuela on Feb 4, 2008 3:22 PM

  • Why ava.lang.reflect.Array.newInstance() returns Object, but not Object[]?

    It is interesting why java.lang.reflect.Array.newInstance() returns
    Object, but not more specific Object[]?

    Array.newInstance(int.class, length)

  • CONNECTION OBJECT AND POD

    hi experts,
    can any one of you explain what is connection object and point of delivery with any example.

    Hello
    Connection object is the place where the Utility service is provided. It can be a building, or a transformation center in the street or a fountain. It is just where you provide the service.
    PoD is an object for the de regulated market. It is a universal coordinate on where the service is provided. Imagine you switch  from UItility company A to company B. When both companies exchange your data, the only data that both companies know for sure is your PoD.
    PoD number is created via an algorithm which is unique for your whole country.
    Hope it helps
    Joaquin

  • Connection Object and Street name

    Hi,
    Could anybody please specify the table name in which we can find the Connection object and Street name?
    Thanks and Regards

    Table EHAUISU you will have the connection object number.
    Then go to ILOA table give the connection object number in Functional loc. and execute it.
    You will get the address number. Then go to ADRC table to know the street name.
    You will not find the data in a single table.
    If you want to find then go to views
    V_EHAU_ADDRNR : IS-U Connection Object: Optimized Access for Address Number  "you will find address number for connection object.
    V_EHAUADR  :  You will get street name for connection object.
    Please let me know if you want any more details. if have any issues with answer then let me know the exact question for the same.
    Thank You.
    Regards,
    Siva

  • CRM/ISU: Notes (or Texts) at Connection Object Level and replication

    Hi there,
    I am trying to replicate to CRM (and back to ISU) the Text objects linked against the Connection Object in ISU.
    The idea is to have two texts area in the Connection Object in the WebIC that can be replicated back to the related ISU's ones.
    The requirement is to replicate those texts (multiline texts, textarea, notes) linked against the Connection Object from CRM to ISU.
    The connection object in CRM is a "casted" Individual Object that can be linked against Notes (or Texts), isn't it?
    So the IObjects can have a Notes Assignment Block.
    The problem is that from an WebIC point of view the Notes Assignment block obviously are not shown.
    Have someone of you done something like that before? Any idea?
    Thanks.
    Regards,
    Carlo.

    Hey Bill, thanks for the links.  Question - is the Utilities Check Cockpit available externally?  I try the link but receive an authorization issue using my new S-id
    I am trying the following link:
    https://service.sap.com/~sapdownload/011000358700001040272011E
    Thanks,
    James

Maybe you are looking for

  • Click Bios II Won't Load?

    Anyone else having an issue with Click Bios II in Windows 8.1 Pro?? Here is the setup.. Z77A-GD65 Windows 8.1 Pro Windows 7 Ultimate I have it setup for dual boot because i still provide tech support for a ton of 7 users so its just nice to have both

  • My credit card won't be accepted

    Every time I try to register my credit card it keeps saying it can't be accepted. When I go to expresslane.apple.com I get no help what so ever.

  • PAL or NTSC ?

    hello there.. i Just want to know how to tell if the BluRay players your showing here can support PAL or only NTSC for example : Sony - Smart Blu-ray Player Model: BDPS1100

  • Export in ODI 11 g

    Hello, I am trying to export all objects individually. Let say we create a procedure and one step in that is to export all variables. Command on Target looks like: OdiExportObject "-I_OBJECT=#I_VAR" "-CLASS_NAME=SnpVar" "-FILE_NAME=<%=snpRef.getOptio

  • IMovie 10.0.3 fonts underline

    Dear all, I can't edit my fonts with underline. Anyone can help me? When I add title in my movie, such as, Today is fine. I edit like this "Today is fine". But i preview the clip. The underline editing is invisible. Many thanks! Lou