0
Unable to Find Methods of Java classes

/t5/coldfusion-discussions/unable-to-find-methods-of-java-classes/td-p/569850
Jun 26, 2006
Jun 26, 2006
Copy link to clipboard
Copied
I am using my own Java objects in ColdFusion. Whenever, I try
to make an instance of my class, it gives me an error:
"Unable to find a constructor for class dssLogin that accepts parameters of type ( java.lang.String, java.lang.String ) ". Similar for any methods of this class.
I am compiling it using version 1.4 which is compatible to ColdFusion. I am using the following code in my class:
import java.sql.*;
class dssLogin
{
String username;
String password;
boolean status;
int site;
int patientCount;
String [] patientList;
String query;
int currentPatient;
dssLogin(String uname, String pword)
{
username = uname;
password = pword;
status = false;
site = -1;
patientCount = 0;
currentPatient = 0;
query = "select * from admin where username = '" + username + "' and password = '" + password + "'";
}
void verify()
{
}
}
I am using the following code in coldfusion
<cfset dssLog = createObject( "java", "dssLogin" ) >
<cfset user = #Form.username# >
<cfset pword = #Form.password# >
<cfset obj1 = dssLog.init(user, pword)>
<cfset obj2 = dssLog.verify()>
"Unable to find a constructor for class dssLogin that accepts parameters of type ( java.lang.String, java.lang.String ) ". Similar for any methods of this class.
I am compiling it using version 1.4 which is compatible to ColdFusion. I am using the following code in my class:
import java.sql.*;
class dssLogin
{
String username;
String password;
boolean status;
int site;
int patientCount;
String [] patientList;
String query;
int currentPatient;
dssLogin(String uname, String pword)
{
username = uname;
password = pword;
status = false;
site = -1;
patientCount = 0;
currentPatient = 0;
query = "select * from admin where username = '" + username + "' and password = '" + password + "'";
}
void verify()
{
}
}
I am using the following code in coldfusion
<cfset dssLog = createObject( "java", "dssLogin" ) >
<cfset user = #Form.username# >
<cfset pword = #Form.password# >
<cfset obj1 = dssLog.init(user, pword)>
<cfset obj2 = dssLog.verify()>
TOPICS
Getting started
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/coldfusion-discussions/unable-to-find-methods-of-java-classes/m-p/569851#M52413
Jun 27, 2006
Jun 27, 2006
Copy link to clipboard
Copied
Coldfusion should not do that. I've just compiled your Java
code and instantiated
dssLogin("un","pw") outside Coldfusion. No problems. It's
one for the Coldfusion team to have a look at.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/unable-to-find-methods-of-java-classes/m-p/569852#M52414
Jun 27, 2006
Jun 27, 2006
Copy link to clipboard
Copied
Do you need to use JavaCast on those string args prior to
passing them to
the java method?
"Farrukh Mohisn" <webforumsuser@macromedia.com> wrote in message
news:e7pmq7$i35$1@forums.macromedia.com...
>I am using my own Java objects in ColdFusion. Whenever, I try to make an
> instance of my class, it gives me an error:
> "Unable to find a constructor for class dssLogin that accepts parameters
> of
> type ( java.lang.String, java.lang.String ) ". Similar for any methods of
> this
> class.
>
> I am compiling it using version 1.4 which is compatible to ColdFusion. I
> am
> using the following code in my class:
> import java.sql.*;
>
> class dssLogin
> {
> String username;
> String password;
> boolean status;
> int site;
> int patientCount;
> String [] patientList;
> String query;
> int currentPatient;
>
> dssLogin(String uname, String pword)
> {
> username = uname;
> password = pword;
> status = false;
> site = -1;
> patientCount = 0;
> currentPatient = 0;
> query = "select * from admin where username = '" + username + "' and
> password = '" + password + "'";
> }
>
> void verify()
> {
>
> }
> }
>
> I am using the following code in coldfusion
> <cfset dssLog = createObject( "java", "dssLogin" ) >
> <cfset user = #Form.username# >
> <cfset pword = #Form.password# >
> <cfset obj1 = dssLog.init(user, pword)>
> <cfset obj2 = dssLog.verify()>
>
the java method?
"Farrukh Mohisn" <webforumsuser@macromedia.com> wrote in message
news:e7pmq7$i35$1@forums.macromedia.com...
>I am using my own Java objects in ColdFusion. Whenever, I try to make an
> instance of my class, it gives me an error:
> "Unable to find a constructor for class dssLogin that accepts parameters
> of
> type ( java.lang.String, java.lang.String ) ". Similar for any methods of
> this
> class.
>
> I am compiling it using version 1.4 which is compatible to ColdFusion. I
> am
> using the following code in my class:
> import java.sql.*;
>
> class dssLogin
> {
> String username;
> String password;
> boolean status;
> int site;
> int patientCount;
> String [] patientList;
> String query;
> int currentPatient;
>
> dssLogin(String uname, String pword)
> {
> username = uname;
> password = pword;
> status = false;
> site = -1;
> patientCount = 0;
> currentPatient = 0;
> query = "select * from admin where username = '" + username + "' and
> password = '" + password + "'";
> }
>
> void verify()
> {
>
> }
> }
>
> I am using the following code in coldfusion
> <cfset dssLog = createObject( "java", "dssLogin" ) >
> <cfset user = #Form.username# >
> <cfset pword = #Form.password# >
> <cfset obj1 = dssLog.init(user, pword)>
> <cfset obj2 = dssLog.verify()>
>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Guest
AUTHOR
/t5/coldfusion-discussions/unable-to-find-methods-of-java-classes/m-p/569853#M52415
Jun 27, 2006
Jun 27, 2006
Copy link to clipboard
Copied
I have resolved the issue. Thanks to
Jemski for giving me the hint.
However, this problem should not occur as I don't have any overloaded functions / Constructor. So, I modified the code in my Cold Fusion file as follow.
<cfset dssLog = createObject( "java", "dssLogin" ) >
<cfset user = #Form.username# >
<cfset pword = #Form.password# >
<cfset myuser = JavaCast("String", user)>
<cfset mypword = JavaCast("String", pword)>
<cfset obj2 = dssLog.verify(myuser, mypword)>
However, this problem should not occur as I don't have any overloaded functions / Constructor. So, I modified the code in my Cold Fusion file as follow.
<cfset dssLog = createObject( "java", "dssLogin" ) >
<cfset user = #Form.username# >
<cfset pword = #Form.password# >
<cfset myuser = JavaCast("String", user)>
<cfset mypword = JavaCast("String", pword)>
<cfset obj2 = dssLog.verify(myuser, mypword)>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/unable-to-find-methods-of-java-classes/m-p/569854#M52416
Jun 27, 2006
Jun 27, 2006
Copy link to clipboard
Copied
>>Thanks to
Jemski for giving me the hint.
no probs - I have seen this issue before.
"Farrukh Mohisn" <webforumsuser@macromedia.com> wrote in message
news:e7r51s$c7m$1@forums.macromedia.com...
>I have resolved the issue. Thanks to Jemski for giving me the hint.
> However, this problem should not occur as I don't have any overloaded
> functions / Constructor. So, I modified the code in my Cold Fusion file as
> follow.
>
> <cfset dssLog = createObject( "java", "dssLogin" ) >
> <cfset user = #Form.username# >
> <cfset pword = #Form.password# >
> <cfset myuser = JavaCast("String", user)>
> <cfset mypword = JavaCast("String", pword)>
> <cfset obj2 = dssLog.verify(myuser, mypword)>
>
no probs - I have seen this issue before.
"Farrukh Mohisn" <webforumsuser@macromedia.com> wrote in message
news:e7r51s$c7m$1@forums.macromedia.com...
>I have resolved the issue. Thanks to Jemski for giving me the hint.
> However, this problem should not occur as I don't have any overloaded
> functions / Constructor. So, I modified the code in my Cold Fusion file as
> follow.
>
> <cfset dssLog = createObject( "java", "dssLogin" ) >
> <cfset user = #Form.username# >
> <cfset pword = #Form.password# >
> <cfset myuser = JavaCast("String", user)>
> <cfset mypword = JavaCast("String", pword)>
> <cfset obj2 = dssLog.verify(myuser, mypword)>
>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/coldfusion-discussions/unable-to-find-methods-of-java-classes/m-p/569855#M52417
Jun 27, 2006
Jun 27, 2006
Copy link to clipboard
Copied
Erratum:
<cfset obj2 = dssLog.verify(myuser, mypword)>
You, of course, mean <cfset obj2 = dssLog.init(myuser, mypword)>
You, of course, mean <cfset obj2 = dssLog.init(myuser, mypword)>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/coldfusion-discussions/unable-to-find-methods-of-java-classes/m-p/569856#M52418
Jun 27, 2006
Jun 27, 2006
Copy link to clipboard
Copied
Javacast notwithstanding, it still looks fishy to me. I
believe the Coldfusion team has to do something about it.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Guest
AUTHOR
/t5/coldfusion-discussions/unable-to-find-methods-of-java-classes/m-p/569857#M52419
Jun 27, 2006
Jun 27, 2006
Copy link to clipboard
Copied
I am still having problem with my class methods. For the same
class, sometimes after compiling the code it executes fine, but on
other times after little or no modification, the same function
doesn't work. Even some functions work fine, but other do not for
the same compilation. The error is as follow:
"The selected method "methodname" Not Found". Either there are no methods with the specified method name and argument types, or the method getStatus is overloaded with arguments types that ColdFusion can't decipher reliably. If this is a Java object and you verified that the method exists, you may need to use the javacast function to reduce ambiguity.
I don't have any overloaded functions.
"The selected method "methodname" Not Found". Either there are no methods with the specified method name and argument types, or the method getStatus is overloaded with arguments types that ColdFusion can't decipher reliably. If this is a Java object and you verified that the method exists, you may need to use the javacast function to reduce ambiguity.
I don't have any overloaded functions.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

