Concrete class name in StackTraceElement

Does anyone know how to get information about concrete classes
on the java stack trace? It is customary to get stack traces that
list abstract classes or interfaces, but in the example below
what was the concrete class implementing HttpServlet or extending
the abstract class xxxCommandServlet that caused the exception?
Java's StackTraceElement doesn't have a reference to the object
that is calling a method that is put on the stack. Surely that
information is on the stack frame since they must be passing
around a "this" pointer as one of the parameters, but how to get it?
Wouldn't it be nice to have an additional field in StackTraceElement,
callingClass. I wonder if it is planned since it would help in
debugging.
public final class StackTraceElement implements java.io.Serializable {
// Initialized by VM
private String declaringClass;
private String callingClass; // NEW FIELD??
private String methodName;
private String fileName;
private int lineNumber;
Thanks very much,
Dmitri
Example stack trace
at com.xxx.servlet.xxxCommandServlet.doGet(xxxCommandServlet.java:66)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2495)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2204)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)

No, com.xxx.servlet.xxxCommandServlet is an abstract
class. Nonetheless, as the stack trace indicated, there is a method named doGet, and the exception occurred at line 66 in xxxCommandServlet.java. So you're saying you can't directly instantiate xxxCommandServlet, this is true, but whatever extends that abstract class inherited the doGet method, of course. It shouldn't matter what the actual class was; the error wasn't in the actual class, but in the xxxCommandServlet (or resulting from something else within the stack trace).

Similar Messages

  • Abstract/ concrete class questions/problems

    I am new to java and working on a abstract problem. I'm getting several errors. Here is the code I have so far for the abstract class. I commented out the super and it compiles but I'm not sure if it correct. I'm suppose to create a abstract base class Animal. Single constructor requires String to indicate type of animal which then is stored in an instance variable. I also have to add a few methods (describe(), move(), etc).
    public abstract class  Animal
         public Animal(String type)
              //super(type);
         public abstract String describe();
         public abstract String sound();
         public abstract String sleep();
         public abstract String move();
    }

    thanks for the replies. I modified my code but I have a few more errors I can't figure out. Can you browse the code and help point me in the right direction.
    Here are the errors I get
    cannot find symbol
    symbol : constructor Cat(java.lang.String,java.lang.String)
    location: class Cat
    cannot find symbol
    symbol : constructor Robin(java.lang.String)
    location: class Robin
    abstract base class:
    public abstract class  Animal
         String type;
         public Animal(String type)
           this.type = type;
         public abstract String describe();
         public abstract String sound();
         public abstract String sleep();
         public abstract String move();
    }concrete class
    public class Cat extends Animal
         private String name;
         protected String breed;
         public Cat()
           super("Cat");
         public String describe()
              return new String(",a breed of Cat called");
         public String sound()
              return new String("Meow");
         public String sleep()
              return new String("Kitty is having purfect dreams!");
         public String move()
              return new String("This little Kitty moves fast!");
    }another abstract class
    public abstract class Bird extends Animal
         protected String breed;
         public Bird()
           super("Bird");
         public abstract String move();
    }here is the abstract test program itself
    public class AbstractTest
         public static void main(String[] args)
              Cat cat = new Cat("Kitty", "Angora");
              Robin bird = new Robin("Rockin");
              System.out.println("Form the cat:   ");
              System.out.print("This is:     "); cat.describe();
              System.out.print("Sound:       "); cat.sound();
              System.out.print("Sleeping:    "); cat.sleep();
              System.out.print("Moving:      "); cat.move();
              System.out.println("\n");
              System.out.println("For the robin:     "); bird.describe();
              System.out.print("This is:             "); bird.sound();
              System.out.print("Sound:               "); bird.sleep();
              System.out.print("Moving:              "); bird.move();
              System.out.print("\n");
              System.out.println("nEnd of program.");
    }

  • Which is the best way for a called function to identify caller class name.

    Which is the best way for a called function to identify the caller class name .
    1)Using sun.reflect.Reflection from called function
                    Class caller = Reflection.getCallerClass(2);
                    System.out.println("Caller Class Name ::"+caller.getName());2) Analyzing current threads stack trace from called function
                    StackTraceElement[] stElements=Thread.currentThread().getStackTrace();
                    System.out.println("Caller Class Name ::"+stElements[3].getClassName());Is there any alternate ways to achieve the same .Which is the best way ?
    Called function doesn’t have any arguments, I don’t want t pass any arguments from caller function to called function.
    Plz help.
    With kind regards
    Paul

    798185 wrote:
    Which is the best way for a called function to identify the caller class name .
    Is there any alternate ways to achieve the same.SecurityManager
        // 0 is the anonymous SecurityManager class
        // 1 is this class (also works in static context)
        // 2 is calling class
        static Class getClass(int i) {
            return new SecurityManager() {
                protected Class[] getClassContext() {
                    return super.getClassContext();
            }.getClassContext();

  • Working out the Concrete classes of an Interface

    Hi all I have an interface e.g. Animal with 3 concrete classes:
    Dog, Cat and Bird.
    Is there a way of working out that the Animial interace contains these 3 concrete classes in anyway?
    Thanks,

    notforgoogle wrote:
    Is there a way of working out that the Animial interace contains these 3 concrete classes in anyway?Not really, no.
    First of all, it doesn't "contain" them. The relationship between class and interface is one-way.
    You could whip up something that examines every class on your classpath, or a portion of it, and cheks whether it implements that interface. However, this will not work in general, since classes can be loaded from anywhere, and you may not always have the right or ability to list the classes present there, only to request specfic classes by name.

  • Concrete Class

    Hi
    Could someone tell me what the difference is between an abstract class, interface class and a concerte class. Cant figure it out.
    Thank you
    David

    an interface has deferred methods that must be used by the same name by the implenting class(es)
    an abstract class CAN have deferred (abstract) methods that must be implemented by the extending class
    a concrete class is 'normal' class with no deferred methods

  • Help - Class name and descriptions for a function location.

    Hi Guys
    i have to write a report that displays the class and class descriptions for a function location. the user passes in either the function location(TPLNR) or the class name and  the report should display the the class characteristics and resp. values. Is there a FM that i coud use?
    please help.
    many thanks.
    seelan.

    sadiepu1 wrote:
    When I set up Words with Friends on my Fire it asked for my username and password which from a previous reply to my inquiry above stated that the S 3 doesn't store due to privacy issues. I have tried all my usual combinations of usernames and passwords and my Fire won't let me access the game as it keeps telling me that one or the other is not correct. I have deleted the app from my Fire and re-downloaded it but have the same error comes up. I have accessed the Words with Friends support both on my phone and their website but there is no live chat. I might have to take both to a Verizon store. Also, my Fire won't let me access the game without a correct username and password. To say that I am frustrated would be an understatement as well I have tried everything I can think of with no luck! Thanks for any help you can give!
    Did you use facebook to log in? 
    Verizon will not be able to help you retrieve any of the information you need.  You will have to contact Zynga.

  • How can i get all java class names from a package using reflection?

    hi,
    can i get all classes name from a package using reflection or any other way?
    If possible plz give the code with example.

    You can't, because the package doesn't have to be on the local machine. It could be ANYWHERE.
    For example, via a URLClassLoader (ie from the internet) I could load a class called:
    com.paperstack.NobodyExpectsTheSpanishInquisitionI haven't written it yet. But I might tomorrow. How are you going to determine if that class is in the package?
    This subject comes up a lot. If you want to do something a bit like what you're asking for (but not quite) there are plenty of threads on the subject. Use google and/or the forum search facility to find them.
    But the answer to your question, as you asked it, is "you can't do that".

  • How to find the class name of the  BO

    HI
      How to find out a class for a business object.
    For example for the Business Object FORMABSENC i want to find out the class name.
    iam not able to find out from se24 or swo1.
    Or please suggest me how can i use the method createbapistructure of this businessobject.
    Regards
    vijaya

    Hello Vijay
    When you double-click on "method" AbsenceForm.CreateBapiStructure (transaction SWO1) and switch to tab ABAP you see (on ERP 6.0) that the field Name is empty meaning this BO "method" has not yet been implemented.
    Other methods are implemented by modules of function group SWXA. Checking package SWX you will see that there are no suitable classes around for this object.
    Final remark: Methods of business objects has just a semantic meaning and has nothing to do with object orientation (i.e. classes).
    Regards
      Uwe

  • Object class name does not exist in IDM

    Hi Team
    We are process of Integrating GRC 10.1 to Enterprise Portal.Followed accordingly as per the SAP Note No. 1977781.
    While running the Schema Job, we get a message Schema Imported Suxcessfully. While running the Job : GRAC_REPOSITORY_SYNC_JOB, the job
    shows successful, but a Warning Message : User Adaptor Empty in SLG1 T.code.
    I have checked the Path suffix,connectors,data source and all are maintained but no sure about this warning message.
    Secondly,I tried for test creation of user on Portal via GRC 10.1.I am getting below error
    "Object class name does not exist in IDM" Please see log below
    Request gets closed stating Auto Provisioning failed.Please advice if someone has faced same issue and the steps taken to rectify it.
    Thanks
    Nitesh

    Hi Nitesh,
    We worked on this issue for quiet sometime with SAP to get this finally fixed You can check all below mentioned notes.
    First Check:
    Please check the Note: 1915763 - Error Provisioning from GRC 10 to SAP Portal while adding or removing a role in Change Account request type.
    This Note says that if your LDAP set as data source is read-only in Portal, then you need to change it to Modifiable in order to allow create or change user belonging to LDAP.
    We have set the UME correctly and no longer read-only. But our access requests still used to fail with the following messages.
    "Object class name does not exist in IDM".
    Second Check:
    Kindly ensure the field mapping for portal is done in IMG settings properly.
    If it is fine please check below note 2033714 - AC10.0: error in SGL1 "Object class name does not exist in IDM".
    This note is only to check if you have made any mistake with your portal mapping and doesn't address the correct issue.
    Third Check:
    Finally after implementing SAP note 1941250 - UAM: Truncated parameters provisioned on changing users from Access Request
    our issue got fixed.
    Regards,
    Madhu.

  • Class name of  stub for EJBHome Impl

    Hi,
    I am doing a context.lookup to find the EJBHome stub and I print the class name
    of the object that is looked up, every time a diffrent name comes up.
    Object obj = ic.lookup("ejb/test");
    System.out.println(hh.getClass().getName());
    I get $Proxy1
    and when I add the two more lines
    Object obj1 = ic.lookup("javax/jms/QueueConnectionFactory");
    System.out.println(obj1.getClass().getName());
    Object obj = ic.lookup("ejb/test");
    System.out.println(obj.getClass().getName());
    and re-run only my client I get:
    weblogic.jms.client.JMSConnectionFactory
    $Proxy2
    I understand that weblogic generates the stub dynamically, but how come (class name
    of) a object bound to JNDI tree keeps changing?
    and why does that happen for the connection factory(is that not a RMI stub too)?
    viswa

    viswa <[email protected]> wrote:
    Hi,
    I am doing a context.lookup to find the EJBHome stub and I print the class name
    of the object that is looked up, every time a diffrent name comes up.
    Object obj = ic.lookup("ejb/test");
    System.out.println(hh.getClass().getName());
    I get $Proxy1
    and when I add the two more lines
    Object obj1 = ic.lookup("javax/jms/QueueConnectionFactory");
    System.out.println(obj1.getClass().getName());
    Object obj = ic.lookup("ejb/test");
    System.out.println(obj.getClass().getName());
    and re-run only my client I get:
    weblogic.jms.client.JMSConnectionFactory
    $Proxy2
    I understand that weblogic generates the stub dynamically, but how come (class name
    of) a object bound to JNDI tree keeps changing?You can look at java/lang/reflect/Proxy.java to see how proxy class names are generated.
    BTW, it looks like WebLogic 7.0 doesn't use JDK dynamic proxies anymore and generates
    stub/skeleton bytecode by itself, so Stub class names are no longer $Proxy123 but xxx_WLStub.
    and why does that happen for the connection factory(is that not a RMI stub too)?My guess is that the actual stub reference is buried somewhere else.
    viswa--
    Dimitri

  • Class name and file name

    if i have putiple classes in a single file then if a clas declared as public then the file name shoud me same as class name.... why?
    if i declare two public class in a same source fiel what will happen????????
    plz help................
    thanks in advance

    And i bet a million dollars that even you don't
    search the forum before posting anything . So stop
    suggesting that .Too bad that I wasn't included in the bet. You won't be coz you are a veteran and it's from you and the other veterans(I will include my peers as well) that i learnt a lot including good googling.
    It happens
    that I search the forum before I post an answer.
    Searching the forum using google is actually very
    effective.Yes and thats the very reason i didn't mention googling in that reply because i know that google gives the results from the threads in the forum as i myself have read a lot of posts at this forum using google and obtained solutions.But it's a different case when a person has to manually search the forum(without google) to see if a topic matches his needs and as i just mentioned off lately most of the posts come out with crappy headers like "Please Help Me" ; "Error" ; "Can't compile" ; "Help Needed" ; "What's wrong in this".How much sense does these headers make with respect to the what the post is really about.One can't expect a person to verify each such post with such crappy headers and read each's contentns.Just imagine how frustrating it is.Even the posters lose their cool when someone posts with such titles.Then just imagine what will be the condition of the person who is asked to check the forum before posting.But i totally endorse googling.There is no pardon or any sort of respite for a person who has posted without googling which would have fetched him top notch answers.
    Oh God!That looks really long!

  • Class name and package name clashing

    When i have a class and a package with the same name, I cannot access classes in the package. For example I have 3 classes and 1 package as below
    - Test.java
    - PackageName.java
    + PackageName // this is a directory
    - MyClass.java
    Below are the codes of .java files
    Test.java
    =======
    public class Test { PackageName.MyClass a = new PackageName.MyClass ();}
    PackageName.java
    ===============
    public class PackageName{ }
    MyClass.java
    ==========
    package PackageName; public class MyClass { }
    I can compile PackageName.java and MyClass.java but not Test.java. It says
    cannot resolve symbol
    symbol : class MyClass
    location: class PackageName
    PackageName.MyClass a = new PackageName.MyClass ();
    But if I remove the PackageName.java, I can compile Test.java perfectly. I think when I use PackageName.MyClass, java thinks that I try to access an inner class MyClass of PackageName class, and that does not exists. Is there any way to solve this ambiguation, other than making the package name and class name different? Thank you very much.

    This works fine: just add an import to Test.java.
    import PackageName.MyClass;
    public class Test
        public static void main(String [] args)
            MyClass a = new MyClass();
    public class PackageName {}
    package PackageName;
    public class MyClass {}It's a pretty wacky, useless example, but it works.
    Plus I thought inner classes would have a dollar sign in their .class file names. When I compile this:
    public class OuterClass
        public static void main(String [] args)
            OuterClass outer = new OuterClass();
            System.out.println(outer);
        public String toString() { return "I'm an OuterClass"; }
        class InnerClass
            public String toString() { return "I'm an InnerClass"; }
    }I see two .class files: OuterClass.class and OuterClass$InnerClass.class
    Why make up examples like this? It's hard enough writing code, and it's easy to disambiguate for the compiler.

  • Driver Class name and JDBC URL Format

    Hi,
    I'm trying to use the oracle jdbc driver to connect to an (what a surprise) oracle database.
    I need a 'driver class name' and the JDBC URL Format. But I cannot find these anywhere.
    Can anyone help me out here?
    Regards,
    Laurens

    http://myjdbc.tripod.com/basic/jdbcurl.html

  • How to convert a String variable as class name and method name?

    i have two classes
    class Student
    public String insertStudent(String sname)
    { return("Student has been inserted ");     }
    class Teacher
    public String execute(String methodName, String className)
    {  //return statement of the method 'insertStudent' in the class 'Student'; }
    }Now, i have a class with the main method. Here, i would like to call the method *'insertStudent'* of class *'Student'*
    using the method *'execute'* of class *'Teacher',* passing the method-name and the class-name (viz. insertStudent, Student) as the
    String parameter.
    Can anyone please help me out. Thanks
    regards,
    chinglai

    You should have just added that as a comment on your [initial posting|http://forums.sun.com/thread.jspa?threadID=5334953] instead of starting a new thread.
    Now, i have a class with the main method. Here, i would like to call the method 'insertStudent' of class 'Student'using the method 'execute' of class 'Teacher', passing the method-name and the class-name (viz. insertStudent, Student) as the
    String parameter.
    Why oh why? What do you want to achieve?
    Let me tell you: there is a way to do what you try to do, but it's not recommended and should be used only very sparingly. Especially not in anything like your code, that resembles normal business logic (as opposed to an application framework such as Spring, for example).
    Can you explain what exactly you want to do with that? Why should a Teacher be able to call any random method ony any other class. And what good would that do?

  • How to programmatically get the source for a class provided the class name?

    Hello,
    As a quick background, I am providing some tools to potential users of an in-house framework. One is the ability to generate quick prototypes from our existing demo applications. Assume a user downloads our jars and uses them in their project (we are using Eclipse, but that detail should not greatly affect my question). Included in the jars is a demos package that contains ready-to-run classes that serve to exhibit certain functionality. Since many users may just need quick extensions of these demos, I am trying to provide a way for them to be able to create a new project that starts with a copy of the demo class.
    So, the user is provided a list of the existing demos (each one uses a single class). When the user makes their selection, with the knowledge of our framework, I can translate that into what demo class they need (returned as a string of format package.subpack1.subpackn.DemoClassName). What I now want to do is to use that complete class name to get the source (look up the file) for the corresponding class, and copy it into to a new file in their project (the copying into the project can be done easily in Eclipse, so what I need help with is the bolded part). Is there a simple way to get the source given a class path for a class as described above? You may assume the source files are included in the jars for the framework.
    Thanks in advance.

    If there's a file named "package.subpack1.subpackn.DemoClassName.java" in a "demos" directory in the jar, then yes. You'd just use
    InputStream code = getResourceAsStream("/demos.package.subpack1.subpackn.DemoClassName.java");Or if those dots in the name actually separate directory names, i.e. you have a "package" directory under "demos" and a "subpack1" director under that and so on, then:
    InputStream code = getResourceAsStream("/demos/package/subpack1/subpackn/DemoClassName.java");

Maybe you are looking for

  • Previewing post drops attachments

    I have noticed that people often claim to have attached a file, but it is not present in their post. The cause, I suspect, is that clicking on the "Preview Post" link clears the contants of the attachment box. Any chance that can be fixed so it retai

  • How can I export my bookmarks to IE from Firefox 4.0, where I do not have the option to organize my bookmarks?

    The references I have seen about how to export bookmarks assume that you should start by going to "Organize bookmarks", however in Firefox 4.0 this option is not available to me. Thanks for any help in advance.

  • ITunes can not be acosiated with more than 5 credit cards in 30 days?

    I use prepaid my treat 25$ visa cards in iTunes, I recently tried tonadd a new one today and got this message? What can I do? Thanks

  • Method printlin missing?

    Could somebody please help w/ this... i can't get it. I get this compile error. Is there something simple I'm missing? // ERROR ConnectionBean.java:25: cannot resolve symbol symbol : method println (java.lang.String,java.lang.ClassNotFoundEx eption)

  • Is Ant 1.6.2 supported in 10.1.2?

    JDeveloper 10.1.2 is distributed with Ant 1.5.2, I have modified jdev/lib/libaries.xml so that it uses Ant 1.6.2, as outlined in this forum topic. New ant version This modification works well (so far). Is this modification supported by Oracle? If we