Problem with reflection in Generics

I'm using the Prototype compiler for JSR-014 and I am having a big problem with reflection. In the simplest case
class n<T> {
    void go() {
     this.getGenericType().getTypeParameters();
     this.getClass().getGenericInterfaces();
}I get a "cannot resolve symbol" on both lines. A glance at the jar included with the prototype shows why: all the collection classes are there, and a lot of the java.lang types, but not java.lang.Class and none of the java.lang.reflection classes.
So what gives? Is reflection not supported yet? (gaak!) Is there another jar I am supposed to download?
Thanks

Schapel is right.
but also
The signatures for fields and methods will include the generic types.
If you really wanted to, this would work.
get the Class's ClassLoader,
work out the name of the Class's file, and get an inputStream to this resource (from the classloader). (This bit works because I use as a diagnostics tool to see if classes are loaded from my jar, or my patches directory - see below).
Write some stuff to read the class file and parse out the generic signatures for the things you are interested in.
I don't think this last part would fit into anyones definition of "fun", however the specs are all available, and it may turn out simpler than at first appearances.
Here's the code I use to get the location of where a class is loaded from.
    static URL getLoadPath(Class theClass) {
        StringBuffer resourcename = new StringBuffer(theClass.getName());
        for(int i=0;i < resourcename.length(); i++) {
            if(resourcename.charAt(i) == '.') {
                resourcename.setCharAt(i,'/');
        resourcename.append(".class");
        return theClass.getClassLoader().getResource(resourcename.toString());
    }if you use getResourceAsStream() in place of getResource() you will have the .class file as an inputStream which you can read and parse.
Have Fun
Bruce

Similar Messages

  • Problems with extension of generic abstract class

    Hello,
    I'm having some problems with the extension of a generic abstract class. The compiler tells me I have not implemented an abstract method but I think I have. I have defined the following interface/class hierarchy:
    public interface Mutator<T extends Individual<S>, S> {
         public void apply( T<S> ind );
    public abstract class AbstractMutator<T extends Individual<S>, S> implements Mutator<T, S> {
         public abstract void apply( T<S> ind );
    }Now I implement AbstractMutator as such:
    public class BinaryMutator extends AbstractMutator<StringIndividual<Integer>, Integer> {
         public void apply( StringIndividual<Integer> ind ) { ... }
    }The compiler says:
    BinaryMutator.java:3: ga.BinaryMutator is not abstract and does not override abstract method apply(ga.Individual<java.lang.Integer>) in ga.AbstractMutator
    Why does it say the signature of the abstract method is apply(Individual<Integer>) if I have typed the superclass as StringIndividual<Integer>?
    Thanks.

    Yes, but the abstract method takes an arg of type <T extends Individual>. So it takes an Individual or a subclass thereof, depending on how I parameterise the class, right? StringIndividual is a subclass of Individual. So if I specify T to be StringIndividual, doesn't the method then take an arg of type StringIndividual?

  • Problem with persistence in Generic Sync application

    Hi:
    We are developing an application which runson SAP Mi 2.5, SP 18,
    Windows Mobile 5.0 and Generic Sync for PDAs.
    We need persistence in our application. We tried with persistence API but
    we found a problem and we send a message to SAP. Until we can solve
    this issue we must implement persistence in other way to satisfy our customer requierements
    Since now,we have implemented persistence with files but the performance of this solution does not meet our customer requirements (the search of data in the PDA is very slow).
    We are thinking in another solution, which consists on using
    Syncbos.Using this alternative, before making a generic sync, and
    executing the code shown below:
    SmartSyncRuntime.getInstance().getSyncBoDescriptorFacade
    ().getAllSyncBoDescriptors()
    the returned syncBOS are those which I have defined in XML. On the
    contrary, after making a generic sync, executing the same code, the
    returned syncbos ARE NOT those whic I have defined in XML. The only
    return that I get is the MIAUTH.
    Any other ideas?
    Thanks
    Kind Regards

    hi satur,
    there are some things to take care if you want to use the persistence layer of the
    SmartSync layer from your GenericSync app.
    first, you have to let the MI client think that your application is using the
    SmartSync functionality. this can be achieved by just including a dummy metadata
    meRepMeta.xml file in the war archive during the deployment process. once the
    MI client framework sees this during the installation, it will set a flag on the MSD
    that your app is a smartsync.
    second, if your app is considered a smartsync, MI will generate the delta request
    and upload messages for your data if ever you have your SyncBo defined in the
    metadata. Since you don't want such functionalities to be ON, i would suggest to
    mark all your SyncBo as local ones; i.e. using attributes suppressDownload=true
    and suppressUpload=true. this way, the MI framework will skip creating the requests
    and delta upload messages for your app during the synchronization process.
    third, your application has to have the syncEventListener implementation to get
    notification when the Sync button (or event) was initiated. if you don't want your
    app to be notified, you may just add synchronization button within your application
    that will call your data manager to prepare your containers (i.e. retrieving the newly
    inserted syncbo, modified syncbos and the list of deleted ones -> genericSync
    containers) and to call the synchronizeWithBackend method.
    fourth, you need to have the inboundProcessor that will parse your data and insert
    them a SyncBo into your local database.
    having tried this but i guess it might work...
    regards
    jo

  • Problems with Reflection API and intantiating an class from a string value

    I want to instantiate a class with the name from a String. I have used the reflection api so:
    static Object createObject(String className) {
    Object object = null;
    try {
    Class classDefinition = Class.forName(className);
    object = classDefinition.newInstance();
    } catch (InstantiationException e) {
    System.out.println(e);
    } catch (IllegalAccessException e) {
    System.out.println(e);
    } catch (ClassNotFoundException e) {
    System.out.println(e);
    return object;
    Let's say my class name is "Frame1".
    and then if i use:
    Frame1 frm = (Frame1) createObject("Frame1");
    everything is ok but i cannot do this because the name "Frame1" is a String variable called "name" and it doesn't work like:
    name frm = (name) createObject("Frame1");
    where i'm i mistaking?
    Thanks very much!

    i have understood what you have told me but here is a little problem
    here is how my test code looks like
    Class[] parameterTypes = new Class[] {String.class};
    Object frm = createObject("Frame1");
    Class cls = frm.getClass();
    cls.getMethod("pack",parameterTypes);
    cls.getMethod("validate",parameterTypes);
    everything works ok till now.
    usually if i would of had instantiated the "Frame1" class standardly the "cls" (or "frm" in the first question ) object would be an java.awt.Window object so now i can't use the function (proprietary):
    frame_pos_size.frame_pos_size(frm,true);
    this function requires as parameters: frame_pos_size(java.awt.Window, boolean)
    because my cls or frm objects are not java.awt.Window i really don't find any solution for my problem. I hope you have understood my problem. Please help. Thanks a lot in advance.

  • Has anyone had problems with Domayne using generic third party RAM for memory upgrades? My RAM is now faulty and had to be removed, but Apple wont replace it under Apple Care because its not a genuine component?

    The computer was purchased in the knowledge that all components and hardware were genuine and subsequently covered by the Apple Care warranty.
    Domayne replaced the genuine components (8GB stick) with generic components (2x 16GB sticks) to save money and boost margin.
    Apple should not allow this misleading, profiteering behaivour. This behaviour is brand damaging. Apple must maintain more control over their supply chain.
    Has anyone had any expirenece with this problem?
    Has anyone made Domayne or other third party resellers acountable for this misleading behaviour?
    Thank you.

    Stick with Brand name RAM and reputable distributors.  Mac is finicky about low quality RAM
    Try OWC http://www.macsales.com/
    Crucial http://www.crucial.com/
    Most RAM comes with Lifetime guarenntee so return it where you got it.

  • Problem with FM:DB_SELECT GENERIC TABLE in 6.0

    Hi Experts,
    There is one report, which is copyed from 4.6 to ECC 6.0. Now my problem is inside the report one FM: DB_SELECT GENERIC TABLE is called. This FM is working properly in 4.6. But it is not working in 6.0 I mean this FM is not fetching the data in 6.0 even though the records are exist in DB tables.
    is there any alternative FM to use instead of above FM. or what might be the problem that FM is not fetching the re
    Thanks in advance

    Hi,
    data: genkey(120) type c,
            genkeyl type i,
    tabname type TABNAME.
    refresh: itab.
    Have a genkey1 validation
    if genkeyl gt 0.
    call the FM
        call function 'DB_SELECT_GENERIC_TABLE'
             exporting
                  bypass      = 'N'
                  genkey      = genkey
                  genkey_ln   = genkeyl
                  tablename   = tabname
             tables
                  inttab      = itab
             exceptions
                  db_error    = 01
                  not_found   = 02
                  wrong_param = 03.
    try the above code and ensure that you are catching the exceptions .
    try it and then get back to the forum.
    Thanks

  • Problems with Transfering Custom Generic List using WebServices

    Friends:
    I need your help.
    I have a class "ListaModelos"
    public class ListaModelos<T> extends ArrayList<T>{
        private List<T> eliminados;
        public ListaModelos()
            super();
            eliminados = new ArrayList<T>();
        @Override
        public boolean remove(Object o) {
            eliminados.add((T)o);
            return super.remove(o);
        public List<T> getEliminados() {
            return eliminados;
        public void setEliminados(List<T> eliminados) {
            this.eliminados = eliminados;
    }In addition, I have this method in a WebService
    @WebMethod(operationName = "setDiariosTrabajo2")
        public boolean setDiariosTrabajo2(@WebParam(name = "diario")
                DiarioTrabajo diario, ListaModelos<String> eliminados) {
            try {
                DiarioTrabajoLg diarioTrabajoLG = new DiarioTrabajoLg();
                boolean guardado = false;
                if(diario.getId() == null)
                    guardado = diarioTrabajoLG.insertar(diario);
                else
                    guardado = diarioTrabajoLG.modificar(diario);
                return guardado;
            } catch (BaseDatosException ex) {
                Logger.getLogger(DDTWebService.class.getName()).log(Level.SEVERE, null, ex);
            return false;
        }When I use this method in WebService Client. the definition "ListaModelos<String>" is not visible but appear List<String>.
    How Can I transfer "ListaModelos<String>" to WebService Client.?
    Thanks 4Ur help...

    Couple of points:
    1) You should not expect the server and client data type to be same. It should be driven by XSD.
    2) It’s the XML which travel over the wire and you should think in those directions.
    Debugging tip:
    Try to watch List<String> content in debug mode and compare the content against your expected content.
    My guess is that List<String> is super class of your specific class and you should be able to extract sub class content using normal iteration.

  • Reflection problems with null pointer exception

    I am having a problem with reflection. I keep getting a NullPointerException and can't figure out why.
    It is happening when I call this:
    ResponseObject result = (ResponseObject)method.invoke(classInstance, argArray);
    I can't figure out what the problem is. I had this reflection working, and then I made some changes to how the argument array was created. In the end, the argarray is the same.
    Any ideas?

    Also, the API for the method class says that a
    NullPointerException is thrown if the object in the
    first argument is null. I have tested for this, and
    it is not null.does it? read again, because giving 'null' as the first argument is perfectly legal. how else would you reflectively invoke a static method, since you might not have an actual instance of the class to pass

  • Problem with generics in general framework

    Hi,
    I've just started using generics and I've been able to solve most of my problems with type declarations etc, but I still have a few problems left.
    My current problem is in a class which has a map of classes which implements a generic typed interface (The interface is called Persister in the code below).
    The map is declared as:
    private Map<Class<?>, Persister<?>> persisters =
              new HashMap<Class<?>, Persister<?>>(); And the interface is declared as:
    interface Persister<T>My problem is that a method in the class which has the map should return a Collection of type T.
    Can that be done without supressing warnings?
    It's probably hard to understand what I mean (since I don't know the terminology) so here's a complete minimal example which illlustrates the problem. The problem is in the selectAll method in the DbFacade class.
    The lines:
         Persister persister = persisters.get(clazz);
         Collection<E> result = persister.selectAll(clazz);Needs to be altered but to what? (Or do I need to make more changes?)
    Thanks in advance
    Kaj
    ///////////////// Start of complete example
    import java.util.*;
    class ClientSample {
         public static void main(String[] args) {
              DbFacade facade = new DbFacade();
              //Works..
              Collection<Holiday> holidays = facade.selectAll(Holiday.class);
    class DbFacade {
         //Map with many different type of persisters,
         //one persister per class.
         private Map<Class<?>, Persister<?>> persisters =
              new HashMap<Class<?>, Persister<?>>();
         DbFacade() {
              persisters.put(Holiday.class, new HolidayPersister());
         //This is where I'm stuck
         //I don't want to add supresswarnings to this method, so what should I do?
         public <E> Collection<E> selectAll(Class<E> clazz) {
              //The following line gives:
              //Persister is a raw type. References to generic type
              //Persister<T> should be parameterized
              Persister persister = persisters.get(clazz);
              //The following line gives:
              //Type safety: The expression of type List needs unchecked
              //conversion to conform to Collection<E>
              Collection<E> result = persister.selectAll(clazz);
              return result;
    interface Persister<T> {
         List<T> selectAll(Class<T> clazz);
    abstract class AbstractPersister<T> implements Persister<T> {
    class HolidayPersister extends AbstractPersister<Holiday> {
         public List<Holiday> selectAll(Class<Holiday> clazz) {
              return null;
    class Holiday {
         //data
    }

    Well you can put in a type cast
    Persister<E> pesister = (Persister<E>) persisters.get(clazz);but you'll stil get a warning. Sometimes there's just no avoiding them. What, AFAIK, you can't tell the compiler is that each entry of the map contains a persister for the class mapped to it.
    All it knows that classes are mapped to Persisters.

  • Problem with VideoDisplay orizzontal reflection

    Hello everyone,
    I write because I have a problem with the item VideoDisplay in Flex.
    A hypothetical
    <mx:VideoDisplay id="videoDisplay" width="400" height="300" />
    how do I reflect it horizontally? So basically the right side should become the left and the right the left.
    I tried to input a negative width but the app crashes.
    Can you help me?
    Thanks

    Hi Eli,
    Many thanks for your help.
    I already have one derivation rule for budget period based in posting_date field. I do not have in field options the field for fm posting date...
    The system should post based in fm posting date. For example, i have one PO with two items, the first item with delivery date (that is the date for fm posting date) have value 01.01.2012 and second item have value 01.02.2012. I have to reflect this in budget for budget period 01.2012 and 02.2012 respectly.
    Can you help me with a suggestion to solve this situation?
    thanks,
    Regards
    Ricardo

  • Problem with native SQL cursor in generic data source

    Hi, All!
    I am implementing generic data source based on FM.
    Because of complicated SQL I canu2019t use Open SQL and RSAX_BIW_GET_DATA_SIMPLE-example u201Cas isu201D.
    So, I have to use Native SQL. But Iu2019ve got a problem with a cursor. When I test my data source in RSA3, everything is Ok. But, if I start appropriate info-package, I get error u201CABAP/4 processor: DBIF_DSQL2_INVALID_CURSORu201D. It happens after selecting of 1st data package in line u201CFETCH NEXT S1 INTOu2026u201D. It seems to me that when system performs the second call of my FM the opened cursor has already been disappeared.
    Did anyone do things like this and what is incorrect?
    Is it real to make generic data source based on FM with using Native SQL open, fetch, closeu2026

    Hi Jason,
    I don't think this SQL is very valuable It is just an aggregation with some custom rules. This aggregation is performing on info-provider which consists of two info-cubes. Here we have about 2 billion records in info-provider and about 30 million records in custom db-table Z_TMP (certainly, it has indexes). I have to do this operation on 21 info-providers like this and I have to do this 20 times for each info-provider (with different values of host-variable p_GROUP)
    SELECT T.T1, SUM( T.T2 ), SUM( T.T3 ), SUM( T.T4 )
            FROM (
                    SELECT F."KEY_EVENT06088" AS T1,
                            F."/BIC/EV_COST" + F."/BIC/EV_A_COST" AS T2,
                            DECODE( D.SID_EVENTTYPE, 23147, 0,
                                                          23148, 0,
                                                          23151, 0,
                                                          23153, 0,
                                                          23157, 0,
                                                          23159, 0,
                                                          24896734, 0,
                                                          695032768, 0,
                                                          695029006, 0,
                                                          695029007, 0,
                                                          695036746, 0, F."/BIC/EV_COST") +
                              DECODE( D.SID_EVENTTYPE, 23147, 0,
                                                          23148, 0,
                                                          23151, 0,
                                                          23153, 0,
                                                          23157, 0,
                                                          23159, 0,
                                                          24896734, 0,
                                                          695032768, 0,
                                                          695029006, 0,
                                                          695029007, 0,
                                                          695036746, 0, F."/BIC/EV_A_COST") AS T3,
                            DECODE( D.SID_EVENTTYPE, 23147, F."/BIC/EV_DURAT",
                                                          23148, F."/BIC/EV_DURAT",
                                                          23151, F."/BIC/EV_DURAT",
                                                          23153, F."/BIC/EV_DURAT",
                                                          23157, F."/BIC/EV_DURAT",
                                                          23159, F."/BIC/EV_DURAT",
                                                          24896734, F."/BIC/EV_DURAT",
                                                          695032768, F."/BIC/EV_DURAT",
                                                          695029006, F."/BIC/EV_DURAT",
                                                          695029007, F."/BIC/EV_DURAT",
                                                          695036746, F."/BIC/EV_DURAT", 0) AS T4
                      FROM "/BIC/VEVENT0608F" F,
                           Z_TMP G,
                           "/BIC/DEVENT06085" D
                      WHERE F."KEY_EVENT06088" = G.ID
                            AND F."KEY_EVENT06085" = D.DIMID
                            AND G.GROUP_NO = :p_GROUP
                            AND ( F."/BIC/EV_COST" < 0 OR F."/BIC/EV_A_COST" < 0 )
                            AND D.SID_EVENTTYPE <> 695030676 AND D.SID_EVENTTYPE <> 695030678
                    UNION
                    SELECT F."KEY_EVNA06088" AS T1,
                            F."/BIC/EV_COST" + F."/BIC/EV_A_COST" AS T2,
                            DECODE( D.SID_EVENTTYPE, 23147, 0,
                                                          23148, 0,
                                                          23151, 0,
                                                          23153, 0,
                                                          23157, 0,
                                                          23159, 0,
                                                          24896734, 0,
                                                          695032768, 0,
                                                          695029006, 0,
                                                          695029007, 0,
                                                          695036746, 0, F."/BIC/EV_COST") +
                              DECODE( D.SID_EVENTTYPE, 23147, 0,
                                                          23148, 0,
                                                          23151, 0,
                                                          23153, 0,
                                                          23157, 0,
                                                          23159, 0,
                                                          24896734, 0,
                                                          695032768, 0,
                                                          695029006, 0,
                                                          695029007, 0,
                                                          695036746, 0, F."/BIC/EV_A_COST") AS T3,
                            DECODE( D.SID_EVENTTYPE, 23147, F."/BIC/EV_DURAT",
                                                          23148, F."/BIC/EV_DURAT",
                                                          23151, F."/BIC/EV_DURAT",
                                                          23153, F."/BIC/EV_DURAT",
                                                          23157, F."/BIC/EV_DURAT",
                                                          23159, F."/BIC/EV_DURAT",
                                                          24896734, F."/BIC/EV_DURAT",
                                                          695032768, F."/BIC/EV_DURAT",
                                                          695029006, F."/BIC/EV_DURAT",
                                                          695029007, F."/BIC/EV_DURAT",
                                                          695036746, F."/BIC/EV_DURAT", 0) AS T4
                    FROM "/BIC/VEVNA0608F" F,
                         Z_TMP G,
                         "/BIC/DEVNA06085" D
                    WHERE F."KEY_EVNA06088" = G.ID
                          AND F."KEY_EVNA06085" = D.DIMID
                          AND G.GROUP_NO = :p_GROUP
                          AND ( F."/BIC/EV_COST" < 0 OR F."/BIC/EV_A_COST" < 0 )
                          AND D.SID_EVENTTYPE <> 695030676 AND D.SID_EVENTTYPE <> 695030678
                 ) T
            GROUP BY T.T1

  • Ugly problem with java.lang.reflect.InvocationTargetException

    Hello,
    I am writing a web service which connects to WebSphere MQ queue manager and puts a message on a queue.
    I use Eclipse and as usual I followed more or less the hints given at:
    http://www.eclipse.org/webtools/jst/components/ws/1.5/tutorials/BottomUpWebService/BottomUpWebService.html
    I have chosen Tomcat 5.5.20 as target server (had to, because otherwise it does not create a server-config.wsdd file), the web service WSDL thingies and the client were created successfully.
    I have created WAR files and everything went fine when I tested the thing on JBoss.
    Bad things started after I deployed the things on the Tomcat server. When I start the client I receive java.lang.reflect.InvocationTargetException as a result. The web service itself does not generate any exception, but the client does (I'll post the dump later..).
    During the debug it turned that the exception is generated at the moment when the web service program tries to call any of the WebSphere functions.
    Now - 1st obvious thing was to check if I have com.ibm.mq.jar in the WEB-INF/lib directory inside my WAR files. Yep! There it was.
    So.. if the thing works just fine on JBoss and it booms on Tomcat I wonder whats the hack here? I copied all of the MQ libraries i have from JBOSS_HOME/lib to CATALINA_HOME/shared/lib and CATALINA_HOME/common/lib. Well.. that's quite ugly, because all necessary jars are inside the WEB-INF/lib directory. Anyway nothing of the above helped me running the thing on Tomcat.
    Do you have any suggestions or have anyone of you ever had such problem?
    Here are the exception dump and part of the code:
      - Setting up MQ environment:
         - Setting hostname...
    An AxisFault exception occured: java.lang.reflect.InvocationTargetException
    AxisFault
    faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
    faultSubcode:
    faultString: java.lang.reflect.InvocationTargetException
    faultActor:
    faultNode:
    faultDetail:
         {http://xml.apache.org/axis/}hostname:ghjvk0j
    java.lang.reflect.InvocationTargetException
         at org.apache.axis.message.SOAPFaultBuilder.create
    Fault(SOAPFaultBuilder.java:222)
         at org.apache.axis.message.SOAPFaultBuilder.endElement(
    SOAPFaultBuilder.java:129)
         at org.apache.axis.encoding.DeserializationContext.endElement(
    DeserializationContext.java:1087)
         at org.apache.xerces.parsers.AbstractSAXParser.endElement(
    Unknown Source)
         at org.apache.xerces.impl.XMLNSDocumentScannerImpl.
    scanEndElement(Unknown Source)
         at org.apache.xerces.impl.XMLDocumentFragmentScanne
    rImpl$Fragment ContentDispatcher.dispatch(Unknown Source)
         at org.apache.xerces.impl.XMLDocumentFragmentScannerI
    mpl.scanDocument(Unknown Source)
         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
    Source)
         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
    Source)
         at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
         at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
    Source)
         at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse
    (Unknown Source)
         at javax.xml.parsers.SAXParser.parse(Unknown Source)
         at org.apache.axis.encoding.DeserializationContext.parse(
    DeserializationContext.java:227)
         at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
         at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
         at org.apache.axis.handlers.soap.
    MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
         at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
         at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
         at org.apache.axis.client.Call.invoke(Call.java:2767)
         at org.apache.axis.client.Call.invoke(Call.java:2443)
         at org.apache.axis.client.Call.invoke(Call.java:2366)
         at org.apache.axis.client.Call.invoke(Call.java:1812)
         at pl.pzu.services.TfiAuthenticationSoapBindingStub.
    verify(TfiAuthenticationSoapBindingStub.java:245)
         at pl.pzu.services.TfiAuthenticationProxy.
    verify(TfiAuthenticationProxy.java:45)
         at org.apache.jsp.sampleTfiAuthenticationProxy.
    Result_jsp._jspService(Result_jsp.java:158)
         at org.apache.jasper.runtime.HttpJspBase.
    service(HttpJspBase.java:97)
         at javax.servlet.http.HttpServlet.
    service(HttpServlet.java:802)
         at org.apache.jasper.servlet.JspServletWrapper.
    service(JspServletWrapper.java:334)
         at org.apache.jasper.servlet.JspServlet.
    serviceJspFile(JspServlet.java:314)
         at org.apache.jasper.servlet.JspServlet.
    service(JspServlet.java:264)
         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$Http11Connec
    tionHandler.processConnection(Http11BaseProtocol.java:664)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(Pool
    TcpEndpoint.java:527)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(Lea
    derFollowerWorkerThread.java:80)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
    ThreadPool.java:684)
         at java.lang.Thread.run(Unknown Source)There is the part of the web service code where the event occurs:
         public void writeMessage(String message,
    String message_ID) throws Exception
              System.out.println("      - Setting up MQ environment: ");
              try
                   System.out.println("      - Setting hostname...");
         NEXT LINE CAUSES THE CLIENT TO THROW
         This is the first call to any WebSphere assets.
         During debug It says the it is unable to inspect the MQEnvironment
         object...
                   MQEnvironment.hostname = m_config.getQMHost();
                   System.out.println("      - Setting port...");
                   MQEnvironment.port = m_config.getQMPort();
                   System.out.println("      - Setting channel...");
                   MQEnvironment.channel = m_config.getQMChannel();
         }I think that if it works on JBoss and it doesn't on Tomcat it is not coding problem, but rather a configuration...
    Thanx for any ideas or help from ur side.

    Did you have any success on this?
    I also have the same problem with Tomcat 6.
    I had Tomcat 5.0 working with this code, but when we migrated to Tomcat 6.0, I am getting this exception on the clent side. I figured out that it is occuring on invoking WebSphere MQ call from the code.
    Thanks

  • Problems with Generics

    Ok, I have a problem with the <? extends NamedType> generic parameterized type, here are three example classes:
    public abstract class Base
         public abstract <? extends Base> getMe();
    public abstract class Spec
    extends Base
         public abstract <? extends Spec> getMe();
    public class Impl
    extends Spec
         public Impl()
              super();
         public Impl getMe()
              return this;
         public String toString()
              return "I live!";
    }And a main method in another class:
    public static void main(String[] args)
         Impl im = new Impl();
         Impl i = im.getMe();
         Spec s = Spec.getMe();
         Base b = Base.getMe();
         System.out.println("im = "+im);
         System.out.println("i = "+i);
         System.out.println("s = "+s);
         System.out.println("b = "+b);
    }And the compiler returns this:
    Base.java:3: <identifier> expected
            public abstract <? extends Base> getMe();
                             ^
    Base.java:3: > expected
            public abstract <? extends Base> getMe();
                                                    ^
    Spec.java:4: <identifier> expected
            public abstract <? extends Spec> getMe();
                             ^
    Spec.java:4: > expected
            public abstract <? extends Spec> getMe();
                                                    ^
    4 errorsPlease assist.

    It worked!
    I don't know why that didn't work in Eclipse, so:
    "Return types are compatible if the overriden method's return type is a subclass of the original method's return type."
    I also mistyped the main method, but this new one didn't change the original error:
    public static void main(String[] args)
         Impl im = new Impl();
         Impl i = im.getMe();
         Spec s = Spec.getMe();
         Base b = Base.getMe();
         System.out.println("im = "+im);
         System.out.println("i = "+i);
         System.out.println("s = "+s);
         System.out.println("b = "+b);
    }should be:
    public static void main(String[] args)
         Impl im = new Impl();
         Impl i = im.getMe();
         Spec s = i.getMe();
         Base b = s.getMe();
         System.out.println("im = "+im);
         System.out.println("i = "+i);
         System.out.println("s = "+s);
         System.out.println("b = "+b);
    }

  • Problem with Generic datasource from function

    I developed generic datasource from function module.
    But I have problem with the select options.
    First one is order number  OBJECT_ID type char 10. When I input Object_ID = 45755 , no data selected.
    When input 0000045755, one data record selected.
    But I called functiion CONVERSION_EXIT_ALPHA_INPUT to conevet the input data. And I found  45755 was converted to 0000045755, but no record selected.
         LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'OBJECT_ID'.
            MOVE-CORRESPONDING L_S_SELECT TO L_R_OBJECT_ID.
            APPEND L_R_OBJECT_ID.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        INPUT         = L_R_OBJECT_ID-high
      IMPORTING
       OUTPUT        = L_R_OBJECT_ID-high
             CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        INPUT         = L_R_OBJECT_ID-low
      IMPORTING
       OUTPUT        = L_R_OBJECT_ID-low
          ENDLOOP.
    Another problem is CREATED_AT, which type is DEC 15,  how could I handle it ?  input is yyyymmdd, I tried to add '000000', but can't select any data.
    Thanks for any help.

    code is :
    FUNCTION ZACTIVITY_PLAN_PARTNER.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(I_REQUNR) TYPE  SRSC_S_IF_SIMPLE-REQUNR
    *"     VALUE(I_DSOURCE) TYPE  SRSC_S_IF_SIMPLE-DSOURCE OPTIONAL
    *"     VALUE(I_MAXSIZE) TYPE  SRSC_S_IF_SIMPLE-MAXSIZE OPTIONAL
    *"     VALUE(I_INITFLAG) TYPE  SRSC_S_IF_SIMPLE-INITFLAG OPTIONAL
    *"     VALUE(I_READ_ONLY) TYPE  SRSC_S_IF_SIMPLE-READONLY OPTIONAL
    *"     VALUE(I_REMOTE_CALL) TYPE  SBIWA_FLAG DEFAULT SBIWA_C_FLAG_OFF
    *"  TABLES
    *"      I_T_SELECT TYPE  SRSC_S_IF_SIMPLE-T_SELECT OPTIONAL
    *"      I_T_FIELDS TYPE  SRSC_S_IF_SIMPLE-T_FIELDS OPTIONAL
    *"      E_T_DATA STRUCTURE  ZACTIVITY_PLAN_PARTNER OPTIONAL
    *"  EXCEPTIONS
    *"      NO_MORE_DATA
    *"      ERROR_PASSED_TO_MESS_HANDLER
    Example: DataSource for table SFLIGHT
      TABLES: CRMD_ORDERADM_H.
    Auxiliary Selection criteria structure
      DATA: L_S_SELECT TYPE SRSC_S_SELECT.
      DATA:   BEGIN OF ACTIVITY,
                       OBJECT_ID       type CRMT_OBJECT_ID_DB,
                       PROCESS_TYPE    type CRMT_PROCESS_TYPE_DB,
                       OBJECT_TYPE     type CRMT_SUBOBJECT_CATEGORY_DB,
                       CREATED_BY      type CRMT_CREATED_BY,
                       CREATED_AT      type CRMT_CREATED_AT,
               END OF ACTIVITY.
      DATA: ZACTIVITY   LIKE TABLE OF ACTIVITY WITH HEADER LINE,
            Zorder   LIKE TABLE OF ZORDER_S WITH HEADER LINE,
            d_start type c length 15,
            d_end type c length 15
    Maximum number of lines for DB table
      STATICS: S_S_IF TYPE SRSC_S_IF_SIMPLE,
    counter
              S_COUNTER_DATAPAKID LIKE SY-TABIX,
    cursor
              S_CURSOR TYPE CURSOR.
    Select ranges
      RANGES: L_R_OBJECT_ID FOR CRMD_ORDERADM_H-OBJECT_ID,
              L_R_CREATED_AT FOR CRMD_ORDERADM_H-CREATED_AT,
              L_R_date for ZACTIVITY_PLAN_PARTNER-ZPLAN_DAT.
    Initialization mode (first call by SAPI) or data transfer mode
    (following calls) ?
      IF I_INITFLAG = SBIWA_C_FLAG_ON.
    Check DataSource validity
        CASE I_DSOURCE.
          WHEN 'ZACTIVITY_PLAN_PARTNER'.
          WHEN OTHERS.
            IF 1 = 2. MESSAGE E009(R3). ENDIF.
    this is a typical log call. Please write every error message like this
            RAISE ERROR_PASSED_TO_MESS_HANDLER.
        ENDCASE.
        APPEND LINES OF I_T_SELECT TO S_S_IF-T_SELECT.
    Fill parameter buffer for data extraction calls
        S_S_IF-REQUNR    = I_REQUNR.
        S_S_IF-DSOURCE = I_DSOURCE.
        S_S_IF-MAXSIZE   = I_MAXSIZE.
        APPEND LINES OF I_T_FIELDS TO S_S_IF-T_FIELDS.
      ELSE.                 "Initialization mode or data extraction ?
    First data package -> OPEN CURSOR
        IF S_COUNTER_DATAPAKID = 0.
          LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'OBJECT_ID'.
            MOVE-CORRESPONDING L_S_SELECT TO L_R_OBJECT_ID.
            APPEND L_R_OBJECT_ID.
         ENDLOOP.
    if  L_R_OBJECT_ID-option is initial.
      L_R_OBJECT_ID-option = 'EQ'.
      L_R_OBJECT_ID-sign ='I'.
      endif.
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        INPUT         = L_R_OBJECT_ID-high
      IMPORTING
       OUTPUT        = L_R_OBJECT_ID-high
             CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        INPUT         = L_R_OBJECT_ID-low
      IMPORTING
       OUTPUT        = L_R_OBJECT_ID-low
          LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'CREATED_AT'.
            MOVE-CORRESPONDING L_S_SELECT TO L_R_CREATED_AT.
            APPEND L_R_CREATED_AT.
          ENDLOOP.
          OPEN CURSOR WITH HOLD S_CURSOR FOR
          SELECT OBJECT_ID FROM CRMD_ORDERADM_H
                                  WHERE OBJECT_ID  IN  L_R_OBJECT_ID
                                  AND          CREATED_AT IN L_R_CREATED_AT    and
                                        PROCESS_TYPE EQ 'Z220'.
        ENDIF.                             "First data package ?
    Fetch records into interface table.
      named E_T_'Name of extract structure'.
        FETCH NEXT CURSOR S_CURSOR
                   APPENDING CORRESPONDING FIELDS
                   OF TABLE E_T_DATA
                   PACKAGE SIZE S_S_IF-MAXSIZE.
        IF SY-SUBRC <> 0.
          CLOSE CURSOR S_CURSOR.
          RAISE NO_MORE_DATA.
        ENDIF.
        S_COUNTER_DATAPAKID = S_COUNTER_DATAPAKID + 1.
      ENDIF.              "Initialization mode or data extraction ?
    ENDFUNCTION.

  • Function module based generic extractor - Problem with the selection

    Hi all
    The following is my code in the function module. I am able to get the entire data if i dont give any selections and the number of records is also correct. But when i select a MATNR value, it returns 0 records where as it needs to return 3 records. If i give selection based on bukrs, werks, lgort its working fine. But if i give selection based on MATNR, then it is not working.... I think there is a problem in the bold part of my code. If i debug, LS_MATNR is having the correct value which indicates that there is no problem with the value being passed to LS_MATNR from my selection screen of my datasource in RSA3. Even GT_WERKS is also having data. Please help.
    OPEN CURSOR WITH HOLD S_CURSOR FOR
    SELECT  MARA~MANDT
            MARA~MATNR
            MARC~WERKS
            MARD~LGORT
            MARA~MEINS
            MARD~LABST
            MARD~EINME
            MARD~SPEME
            MARD~RETME
            MARD~INSME
            MARD~UMLME
            MARD~VMLAB
            MARD~VMEIN
            MARD~VMSPE
            MARD~VMRET
            MARD~VMINS
            MARD~VMUML
            MARC~XCHPF
            MARD~KLABS
            MARD~KEINM
            MARD~KSPEM
            MARD~KINSM
    from MARA inner join MARC on
    MARAMANDT = MARCMANDT AND
    MARAMATNR = MARCMATNR
    inner join MARD on
    MARAMANDT = MARDMANDT AND
    MARAMATNR = MARDMATNR
    AND MARCWERKS = MARDWERKS
    for all entries in gt_werks
    where MARC~werks EQ gt_werks-werks
    AND MARA~MATNR in LS_MATNR.
        ENDIF.                             "First data package ?
    Fetch records into interface table.
      named E_T_'Name of extract structure'.
        FETCH NEXT CURSOR S_CURSOR
                   APPENDING CORRESPONDING FIELDS
                   OF TABLE E_T_DATA
                   PACKAGE SIZE S_S_IF-MAXSIZE.

    try this
    select marc~matnr MARC~WERKS into t_marc for all entries in gt_werks
    where werks EQ gt_werks-werks and lvorm = space.
    if t_marc is not initial.
    select MARD~LGORT MARD~WERKS MARA~MEINS MARD~LABST MARD~EINME
    MARD~SPEME MARD~RETME MARD~INSME MARD~UMLME
    MARD~VMLAB MARD~VMEIN MARD~VMSPE MARD~VMRET
    MARD~VMINS MARD~VMUML MARC~XCHPF MARD~KLABS
    MARD~KEINM MARD~KSPEM MARD~KINSM  MARA~MEINS  from
    mard inner join MARA on mard~matnr = mara~matnr
    for all entries in t_marc where  mard~matnr = t_marc-matnr and mard-werks = t_marc-matnr
    and mard~lvorm = space.

Maybe you are looking for