Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Method setKeepAlive(boolean) not found

Status
Not open for further replies.

Signit

MIS
Oct 17, 2003
114
US
I am receiving the following error when I try and compile a class I am working on.

Code:
$ javac -classpath /usr/local/coldfusionmx/bea/user_projects/srn/applications/cfusion/WEB-INF/lib/cfx.jar CFX_JSocket.java
CFX_JSocket.java:59: Method setKeepAlive(boolean) not found in class java.net.Socket.
            socket.setKeepAlive(toBoolean(request.getAttribute("KEEPALIVE")));
                              ^
1 error

My socket is being initialized this way:
Code:
Socket socket = new Socket(request.getAttribute("HOST"), Integer.parseInt(
            request.getAttribute("PORT")));

The offending line is:
Code:
        if (request.attributeExists("KEEPALIVE"))
        {
            socket.setKeepAlive(toBoolean(request.getAttribute("KEEPALIVE")));
        }

Any help would be greatly appreciated.
 
Which SDK version are you using ?

BTW, in the future, please use forum269 for non-J2EE questions.

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
The setKeepAlive method was introduced in JDK1.3

Type java -version at the command line to see what version you have. (If you don't have the java utility pathed, then make sure you're in the bin folder of your java installation when you do this).

Tim
---------------------------
"Your morbid fear of losing,
destroys the lives you're using." - Ozzy
 
BTW, in the future, please use forum269 for non-J2EE questions.
Sorry about that, I wasn't sure which to choose and chose this one.

And am using notepad to put this together compiling at the command line.

I am using JVM 1.08.
 
Whoops, realize I didn't put my JDK on the above post: 1.42.04.
 
Is that the same version you see when you type
Code:
java -version

Tim
---------------------------
"Your morbid fear of losing,
destroys the lives you're using." - Ozzy
 
That's actually what my middleware group told me we were using.
 
Well, can you check using the above command please. That will confirm the version.

Tim
---------------------------
"Your morbid fear of losing,
destroys the lives you're using." - Ozzy
 
Also, try to compile this class :

Code:
import java.net.Socket;
public class TestSocket {
	public static void main(String args[]) throws Exception {
		Socket s = new Socket("localhost", 1099);
		s.setKeepAlive(true);
	}
}

If it does not compile, then you have a SDK lower than version 1.3 - which will not have the setKeepAlive() method.

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top