Java reflection and parameter's names

hi, I have to extract from a method of a given class all types and names of the parameters, i've tryed to use java reflection function:
Method[] metodo = temp.getDeclaredMethods();
for (int i = 0; i < metodo.length; i++) System.out.println(metodo.toString());
and the output is:
public void DinamicLoad.function1.method1()
public void DinamicLoad.function1.method2(java.lang.String)the function extract only the parameter's type, not his name

Probabily all the "dozens, hundreds, thousands of
other people who use reflection" knows very well
classes that they use.
Imagine to produce a class from a wsdl file, how can
you know the content?
How can you pass parameters if you know only the type
and not the MEANING?When building classes from XML it's rare to use the constructor to convey the attributes, far more often each attribute is set independantly using a single argument setter with a signature like:
public void setMyAttribute(String value) {Hence attribute names (e.g. myAttribute) are normally compared against method names, not parameter names.
If constructors are to be used then parameters will be supplied in order.

Similar Messages

  • Java reflection and singletons

    Using java reflection and singletons .. anyone seen this being used?

    I've solved it
    I had a singleton but then it turned out i had to use reflection instead, i tried to used reflection on 3 methods but the session value within was null upon the second method call. Relfection was re-creating the Object.
    Sorry for wasting your time.

  • Java Reflection and dynamic class loading

    I am trying to load my classes 'dynamically' using java reflection, which is a feature absolutely necessary for my webapp. I could not get this to work as of yet. Could someone please give me a piece of sample code that would do the following :
    - return the value (String) of known method y from class x
    - class x is only known at runtime (from the query-string in this case)
    - method y is known
    Thanks in advance.
    cheers,
         Tom
    PS: Please do not give me any links to tutorials/articles that do not do the EXACT thing that I asked for. Thank you.

    tried it, but it always gives me a MethodNotFoundException, because its trying to find my class in java.lang.String for some reason...
    heres part of the code (its an altered version of the code given in the invoke tutorial):
    public String getMethodReturnValue(String methodName, String className) {
    String result = null;
    Class theModuleClass = String.class;
    Class[] parameterTypes = new Class[] {};
    Method concatMethod;
    //Object[] arguments = new Object[] {parameters};
    try {
    concatMethod = theModuleClass.getMethod(methodName, null);
    result = (String) concatMethod.invoke(createObject(className), parameterTypes);
    } catch (NoSuchMethodException e) {
    result = e.toString();
    } catch (IllegalAccessException e) {
    result = e.toString();
    } catch (InvocationTargetException e) {
    result = e.toString();
    return result;
    private Object createObject (String className) {
    Object object = null;
    try {
    Class classDefinition = Class.forName(className);
    object = classDefinition.newInstance();
    } catch (Exception e) {}
    return object;
    Thanks for any help!
    -Tom

  • Question about java reflection and "int" type

    hi, using reflections I should invoke a Method (meth3) that have as parameter an INT type (not integer). I've tryed with this code:
                        int num = 3;
                        Class[] vettClax = {int.class};
                        Object[] vettParam = {num};
                        Method meth3 = temp.getMethod("meth3", vettClax);
                        meth.invoke(o, vettParam);My problem is that the int value is catched as an Integer value and reflection doesn't found a method that accept an INTEGER as parameter, who can help me?

    Works fine when I try it.
    public class t
        public static void main(String args[])
         throws Exception
         Class temp = t.class;
         t o = new t();
         int num = 3;
         Class[] vettClax = {int.class};
         Object[] vettParam = {num};
         Method meth = temp.getMethod("meth3", vettClax);
         meth.invoke(o, vettParam);
        public void meth3(int n)
         System.out.println("hello " + n);
    }Is your meth3() public?

  • What is the key column name and value column name in JDBC Adapter parameter

    Hi
    Can any one please tell me what is the Key Column Name and Key Column Value in JDBC adatper parameters. If i dont mention those parameters i am getting the following error
    <b> Value missing for mandatory configuration attribute tableEOColumnNameId</b>
    Please help me
    Best Regards
    Ravi Shankar B

    Hi
    I am doing DataBase Lookup in XI
    First i have created a  Table in Database( CheckUser) which has two fields UserName and PhoneNumber and then i have created
    I have created one Communication Channel For Reciever Adapter .
    I have given the parameters like this
    JDBC Driver : com.microsoft.jdbc.sqlserver.SQLServerDriver
    Connection : jdbc:microsoft:sqlserver://10.7.1.43:1433;DatabaseName=Ravi;
    UserName.... sa
    password.... sa
    persistence : Database
    Database Table Name : CheckUser
    Key column name and Value column name i left blank and activated
    and then
    I have created
    Data Types : Source ...... UserName
                      Destination.... PhoneNumber
    Message Types
    Message Interfaces
    In Message Mapping
                  I have created one User Defined function DBProcessing_SpecialAPI().This method will get the data from the database....
    In this function i have written the following code
       //write your code here
    String query = " ";
    Channel channel = null;
    DataBaseAccessor accessor = null;
    DataBaseResult resultSet = null;
    query = "select Password from CheckUser where UserName = ' " +UserName[0]+ " '  ";
    try {
         channel = LookupService.getChannel("Ravi","CC_JDBC");
         accessor = LookupService.getDataBaseAccessor(channel);
         resultSet = accessor.execute(query);
         for(Iterator rows = resultSet.getRows();rows.hasNext();){
              Map  rowMap = (Map)rows.next();
              result.addValue((String)rowMap.get("Password"));
    catch(Exception e){
         result.addValue(e.getMessage());
    finally{
         try{
              if(accessor != null)
                   accessor.close();
         }catch(Exception e){
              result.addValue(e.getMessage());
    And the i have mapped like this
    UserName -
    > DBProcessing_SpecialAPI----
    >PhoneNumber
    when i am testing this mapping i am getting the following error
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:Dest_JDBC_MT xmlns:ns0="http://filetofilescenario.com/ilg"><phoneNumber>Plain exception:Problem when calling an adapter by using communication channel CC_JDBC (Party: , Service: Ravi, Object ID: c360bc139a403293afbc49d5c46e4478) Check whether the communication channel exists in the Integration Directory; also check the cache notifications for the instance Integration Server (central Adapter-Engine) Channel object with Id Channel:c360bc139a403293afbc49d5c46e4478 not available in CPA Cache.
    com.sap.aii.mapping.lookup.LookupException: Problem when calling an adapter by using communication channel CC_JDBC (Party: , Service: Ravi, Object ID: c360bc139a403293afbc49d5c46e4478) Check whether the communication channel exists in the Integration Directory; also check the cache notifications for the instance Integration Server (central Adapter-Engine) Channel object with Id Channel:c360bc139a403293afbc49d5c46e4478 not available in CPA Cache.
         at com.sap.aii.ibrun.server.lookup.AdapterProxyLocal.<init>(AdapterProxyLocal.java:61)
         at com.sap.aii.ibrun.server.lookup.SystemAccessorInternal.getProxy(SystemAccessorInternal.java:98)
         at com.sap.aii.ibrun.server.lookup.SystemAccessorInternal.<init>(SystemAccessorInternal.java:38)
         at com.sap.aii.ibrun.server.lookup.SystemAccessorHmiServer.getConnection(SystemAccessorHmiServer.java:270)
         at com.sap.aii.ibrun.server.lookup.SystemAccessorHmiServer.process(SystemAccessorHmiServer.java:70)
         at com.sap.aii.utilxi.hmis.server.HmisServiceImpl.invokeMethod(HmisServiceImpl.java:169)
         at com.sap.aii.utilxi.hmis.server.HmisServer.process(HmisServer.java:178)
         at com.sap.aii.utilxi.hmis.web.HmisServletImpl.processRequestByHmiServer(HmisServletImpl.java:296)
         at com.sap.aii.utilxi.hmis.web.HmisServletImpl.processRequestByHmiServer(HmisServletImpl.java:211)
         at com.sap.aii.utilxi.hmis.web.workers.HmisInternalClient.doWork(HmisInternalClient.java:70)
         at com.sap.aii.utilxi.hmis.web.HmisServletImpl.doWork(HmisServletImpl.java:496)
         at com.sap.aii.utilxi.hmis.web.HmisServletImpl.doPost(HmisServletImpl.java:634)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    </phoneNumber></ns0:Dest_JDBC_MT>
    In RWB i have checked the status of JDBC driver its showing the following error
    <b>Value missing for mandatory configuration attribute tableEOColumnNameId</b>
    Best Regards
    Ravi Shankar B
    Message was edited by:
            RaviShankar B

  • Performance difference between java.beans.Expression and Java Reflection

    What is the Performance difference between using java.beans.Expression class and Java Reflection classes like Class,Method ??

    negligible

  • Copying files from same directory as *.java files and moving to WEB-INF/classes/ package name

    In our current application we have the following source directory structure:
              src -
              - com
              - edeploy
              - subdirs ... (many directories here)
              - jsp
              -subdirs ... (many directories here)
              In com.edeploy.subdirs, there exists *.java files, and *.gxq files (query
              files). I would like to modify my build.cmd script to copy the *.gxq files
              into the same directory as the class files.
              Here's my script so far:
              @REM Create list of files to compile
              DIR /S /B /A:-D src\com\*.java >class.list
              @REM Create list of query files
              DIR /S /B /A:-D src\com\*.gxq >query.list
              @REM Compile
              javac -d stage\WEB-INF\classes @class.list
              @REM Copy query files into class directory
              .......... code needed here ......
              Can anyone help me with this?
              Thanks,
              Matt
              

    You may want to check out:
              http://jakarta.apache.org/ant/index.html
              Gary
              "Matt Raible" <[email protected]> wrote in message
              news:[email protected]..
              > In our current application we have the following source directory
              structure:
              >
              > src -
              > - com
              > - edeploy
              > - subdirs ... (many directories here)
              > - jsp
              > -subdirs ... (many directories here)
              >
              >
              > In com.edeploy.subdirs, there exists *.java files, and *.gxq files (query
              > files). I would like to modify my build.cmd script to copy the *.gxq
              files
              > into the same directory as the class files.
              >
              > Here's my script so far:
              >
              > @REM Create list of files to compile
              > DIR /S /B /A:-D src\com\*.java >class.list
              >
              > @REM Create list of query files
              > DIR /S /B /A:-D src\com\*.gxq >query.list
              >
              > @REM Compile
              > javac -d stage\WEB-INF\classes @class.list
              >
              > @REM Copy query files into class directory
              > .......... code needed here ......
              >
              > Can anyone help me with this?
              >
              > Thanks,
              >
              > Matt
              >
              >
              

  • Calling Web Service Proxy with Custom java Object as parameter

    I created a web service proxy from WSDL URL using JDeveloper 11g(.5 version)
    I need to call a webservice method which takes custom Java Object( Ex: ABC.java) as Input parameter. It creates the XSD java (ABC.java) file for that.
    @XmlElementRef(name = "abc", namespace = "http://impl.service.ns.test", type = JAXBElement.class)
    protected JAXBElement<ABC> abc;
    ABC.java has a property of type java.util.Set of a custom Java Object (Set<XYZ.class>)
    It doesn't create xsd file for XYZ.java.
    @XmlElementRef(name = "XYZ", namespace = "http://model.ns.test/xsd", type = JAXBElement.class)
    protected JAXBElement<Set> xyz;
    Please help me.

    The passing of Java objects in and out of a web service is NOT supported. variables must be xml documents defined by a XML schema. In my opinion, missing Java object and WSDL is not a good idea. -Edwin

  • Java Reflection

    Hi Every1....i have a problem with java reflection n hope some1 will be able to resolve this me.
    I am getting the name of the child class as a string argument.
    eg String classname = this.getattributes().get("classname");
    I need to dynamically create the object of this instance using the classname and call a specific method...i know the name of the base class but the base class doesnt have the method i need....i m not allowed to redesign the base class...
    plz help

    but the problem is getting the method nameIf you don't have the method name what exactly is the plan? You've gotta have something ...
    .....i have the object of base class with meActually the object is an instance of the derived class ...
    ....and the method i
    need is in the child class.....so how do i invoke the
    method???Sigh. You can lead a horse to water but you can't make him drink. See
    http://java.sun.com/j2se/1.5.0/docs/api/java/lang/reflect/Method.html#invoke(java.lang.Object,%20java.lang.Object...)

  • The types of the parameter field and parameter field current values are not compatible.----

    HI,
    I am attempting to set report parameters in my .jsp code via URL parameters.
    I am able to set the report name, server connection dynamically however when attempting to set the Parameters I receive:
    com.crystaldecisions.sdk.occa.report.lib.ReportSDKParameterFieldException: The types of the parameter field and parameter field current values are not compatible.---- Error code:-2147213303 Error code name:invalidParameterField
    The parameter on the report is a String Type, named for this example p1.
    The value that p1 represents is LERAD
    My code:
    String stringValue = request.getParameter("p1");
    CRJavaHelper.addDiscreteParameterValue( clientDoc, "","p1", stringvalue);
    returns the above mentioned error.
    I have tried:
    String stringValue = (String)request.getParameter("p1");
    which returns the above error
    And;
    String stringValue = new String(request.getParameter("p1")).toString();
    which returns
    java.lang.NullPointerException
    java.lang.String.<init>(Unknown Source)
    org.apache.jsp.callReport_jsp._jspService(callReport_jsp.java:105)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    I notice that the CRjavaHelper.java declares this addDiscreteParameterValue as accepting an Object type for the newValue.
    Any ideas???

    Hi,
    nevermind.
    case sensitivty strikes again.
    my URL param was P1 ( case sensitive)

  • Difference b/w Java Class and Bean class

    hi,
    can anybody please tell me the clear difference between ordinary java class and java Bean class. i know that bean is also a java class but i donno the exact difference between the both.
    can anybody please do help me in understanding the concept behind the bean class.
    Thank u in advance.
    Regards,
    Fazlina

    While researching this question, I came across this answer by Kim Fowler. I think it explains it better than any other answer I have seen in the forum.
    Many thanks Kim
    Hi
    Luckily in the java world the definition of components is a little
    less severe than when using COM (I also have, and still occasionaly
    do, worked in the COM world)
    Firstly there are two definitions that need to be clarified and
    separated: JavaBean and EnterpriseJavaBean (EJB)
    EJB are the high end, enterprise level, support for distributed
    component architectures. They are roughly equivalent to the use of MTS
    components in the COM/ COM+ world. They can only run within an EJB
    server and provide support, via the server, for functionality such as
    object pooling, scalability, security, transactions etc. In order to
    hook into this ability EJB have sets of interfaces that they are
    required to support
    JavaBeans are standard Java Classes that follow a set of rules:
    a) Hava a public, no argument constructor
    b) follow a naming patterns such that all accessor and modifier
    functions begin with set/ get or is, e.g.
    public void setAge( int x)
    public int getAge()
    The system can then use a mechanism known as 'reflection/
    introspection' to determine the properties of a JavaBean, literally
    interacting with the class file to find its method and constructor
    signatures, in the example above the JavaBean would end with a single
    property named 'age' and of type 'int' The system simply drops the
    'set' 'get' or 'is' prefix, switches the first letter to lower case
    and deduces the property type via the method definition.
    Event support is handled in a similar manner, the system looks for
    methods similar to
    addFredListener(...)
    addXXXListener
    means the JavaBean supports Fred and XXX events, this information is
    particularly useful for Visual builder tools
    In addition there is the abiliity to define a "BeanInfo' class that
    explicitly defines the above information giving the capability to hide
    methods, change names etc. this can also be used in the case where you
    cannot, for one reason or another, use the naming patterns.
    Finally the JavaBean can optionally - though usually does - support
    the Serializable interface to allow persistence of state.
    As well as standard application programming, JavaBeans are regularly
    used in the interaction between Servlets and JSP giving the java
    developer the ability to ceate ojbect using standard java whilst the
    JSP developer can potentially use JSP markup tags to interact in a
    more property based mechanism. EJB are heaviliy used in Enterprise
    application to allow the robust distribution of process
    HTH.
    Kim

  • Question about main difference between Java bean and Java class in JSP

    Hi All,
    I am new to Java Bean and wonder what is the main difference to use a Bean or an Object in the jsp. I have search on the forum and find some post also asking the question but still answer my doubt. Indeed, what is the real advantage of using bean in jsp.
    Let me give an example to illustrate my question:
    <code>
    <%@ page errorPage="errorpage.jsp" %>
    <%@ page import="ShoppingCart" %>
    <!-- Instantiate the Counter bean with an id of "counter" -->
    <jsp:useBean id="cart" scope="session" class="ShoppingCart" />
    <html>
    <head><title>Shopping Cart</title></head>
    <body bgcolor="#FFFFFF">
    Your cart's ID is: <%=cart.getId()%>.
    </body>
    <html>
    </code>
    In the above code, I can also create a object of ShoppingCart by new operator then get the id at the following way.
    <code>
    <%
    ShoppingCart cart = new ShoppingCart();
    out.println(cart.getId());
    %>
    </code>
    Now my question is what is the difference between the two method? As in my mind, a normal class can also have it setter and getter methods for its properties. But someone may say that, there is a scope="session", which can be declared in an normal object. It may be a point but it can be easily solved but putting the object in session by "session.setAttribute("cart", cart)".
    I have been searching on this issue on the internet for a long time and most of them just say someting like "persistance of state", "bean follow some conventions of naming", "bean must implement ser" and so on. All of above can be solved by other means, for example, a normal class can also follow the convention. I am really get confused with it, and really want to know what is the main point(s) of using the java bean.
    Any help will be highly apprecaited. Thanks!!!
    Best Regards,
    Alex

    Hi All,
    I am new to Java Bean and wonder what is the main
    difference to use a Bean or an Object in the jsp. The first thing to realize is that JavaBeans are just Plain Old Java Objects (POJOs) that follow a specific set of semantics (get/set methods, etc...). So what is the difference between a Bean and an Object? Nothing.
    <jsp:useBean id="cart" scope="session" class="ShoppingCart" />
    In the above code, I can also create a object of
    ShoppingCart by new operator then get the id at the
    following way.
    ShoppingCart cart = new ShoppingCart();
    out.println(cart.getId());
    ...Sure you could. And if the Cart was in a package (it has to be) you also need to put an import statement in. Oh, and to make sure the object is accessable in the same scope, you have to put it into the PageContext scope. And to totally equal, you first check to see if that object already exists in scope. So to get the equivalant of this:
    <jsp:useBean id="cart" class="my.pack.ShoppingCart"/>Then your scriptlet looks like this:
    <%@ page import="my.pack.ShoppingCart %>
    <%
      ShoppingCart cart = pageContext.getAttribute("cart");
      if (cart == null) {
        cart = new ShoppingCart();
        pageContext.setAttribute("cart", cart);
    %>So it is a lot more work.
    As in my mind, a normal class can also
    have it setter and getter methods for its properties.True ... See below.
    But someone may say that, there is a scope="session",
    which can be declared in an normal object.As long as the object is serializeable, yes.
    It may be
    a point but it can be easily solved but putting the
    object in session by "session.setAttribute("cart",
    cart)".Possible, but if the object isn't serializable it can be unsafe. As the point I mentioned above, the useBean tag allows you to check if the bean exists already, and use that, or make a new one if it does not yet exist in one line. A lot easier than the code you need to use otherwise.
    I have been searching on this issue on the internet
    for a long time and most of them just say someting
    like "persistance of state", "bean follow some
    conventions of naming", "bean must implement ser" and
    so on. Right, that would go along the lines of the definition of what a JavaBean is.
    All of above can be solved by other means, for
    example, a normal class can also follow the
    convention. And if it does - then it is a JavaBean! A JavaBean is any Object whose class definition would include all of the following:
    1) A public, no-argument constructor
    2) Implements Serializeable
    3) Properties are revealed through public mutator methods (void return type, start with 'set' have a single Object parameter list) and public accessor methods (Object return type, void parameter list, begin with 'get').
    4) Contain any necessary event handling methods. Depending on the purpose of the bean, you may include event handlers for when the properties change.
    I am really get confused with it, and
    really want to know what is the main point(s) of
    using the java bean.JavaBeans are normal objects that follow these conventions. Because they do, then you can access them through simplified means. For example, One way of having an object in session that contains data I want to print our might be:
    <%@ page import="my.pack.ShoppingCart %>
    <%
      ShoppingCart cart = session.getAttribute("cart");
      if (cart == null) {
        cart = new ShoppingCart();
        session.setAttribute("cart", cart);
    %>Then later where I want to print a total:
    <% out.print(cart.getTotal() %>Or, if the cart is a JavaBean I could do this:
    <jsp:useBean id="cart" class="my.pack.ShoppingCart" scope="session"/>
    Then later on:
    <jsp:getProperty name="cart" property="total"/>
    Or perhaps I want to set some properties on the object that I get off of the URL's parameter group. I could do this:
    <%
      ShoppingCart cart = session.getAttribute("cart");
      if (cart == null) {
        cart = new ShoppingCart();
        cart.setCreditCard(request.getParameter("creditCard"));
        cart.setFirstName(request.getParameter("firstName"));
        cart.setLastName(request.getParameter("lastName"));
        cart.setBillingAddress1(request.getParameter("billingAddress1"));
        cart.setBillingAddress2(request.getParameter("billingAddress2"));
        cart.setZipCode(request.getParameter("zipCode"));
        cart.setRegion(request.getParameter("region"));
        cart.setCountry(request.getParameter("country"));
        pageContext.setAttribute("cart", cart);
        session.setAttribute("cart", cart);
      }Or you could use:
    <jsp:useBean id="cart" class="my.pack.ShoppingCart" scope="session">
      <jsp:setProperty name="cart" property="*"/>
    </jsp:useBean>The second seems easier to me.
    It also allows you to use your objects in more varied cases - for example, JSTL (the standard tag libraries) and EL (expression language) only work with JavaBeans (objects that follow the JavaBeans conventions) because they expect objects to have the no-arg constuctor, and properties accessed/changed via getXXX and setXXX methods.
    >
    Any help will be highly apprecaited. Thanks!!!
    Best Regards,
    Alex

  • Code generation through Java Reflection

    Hi
    I am after some clarification about the possibility of mapping of method outputs to other method inputs, using java reflection.
    The java objects are described in an XML based language (called DAML) as follows
    <java:Method rdf:ID="meth1" java:priority="1">
    <java:methodName>buildQuery</java:methodName>
    <java:parentClass>afsw.query.QueryBuilder</java:parentClass>
    <java:methodParameters rdf:parseType="daml:collection">
    <java:Parameter>
    <java:inORout>input</java:inORout>
    <java:type>java.util.Hashtable</java:type>
    </java:Parameter>
    </java:methodParameters>
    </java:Method>
    and I want to map them back to method calls and instantiations, so to be able to generate code on the fly. I need to know if its is possible to pass the output of a method such as getQuery() which in this case is a Document to the input of constructor MsgModule as in the following example:
    Document queryDoc =qc.getQuery();
    MsgModule mg= new MsgModule(queryDoc);
    regards
    Charlie

    This is possible. What you need to do in the 'new' instance case is to find the best constructor. So let's say you have Class clazz, the class you want to create a new instance of, and Class[] params, an array of objects to pass in the constructor. Using the Class api you can do:
    Constructor constructor = clazz.getConstructor(params);The getConstructor method will only return an exact match. Let's say one of the parameters was a subclass of an class that is allowable in the constructor. You can get all the constructors via clazz.getConstructors() and get all the parameters types via Constructor.getParameterTypes() and check to see if the params you passed in are compatible. You can use Class.isAssignableFrom() to help resolve this. Once you find the constructor, use Constructor.newInstance(params) to create the new instance. Hope this helps.

  • No Definition for parameter with name NOREFFLAG available: IP Function

    Hi All!
    I'm working with Portal 7 and BW 7
    I'm trying to create a Planning Function of Type: <b>Distribution by reference data</b> when I indicate some characteristics to be changed in the "To Characteristics Usage" tab and change to the "To Parameters" tab, I get the following error:
    <i> The initial exception that caused the request to fail, was:
      <b>com.sap.ip.bi.plan.sb.interfaces.ifs.other.NoSuchElementException: No Definition for parameter with name NOREFFLAG available</b>.
        at com.sap.ip.bi.plan.sb.interfaces.cls.tydef.ParamSetDef.checkRequest(ParamSetDef.java:123)
        at com.sap.ip.bi.plan.sb.interfaces.cls.tydef.ParamSetDef.getParamElementaryDef(ParamSetDef.java:84)
        at com.sap.ip.bi.plan.sb.interfaces.cls.srv.ParamSet.getParamElementary(ParamSet.java:113)
        at com.sap.ip.bi.plan.sb.plandialogcomps02.distrefdata.DistRefDataParamsDialogComp.setAll(DistRefDataParamsDialogComp.java:326)
        at com.sap.ip.bi.plan.sb.plandialogcomps02.distrefdata.wdp.InternalDistRefDataParamsDialogComp.setAll(InternalDistRefDataParamsDialogComp.java:199)
        ... 62 more
    Detailed Exception Chain
    com.sap.ip.bi.plan.sb.interfaces.ifs.other.NoSuchElementException: No Definition for parameter with name NOREFFLAG available.
         at com.sap.ip.bi.plan.sb.interfaces.cls.tydef.ParamSetDef.checkRequest(ParamSetDef.java:123)
         at com.sap.ip.bi.plan.sb.interfaces.cls.tydef.ParamSetDef.getParamElementaryDef(ParamSetDef.java:84)
         at com.sap.ip.bi.plan.sb.interfaces.cls.srv.ParamSet.getParamElementary(ParamSet.java:113)
         at com.sap.ip.bi.plan.sb.plandialogcomps02.distrefdata.DistRefDataParamsDialogComp.setAll(DistRefDataParamsDialogComp.java:326)
         at com.sap.ip.bi.plan.sb.plandialogcomps02.distrefdata.wdp.InternalDistRefDataParamsDialogComp.setAll(InternalDistRefDataParamsDialogComp.java:199)
         at com.sap.ip.bi.plan.sb.plandialogcomps02.distrefdata.DistRefDataParamsDialogCompInterface.setAll(DistRefDataParamsDialogCompInterface.java:143)
         at com.sap.ip.bi.plan.sb.plandialogcomps02.distrefdata.wdp.InternalDistRefDataParamsDialogCompInterface.setAll(InternalDistRefDataParamsDialogCompInterface.java:156)
         at com.sap.ip.bi.plan.sb.plandialogcomps02.distrefdata.wdp.InternalDistRefDataParamsDialogCompInterface$External.setAll(InternalDistRefDataParamsDialogCompInterface.java:212)
         at com.sap.ip.bi.plan.sb.impl.main.pscreencust.ParamScreenCust.loadNewRule(ParamScreenCust.java:315)
         at com.sap.ip.bi.plan.sb.impl.main.pscreencust.ParamScreenCust._reloadAll(ParamScreenCust.java:590)
         at com.sap.ip.bi.plan.sb.impl.main.pscreencust.ParamScreenCust.prepareView(ParamScreenCust.java:341)
         at com.sap.ip.bi.plan.sb.impl.main.pscreencust.wdp.InternalParamScreenCust.prepareView(InternalParamScreenCust.java:179)
         at com.sap.ip.bi.plan.sb.impl.main.SBuilderMainComp.ehDoNavigationAfterCheck(SBuilderMainComp.java:561)
         at com.sap.ip.bi.plan.sb.impl.main.wdp.InternalSBuilderMainComp.wdInvokeEventHandler(InternalSBuilderMainComp.java:229)
         at com.sap.tc.webdynpro.progmodel.generation.DelegatingComponent.invokeEventHandler(DelegatingComponent.java:161)
         at com.sap.tc.webdynpro.progmodel.controller.Component.fireEvent(Component.java:283)
         at com.sap.ip.bi.plan.sb.impl.main.cuscreencust.wdp.InternalCharUsageScreenCust.wdFireEventEventCharUsageCheckAfter(InternalCharUsageScreenCust.java:236)
         at com.sap.ip.bi.plan.sb.impl.main.cuscreencust.CharUsageScreenCust._finishUpdateAndNavigationAfterCheck(CharUsageScreenCust.java:373)
         at com.sap.ip.bi.plan.sb.impl.main.cuscreencust.CharUsageScreenCust.checkCharUsage(CharUsageScreenCust.java:257)
         at com.sap.ip.bi.plan.sb.impl.main.cuscreencust.wdp.InternalCharUsageScreenCust.checkCharUsage(InternalCharUsageScreenCust.java:151)
         at com.sap.ip.bi.plan.sb.impl.main.SBuilderMainCompView.onActionNavButton(SBuilderMainCompView.java:230)
         at com.sap.ip.bi.plan.sb.impl.main.wdp.InternalSBuilderMainCompView.wdInvokeEventHandler(InternalSBuilderMainCompView.java:206)
         at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
         at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)</i>
    I'll apreciate any help!.
    Thnks a lot!
    Yolanda.

    Hi Hans
    Yes, It was because I had to active some objects in the bussines content, specifically:
    Type Objects --> Type Formulas.  all of them.
    I unmarked this thread as a quiestion, that's for I cannot assing you points.
    Thnk you very much .

  • Java.sql.SQLException:  Invalid column name: user_id

    Hi,
    I am using SQL Server 2000 database and using a Java DAO class executing an SQL query using preparedStatement.The issue is that intermittently i get the following exception: "SQLException:Invalid column name". I checked the filed name in the table and the filed name i gave in the resultset.getInt("field_name")and both are matching.The parameter values for the query are fetched from a JSP report and the surprsing issue is that this exception comes on & off. So iam unable to find the cause of this exception.Can anyone help me out?
    Query Used :
    SELECT usrs.user_id,uperm.value,uedis.attrib_value.......
    FROM USERS usrs
    LEFT OUTER JOIN extended_user_attributes uedis
    ON (usrs.user_id = uedis.user_id AND usdis.attrib_id=?),
    user_permission uperm
    WHERE usrs.user_id = uperm.user_id
    AND uperm.name=?
    I am getting exception when iterating resultset.
    ResultSet rs = preparedStatement.executeQuery();
    while(rs.next())
    UserID userid = new UserID();
    userid.setUserID(rs.getInt("user_id"));
    Thanks
    Balaji.M

    Giving an alias name to the column name will work. If the query uses join or fetching rows from multiple tables, then giving an alias name to the column name, should work fine.
    By,
    Sethu
    It seems you have two user_id columns and the server
    or driver names the column automatically(I am not
    sure of that) in some way. Try giving some alias to
    the field you want, like:
    SELECT usrs.user_id
    u_user_id,uperm.value,uedis.attrib_value.......
    userid.setUserID(rs.getInt("u_user_id"));HTH
    MikeBy

Maybe you are looking for

  • I'm trying to erase everything but it's been loading all day. Help pls

    Hi, I'm trying to erase everything from my iPhone so I can sell it and I selected the erase and everything (I know I sound very technical) and after clicking confirm the black screen with the white spinning circle came on. I left it for a couple of h

  • Accept language in Http Header of Aqualogic portlet.

    Hi, we have developed one web page using ASP.Net and hosted in the Aqualogic portlet server, when ever we access that page from different location/browser, we are getting "en-us" as accept language in the Http header variable of Request object, but i

  • User exit for rerapp t-code

    Hello, i m looking for user exit for rerapp t-code but i couldnt find anything about that from internet. it s about e coming invoice. the invoice is being committed from rerapp t-code; then the view is being matched with invoice and clicked documents

  • Universe creation- without fact tables

    Hi All, I want to create a universe , but the problem is I don have any fact tables in my database. So in which schema i can create a universe? I have one Master table with all  Primary Key? So i thought of mapping this master table with other Dimans

  • At sea trying to move photos from laptop to desktop

    I have two copies of LR 1.41. The desktop runs Vista Home Premium SP1 and the laptop runs XP SP3. Please, someone give me a straighforward way to move these files so that the edits show up in the desktop. I have tried exporting, exporting as a catalo