| Author |
method not found in imported class - JCAPS6
|
Preethi Dev
Ranch Hand
Joined: Sep 07, 2008
Posts: 265
|
|
Hi Ranchers,
currently, I am migrating projects from JCAPS5 version to JCAPS 6 version.when I compile the java code i get the validation error as all the methods residing in the imported class are not visible to the main class
I have checked for jar files which is added and imported the fully qualified class.
I have also checked in th JCaps 5 which does not throw any error. so my view falls on version compatability like features not supported.
please someone correct me if my assumption is wrong.
here is my list of errors:
• ERROR: Method getSegmentCount(java.sql.Connection, java.lang.String, java.lang.String) not found in class com.ack.mware.distribution.v2.filesplitter.InhousApiClass at line 82
• ERROR: Cannot assign **Unknown Type** to int
• ERROR: Method getContent(java.sql.Connection, java.lang.String, java.lang.String, int) not found in class com.ack.mware.distribution.v2.filesplitter.InhousApiClass at line 85
• ERROR: Constructor new String( InhousApiClass.getContent( con, runId, interfaceName, segIdx ) ) not found in class java.lang.String at line 85
• ERROR: Method cleanUp(java.sql.Connection, java.lang.String, java.lang.String) not found in class class com.ack.mware.distribution.v2.filesplitter.InhousApiClass at line 193
• ERROR: Method cleanUp(java.sql.Connection, java.lang.String, java.lang.String) not found in class class com.ack.mware.distribution.v2.filesplitter.InhousApiClass at line 314
• ERROR: Cannot assign **Unknown Type** to int
• ERROR: Cannot assign **Unknown Type** to int
Due to confidentiality,I can not post the code here.
all these methods are static which is defined in a public abstract class InhousApiClass{}
Main class:
I have been working around this for a whole day and i didnt get any clue. Please help me out.
Regards
Preethi
|
 |
Swastik Dey
Ranch Hand
Joined: Jan 08, 2009
Posts: 1196
|
|
Does the InhousApiClass class compile?
As per the above mentioned method in your code, you have given the data types in the method parameters, but what about the variable names?
|
Swastik
|
 |
Preethi Dev
Ranch Hand
Joined: Sep 07, 2008
Posts: 265
|
|
yes InhousApiClass class compiles.
Here is the method with its parameters and the values will be passed from the main class JCD_mainhouse
public static int getSegmentCount(Connection conn, String interfaceName, String runId)
All my question is how this works in JCAPS5 but not in JCAPS 6.
|
 |
Preethi Dev
Ranch Hand
Joined: Sep 07, 2008
Posts: 265
|
|
could anyone please help me to solve this?
|
 |
Preethi Dev
Ranch Hand
Joined: Sep 07, 2008
Posts: 265
|
|
Hi Ranchers!
I am really surprised by not getting any reply in java ranch the one I admired a lot when I did my SCJP.
Could anyone please throw their suggestions on my topic?
I seemed to be helpless here.
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
Perhaps nobody knows the answer?
Have you checked the documentation to see if (and if so, how) the API has changed drastically? Maybe these methods have been moved to some other class.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Preethi Dev
Ranch Hand
Joined: Sep 07, 2008
Posts: 265
|
|
Hi Rob,
These methods are our inhouse API's and it's already in use by the JCAPS5 version. this is a migration work to JCAPS 6 I am stuck at this error since this is working without any error in JCAPS 5.
I confirm that the inhouse jar is added to the main class "JCD_mainhouse ". but the other Inhouse stuffs are working correctly in JCAPS 6.
It would be highly appreciable if someone help me to solve this.
Regards
Preethi
|
 |
Ralph Cook
Ranch Hand
Joined: May 29, 2005
Posts: 479
|
|
I think one problem may be that those of us that help like to know what we're talking about before answering, and you have given us incomplete information. You've given us reasons for that as well, so you aren't getting criticism. But if we can't try out what we're proposing, and we don't know your system, and if some of us don't know JCAPS (like me) then we're really shooting in the dark.
The only thing that looks like a clue is what you said about them all being static methods. Is that true? Is it just static methods, no instance methods, that are not found? Are there any static methods that are compiling all right?
If it's just static methods, is it possible that you are invoking them on an instance variable, and some compiler/precompiler/something is not finding them because it's looking for an instance method?
You seem to be anxious for some kind of answer; maybe this will at least point us in some kind of direction...
rc
|
 |
Preethi Dev
Ranch Hand
Joined: Sep 07, 2008
Posts: 265
|
|
Hi Rc,
Thanks for the reply,
FYI,the inhouse class(imported) is an abstract class consists of four static methods with its implementations.There are no abstract methods as well as instance methods.
The main class "JCD_mainhouse" invoke the inhouse class "InhousApiClass" static methods on its class name as usual and finally gives compilation error as I have shown earlier.
I find those Inhouse api's are recognizable in JCAPS 5 and compiles without error but not in JCAPS 6.
Regards
Preethi
|
 |
Ralph Cook
Ranch Hand
Joined: May 29, 2005
Posts: 479
|
|
I'm going to try once more.
do you get a compiler error every time these static methods in InhousApiClass is invoked, or only on some invocations?
are there any static methods in that class that are invoked but do not cause the error?
are there any methods that get the error that are not static?
are there static methods elsewhere in your code that do not have the error?
If you write another static method in that class and invoke it from your main, does your new static method get the error?
When the methods are invoked, does the code dereference the class name, or a variable name?
Assuming you are using a classname: are you dereferencing the abstract classname, or a subclass name?
|
 |
Preethi Dev
Ranch Hand
Joined: Sep 07, 2008
Posts: 265
|
|
Today 11:30:30 AM Subject: method not found in imported class - JCAPS6
--------------------------------------------------------------------------------
do you get a compiler error every time these static methods in InhousApiClass is invoked, or only on some invocations?
yes, each time when i comile the main class I am getting the compilation error on those inhouse static methods
are there any static methods in that class that are invoked but do not cause the error?
all the static methods in the InhousApiClass gives the error. there is no static methods in JCD_mainhouse.
are there any methods that get the error that are not static?
no, errors are only related to the static methods in the InhouseApiClass
are there static methods elsewhere in your code that do not have the error?
there are no static methods in the main class.
If you write another static method in that class and invoke it from your main, does your new static method get the error?
I dont have the acces to change the inhouse code.
When the methods are invoked, does the code dereference the class name, or a variable name?
It references the class name.
Assuming you are using a classname: are you dereferencing the abstract classname, or a subclass name?
abstract classname. There is no subclass for that InhouseApiClass.
Only the four static methods in the IhouseApiClass gives the compilation error when invoked in main class.
FYI, this a repository project, all the codings are in repository which is hosted on server not in local machine.
|
 |
Ralph Cook
Ranch Hand
Joined: May 29, 2005
Posts: 479
|
|
Please be aware it is difficult to answer things in this environment, even without the language barrier (you speak English much better than I speak anything else, but it is clear some of my questions have been misunderstood).
I have a few things to suggest trying:
create a class that extends this abstract class. Put your own static method in it, then code a call to that method from the class that is making the calls that show errors.
If you cannot extend the abstract class, then there is a problem with the compiler attempting to locate it.
If you can extend it, and can call your method but not theirs, then it has something to do with those methods being in that abstract class instead of in your class.
Try invoking the methods using the subclass name, instead of the original class name.
Other than that, I'm afraid I cannot help. There just isn't enough information. The code you've posted won't compile, you can't tell us more about the code you have, etc.
It does seem odd that the error messages (assuming those are what you actually got) point to the called class, not the calling class.
rc
|
 |
Preethi Dev
Ranch Hand
Joined: Sep 07, 2008
Posts: 265
|
|
Hi RC,
my comments are in blue.
create a class that extends this abstract class. Put your own static method in it, then code a call to that method from the class that is making the calls that show errors.
I tired the way you have shown above, I get the same error if I call the staic method getSegmentCount of InHouseApiClass.
ERROR: Method getSegmentCount(java.sql.Connection, java.lang.String, java.lang.String) not found in class com.ack.mware.distribution.v2.filesplitter.InhousApiClass at line 46
If you cannot extend the abstract class, then there is a problem with the compiler attempting to locate it.
I can extend the abstract but still no effect on the code, it gives the same validation error. So I think the package is visible but not the methods in it.
If you can extend it, and can call your method but not theirs, then it has something to do with those methods being in that abstract class instead of in your class.
I can call my static method but not the method "getSegmentCount" in InhouseApiClass by doing so.
Try invoking the methods using the subclass name, instead of the original class name.
I tried to invoke them by using the subclas"Mainhouse" I get the error as
ERROR: Method getSegmentCount(java.sql.Connection, java.lang.String, java.lang.String) not found in class Mainhouse at line 46
All I doubt is how come this case works perfectly in my JCAPS 5 .
All these makes me to ask the below question,
Is there a possiblity that the package is visible but not their static methods which has the public access both in methods and class?
or any compatability issues? since this works fine with the JCAPS 5.
I am really confused to come to a conclusion.
Regards
Preetha
|
 |
Ralph Cook
Ranch Hand
Joined: May 29, 2005
Posts: 479
|
|
I think you are focusing a little too much on the fact that it worked in version 5. Yes, that's very useful information, but now move on. Something changed. Something changed in the way version 6 handles this class. The answer is in that class, unless you have some reason to think that version 6 is broken.
You speak of the "package" being visible. I don't know if this is a language problem or not, but it is obvious the "package" for InHouseAPIClass is visible, otherwise the compiler would tell you it couldn't find that class.
If it were me, I would now write a program using Java reflection and have it dump out the signatures of all the methods it could find in the InHouseAPIClass class. It would also be helpful to know just what program is generating the message; is it really javac, or something else that's part of JCAPS ?
rc
|
 |
Preethi Dev
Ranch Hand
Joined: Sep 07, 2008
Posts: 265
|
|
These are the method signatures for methods in InhouseApiClass
public static int com.ack.mware.distribution.v2.filesplitter.InhousApiClass.getSegmentCount(java.sql.Connection,java.lang.String,java.lang.String) throws java.lang.Exception
protected static byte[] com.ack.mware.distribution.v2.filesplitter.InhousApiClass.readBlob(oracle.sql.BLOB) throws java.lang.Exception
public static void com.ack.mware.distribution.v2.filesplitter.InhousApiClass.cleanUp(java.sql.Connection,java.lang.String,java.lang.String) throws java.lang.Exception
public static byte[] com.ack.mware.distribution.v2.filesplitter.InhousApiClass.getContent(java.sql.Connection,java.lang.String,java.lang.String,int) throws java.lang.Exception
javac generates the message for JCAPS6.
any other information that I need to look for?
Regards
Preethi
|
 |
Preethi Dev
Ranch Hand
Joined: Sep 07, 2008
Posts: 265
|
|
herenow I got the decompiled code of InhouseApiClass which gives error on recompilation.
Here is the sample error while recompiling the code. errors are shown in comment.
but i dont know how far I can trust the decompiled code to analyse the abovesaid issues.
please help me
Thanks in advance,
Preethi
|
 |
Preethi Dev
Ranch Hand
Joined: Sep 07, 2008
Posts: 265
|
|
Hi,
finally, got the problem solved.
In Jcaps 6 version ojdbc14.jar which is used in the InhouseApiClass has to be included. but this jar file is not included in JCAPS5 version that comes with the JCAPS5 suite.
This drives me into a wrong path of analysis instead of checking the required jar files.
Thanks a lot to rc.
Regards
Preetha
|
 |
 |
|
|
subject: method not found in imported class - JCAPS6
|
|
|