sanyam Goel

Greenhorn
+ Follow
since Jan 30, 2012
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
6
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by sanyam Goel


Can anybody put lime light on what possible problems might emerge if an application created instruments class files before loading them using custom loader. I have created a java application that does the same thing.

I read class files in the form of byte arrays Then I instrument using asm library and then Load them through custom class loader.

Is this procedure prone to failure if yes why??
5 years ago

Junilu Lacar wrote:I'm pretty sure there are a lot tools already out there that can do that. Are you working on Yet Another Java Decompiler then?



I am doing my thesis on this topic and it is not a decompiler it is a sequence diagram generation tool and there are tools for it too. However I do not have a novel / idea or project to work on... Can you suggest any better project in reverse engineering??

Thanks in advance

5 years ago

Junilu Lacar wrote:

sanyam Goel wrote:
I have a question regarding java class loading. Can any one kindly suggest me a solution in case I want to load a java application through a custom class loader should i use a single loader or multiple loaders and why?? . Another question is in case I have non class files in my java application and I would like to load them how should I attempt this??



Using class loaders is a fairly advanced topic and not many people have to mess with that sort of thing. I have been developing in Java professionally for over a decade and have not once had the need to mess with class loaders, much less custom class loaders. What exactly are you trying to do that you need to mess with class loaders?

Regarding loading of non-class files, it depends on the kind of files you are talking about but they definitely can't be "loaded" using a class loader.




I am working on reverse engineering of java bytecodes, My work starts with a custom loader using which I load all the contents of a jar into the memory before doing bytecode manipulation and that is why I need a class loader.

thanks and regards

please help as loading process is working fine for few jars for few it shows error
5 years ago

Hello everyone,
I have a question regarding java class loading. Can any one kindly suggest me a solution in case I want to load a java application through a custom class loader should i use a single loader or multiple loaders and why?? . Another question is in case I have non class files in my java application and I would like to load them how should I attempt this??

Thanks in advance

Sanyam
5 years ago

Jesper de Jong wrote:It's not possible to find out what method started a thread by looking at the stack trace from within the thread.

Each thread has its own stack, and starts with an empty stack. The run() method is one of the first things on the stack.

Suppose that thread A creates and starts a thread B. Both threads will have their own, independent stacks. On the stack of thread B you will not find the method of thread A that started thread B.




Dear Jasper,
Is there any possible way of finding that other than through the stack trace then .

please Help

Thanks in advance

Sanyam
6 years ago
Hello everyone,

Can any one help me finding the name of the caller class and method name of a thread's start method using stacktrace

For example if I create a thread in the main method of a class A then the stacktrace for the run method of the thread at index 2 gives the thread as class name and run as calling method name however I want to obtain the information class A as caller class name and main as caller method name ..


please help
thanks in advance
6 years ago

Hello Everyone,

I am trying to execute a program using my own customized loader and with the help of reflection. Few programs are working fine however with few I get this error..

Exception in thread "AWT-EventQueue-0" java.lang.VerifyError: (class: employeeTestTemp/CommissionedEmployee, method: setCommissionRate signature: (D)V) Register pair 1/2 contains wrong type
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)...

although the same program works perfectly fine when executed with default java loader.
Please Help...
Thanks in advance..
6 years ago
Hello friends,

I have made a customized class loader. Now I have few questions , if anybody can kindly help me out.

How can I use this class loader to execute a java program like done by default loader. Further I need to capture the outputs (stack traces of the running program) . Can you please suggest me some good resources / guide me in tackling these problems??

Thanks in advance .
6 years ago

Darryl Burke wrote:You're using a String as an intermediary for binary data. That's just plain wrong. And in any case, the tostring() method of FileInputStream is inherited from Object -- what made you think that would return the content of the File?

You need to read the FIle into a byte array and use that to define the class. Also, is the 'classFilename' going to be the same as he expected binary name of the class? Think about it.




Thank you so much Darryl !! Yes you were right now it is working perfectly fine

6 years ago

Maneesh Godbole wrote:Welcome to the Ranch.

This message usually indicates that you used a higher java version to compile the code, than the java version you are using to run it.





Yes Maneesh I found this on Internet and I recompiled my classes to be loaded and and again re-ran the program.. but still I encountered the same problem

Here is the complete error I am getting again and again..

Exception in thread "AWT-EventQueue-0" java.lang.ClassFormatError: Incompatible magic value 1784772193 in class file DeckOfCards/class
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at classLoader.ClassLoaderOfExtClass.loadClassCustom(ClassLoaderOfExtClass.java:161)
at guiTool.SeQuenceDiagramGeneration.jMenuItem1ActionPerformed(SeQuenceDiagramGeneration.java:136)
at guiTool.SeQuenceDiagramGeneration.access$0(SeQuenceDiagramGeneration.java:100)
at guiTool.SeQuenceDiagramGeneration$1.actionPerformed(SeQuenceDiagramGeneration.java:70)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Please Help!!
6 years ago

Rob Spoor wrote:I don't think so. The error message for that is different: "unsupported class version". This one does mean that there's something wrong with the class files. Can you show us how you create a byte[] from the class file?




This is the method I have created to convert a file to a byte array



Please Help!!
6 years ago
Hello everyone,


I have created a custom loader. while reading class files form disk compiler throws an error "Exception in thread "AWT-EventQueue-0" java.lang.ClassFormatError: Incompatible magic value 1784772193 in class file.....

at java.lang.ClassLoader.defineClass1(Native Method)" It also includes the line of code containing the statement "classTemp= defineClass( classFilename, raw, 0, raw.length);" please suggest some solution

Thanks in advance


6 years ago