Reputation: 111
I am trying to compile serviceBean.java file which imports one of my package, ledgement.java
In the serviceBean.java I added the below one line and it is not compiled it throws Cannot Find Symbol
ledgement ack = new ledgement(false,
e);
Here is the folder structure:
C:\working\src\java\com\test\tools\abc\mgmt\facade\service
com/test/tools/abc/mgmt/facade/service/serviceBean.java
com/test/tools/abc/mgmt/util/ledgement.java
My ledgement class contains
public class ledgement<T> extends Test {
public enum EntityType implements Serializable {
ART(1), ART1(2), RDER(3), LNE(4),
COUNT(5);
private int typeId;
EntityType(int id) {
this.typeId = id;
}
/**
* @return the entityClass
*/
public int getTypeId() {
return typeId;
}
/**
* @param entityClass
* the entityClass to set
*/
public void setTypeId(int id) {
this.typeId = id;
}
} // Enum EntityType.
public ledgement(boolean successFg) {
this(successFg , null, null, null, null);
}
public ledgement(boolean sucessFg, Exception exp) {
this(sucessFg, exp, null);
}
it throws cannot find symbol [javac] symbol : constructor ledgement(boolean,java.lang.Exception )
Not sure what is the issue by invoke the ledgment java class.
Please help.Thanks in Advance
Upvotes: 0
Views: 63
Reputation: 5754
The "ledgement" class itself – without the nested enum – looks like this:
public class ledgement<T> extends Test {
public ledgement(boolean successFg) {
this(successFg, null, null, null, null);
}
public ledgement(boolean sucessFg, Exception exp) {
this(sucessFg, exp, null);
}
}
and here's an empty "Test" class so that things will compile:
class Test {
}
You stated that by doing something like below:
new ledgement(false, e);
you see an error like this:
[javac] symbol : constructor ledgement(boolean,java.lang.Exception)
This error is not reproducible. Below is a slight edit to your code, newing an exception (instead of using "e" which wasn't defined in your posted code). This line compiles fine:
new ledgement(false, new Exception());
Both of the constructors in turn refer to another constructor which does not exist. This line:
this(successFg, null, null, null, null);
results in this compiler error:
no suitable constructor found for ledgement(boolean,<nulltype>,<nulltype>,<nulltype>,<nulltype>)
constructor ledgement(boolean) is not applicable
(actual and formal argument lists differ in length)
constructor ledgement(boolean,java.lang.Exception) is not applicable
(actual and formal argument lists differ in length)
And this line:
this(sucessFg, exp, null);
results in this compiler error:
no suitable constructor found for ledgement(boolean,java.lang.Exception,<nulltype>)
constructor ledgement(boolean) is not applicable
(actual and formal argument lists differ in length)
constructor ledgement(boolean,java.lang.Exception) is not applicable
(actual and formal argument lists differ in length)
Various things would probably help:
Upvotes: 0
Reputation: 11
you have an extra bracket in this line of code: this(successFg) , null, null, null, null);
Upvotes: 1