Tacobell777
asked on
cannot resolve symbol
I can't figure out what is causing this?
C:\Temp>javac SSLTransportLayer.java
SSLTransportLayer.java:62: cannot resolve symbol
symbol : method getEnabledProtocols ()
location: class javax.net.ssl.SSLSocket
String[] protocolArray = socket.getEnabledProtocols ();
^
Code:
import javax.net.ssl.*;
import java.io.*;
public class SSLTransportLayer {
public static void main(String[] args) {
String host = "edge.asic.gov.au";
int port = 5608;
SSLSocketFactory factory;
SSLSocket socket;
String hostOutput;
BufferedReader br;
String[] cipherSuite = { "SSL_RSA_WITH_RC4_128_MD5"
,"SSL_RSA_WITH_RC4_128_SHA "
,"TLS_RSA_WITH_AES_128_CBC _SHA"
,"TLS_DHE_RSA_WITH_AES_128 _CBC_SHA"
,"TLS_DHE_DSS_WITH_AES_128 _CBC_SHA"
,"SSL_RSA_WITH_3DES_EDE_CB C_SHA"
,"SSL_DHE_RSA_WITH_3DES_ED E_CBC_SHA"
,"SSL_DHE_DSS_WITH_3DES_ED E_CBC_SHA"
,"SSL_RSA_WITH_DES_CBC_SHA "
,"SSL_DHE_RSA_WITH_DES_CBC _SHA"
,"SSL_DHE_DSS_WITH_DES_CBC _SHA"
,"SSL_RSA_EXPORT_WITH_RC4_ 40_MD5"
,"SSL_RSA_EXPORT_WITH_DES4 0_CBC_SHA"
,"SSL_DHE_RSA_EXPORT_WITH_ DES40_CBC_ SHA"
,"SSL_DHE_DSS_EXPORT_WITH_ DES40_CBC_ SHA"
,"SSL_RSA_WITH_NULL_MD5"
,"SSL_RSA_WITH_NULL_SHA"
,"SSL_DH_anon_WITH_RC4_128 _MD5"
,"TLS_DH_anon_WITH_AES_128 _CBC_SHA"
,"SSL_DH_anon_WITH_3DES_ED E_CBC_SHA"
,"SSL_DH_anon_WITH_DES_CBC _SHA"
,"SSL_DH_anon_EXPORT_WITH_ RC4_40_MD5 "
,"SSL_DH_anon_EXPORT_WITH_ DES40_CBC_ SHA" };
/*{ "SSL_DH_anon_WITH_RC4_128_ MD5"
, "SSL_DH_anon_WITH_RC4_128_ MD5"
, "SSL_DH_anon_WITH_3DES_EDE _CBC_SHA"
, "SSL_DH_anon_WITH_DES_CBC_ SHA"
, "SSL_DH_anon_EXPORT_WITH_R C4_40_MD5"
, "SSL_DH_anon_EXPORT_WITH_D ES40_CBC_S HA" };*/
try {
factory = ( SSLSocketFactory ) SSLSocketFactory.getDefaul t();
socket = ( SSLSocket ) factory.createSocket( host, port );
// Lets see whats supported
String[] suiteArray = socket.getSupportedCipherS uites();
for ( int i = 0; i < suiteArray.length; i++ )
{
System.out.println( "Supported cipher suites " + suiteArray[ i ] );
}
System.out.println( "Enabled session creation " + socket.getEnableSessionCre ation() );
System.out.println( "Use client mode " + socket.getUseClientMode() );
// System.out.println( "Want client mode " + socket.getWantClientAuth() );
System.out.println( "Needs client authentication " + socket.getNeedClientAuth() );
String[] protocolArray = socket.getEnabledProtocols ();
for ( int i = 0; i < protocolArray.length; i++ )
{
System.out.println( "Enabled protocols " + protocolArray[ i ] );
}
socket.setEnabledCipherSui tes(cipher Suite);
System.out.println("Secure socket made");
br = new BufferedReader(new InputStreamReader(socket.g etInputStr eam()));
hostOutput = br.readLine();
System.out.println(host + " responds with: " + hostOutput);
} catch (Exception e) {
System.out.println("Error " + e.getMessage());
};
}
}
C:\Temp>javac SSLTransportLayer.java
SSLTransportLayer.java:62:
symbol : method getEnabledProtocols ()
location: class javax.net.ssl.SSLSocket
String[] protocolArray = socket.getEnabledProtocols
^
Code:
import javax.net.ssl.*;
import java.io.*;
public class SSLTransportLayer {
public static void main(String[] args) {
String host = "edge.asic.gov.au";
int port = 5608;
SSLSocketFactory factory;
SSLSocket socket;
String hostOutput;
BufferedReader br;
String[] cipherSuite = { "SSL_RSA_WITH_RC4_128_MD5"
,"SSL_RSA_WITH_RC4_128_SHA
,"TLS_RSA_WITH_AES_128_CBC
,"TLS_DHE_RSA_WITH_AES_128
,"TLS_DHE_DSS_WITH_AES_128
,"SSL_RSA_WITH_3DES_EDE_CB
,"SSL_DHE_RSA_WITH_3DES_ED
,"SSL_DHE_DSS_WITH_3DES_ED
,"SSL_RSA_WITH_DES_CBC_SHA
,"SSL_DHE_RSA_WITH_DES_CBC
,"SSL_DHE_DSS_WITH_DES_CBC
,"SSL_RSA_EXPORT_WITH_RC4_
,"SSL_RSA_EXPORT_WITH_DES4
,"SSL_DHE_RSA_EXPORT_WITH_
,"SSL_DHE_DSS_EXPORT_WITH_
,"SSL_RSA_WITH_NULL_MD5"
,"SSL_RSA_WITH_NULL_SHA"
,"SSL_DH_anon_WITH_RC4_128
,"TLS_DH_anon_WITH_AES_128
,"SSL_DH_anon_WITH_3DES_ED
,"SSL_DH_anon_WITH_DES_CBC
,"SSL_DH_anon_EXPORT_WITH_
,"SSL_DH_anon_EXPORT_WITH_
/*{ "SSL_DH_anon_WITH_RC4_128_
, "SSL_DH_anon_WITH_RC4_128_
, "SSL_DH_anon_WITH_3DES_EDE
, "SSL_DH_anon_WITH_DES_CBC_
, "SSL_DH_anon_EXPORT_WITH_R
, "SSL_DH_anon_EXPORT_WITH_D
try {
factory = ( SSLSocketFactory ) SSLSocketFactory.getDefaul
socket = ( SSLSocket ) factory.createSocket( host, port );
// Lets see whats supported
String[] suiteArray = socket.getSupportedCipherS
for ( int i = 0; i < suiteArray.length; i++ )
{
System.out.println( "Supported cipher suites " + suiteArray[ i ] );
}
System.out.println( "Enabled session creation " + socket.getEnableSessionCre
System.out.println( "Use client mode " + socket.getUseClientMode() );
// System.out.println( "Want client mode " + socket.getWantClientAuth()
System.out.println( "Needs client authentication " + socket.getNeedClientAuth()
String[] protocolArray = socket.getEnabledProtocols
for ( int i = 0; i < protocolArray.length; i++ )
{
System.out.println( "Enabled protocols " + protocolArray[ i ] );
}
socket.setEnabledCipherSui
System.out.println("Secure
br = new BufferedReader(new InputStreamReader(socket.g
hostOutput = br.readLine();
System.out.println(host + " responds with: " + hostOutput);
} catch (Exception e) {
System.out.println("Error " + e.getMessage());
};
}
}
Sorry, this:
"SSLSocket#getSupportedPro tocols() does not exist"
should be:
"SSLSocket#getEnabledProto cols() does not exist"
"SSLSocket#getSupportedPro
should be:
"SSLSocket#getEnabledProto
Make sure you haven't got your own home-brewed SSLSocket in the classpath (as opposed to javax.net.ssl.SSLSocket, which is what you intend)
ASKER
InteractiveMind ??? Isn't that what I have got?
CEHJ I'm pretty sure no one replaced it as I installed it a couple of weeks ago.
CEHJ I'm pretty sure no one replaced it as I installed it a couple of weeks ago.
Try compiling thus and see if it makes any difference:
javac -classpath . SSLTransportLayer.java
javac -classpath . SSLTransportLayer.java
ASKER
C:\Temp>javac -classpath C:\j2sdk1.4.2_05\bin SSLTransportLayer.java
SSLTransportLayer.java:1: package javax.net.ssl does not exist
import javax.net.ssl.*;
^
SSLTransportLayer.java:10: cannot resolve symbol
symbol : class SSLSocketFactory
location: class SSLTransportLayer
SSLSocketFactory factory;
^
SSLTransportLayer.java:1: package javax.net.ssl does not exist
import javax.net.ssl.*;
^
SSLTransportLayer.java:10:
symbol : class SSLSocketFactory
location: class SSLTransportLayer
SSLSocketFactory factory;
^
>>package javax.net.ssl does not exist
What JDK version are you using?
What JDK version are you using?
ASKER
j2sdk1.4.2_05
There's something wrong. javax.net.ssl *does* exist in 1.4. What do you get from
java -version
?
java -version
?
Sorry that should have been
javac -version
javac -version
ASKER
java version "1.4.2_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04)
Java HotSpot(TM) Client VM (build 1.4.2_05-b04, mixed mode)
javac -version is not a valid command line..
I now get the same error with other classes as well, but they compile well on
java version "1.4.2_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_07-b05)
Java HotSpot(TM) Client VM (build 1.4.2_07-b05, mixed mode)
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04)
Java HotSpot(TM) Client VM (build 1.4.2_05-b04, mixed mode)
javac -version is not a valid command line..
I now get the same error with other classes as well, but they compile well on
java version "1.4.2_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_07-b05)
Java HotSpot(TM) Client VM (build 1.4.2_07-b05, mixed mode)
>>javac -version is not a valid command line..
No - it isn't on some versions. Javac will run against the first javac.exe in %PATH%. What would that be?
echo %PATH%
No - it isn't on some versions. Javac will run against the first javac.exe in %PATH%. What would that be?
echo %PATH%
ASKER
do you still need that version, does the verion number I gave above not give you enough info?
>>does the verion number I gave above not give you enough info?
It gives me the version of java, not javac, and the latter is needed here (they can be different)
It gives me the version of java, not javac, and the latter is needed here (they can be different)
ASKER
Here is the output, sorry it took so long.
C:\CFusionMX7\verity\k2\_n ti40\bin;C :\WINDOWS\ system32;C :\WINDOWS; C:\WINDOWS \Sys
tem32\Wbem;C:\Program Files\Common Files\Adaptec Shared\System;C:\Program Files\
Microsoft SQL Server\80\Tools\BINN;C:\Su n\AppServe r\jdk\bin; c:\Program Files\Mic
rosoft SQL Server\90\Tools\binn\;C:\P ROGRA~1\AM PC\bin;C:\ PROGRA~1\A MPC\cygwin \bi
n;C:\Sun\AppServer\bin
C:\CFusionMX7\verity\k2\_n
tem32\Wbem;C:\Program Files\Common Files\Adaptec Shared\System;C:\Program Files\
Microsoft SQL Server\80\Tools\BINN;C:\Su
rosoft SQL Server\90\Tools\binn\;C:\P
n;C:\Sun\AppServer\bin
This is almost certainly the version of javac you're compiling with
C:\Sun\AppServer\jdk\bin\j avac.exe
and i would not be suprised if it is < 1.4. Failure to compile the following will prove that it is:
class LessThanFour {
void acidTest() {
"x".replaceAll("", "");
}
}
C:\Sun\AppServer\jdk\bin\j
and i would not be suprised if it is < 1.4. Failure to compile the following will prove that it is:
class LessThanFour {
void acidTest() {
"x".replaceAll("", "");
}
}
ASKER
this is what I get
C:\Temp>javac LessThanFour.java
LessThanFour.java:3: cannot resolve symbol
symbol : method replaceAll (java.lang.String,java.lan g.String)
location: class java.lang.String
"x".replaceAll("", "");
^
1 error
So can you tell me what you think is wrong and how to fix it?
C:\Temp>javac LessThanFour.java
LessThanFour.java:3: cannot resolve symbol
symbol : method replaceAll (java.lang.String,java.lan
location: class java.lang.String
"x".replaceAll("", "");
^
1 error
So can you tell me what you think is wrong and how to fix it?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I must be confused I thought I did that, isn't the JDK included in Java(TM) 2 Runtime Environment
Or the two different if so can you give me a little run down?
I'm still a newbie to this all.
Or the two different if so can you give me a little run down?
I'm still a newbie to this all.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Please *do* give IM some points for that info ;-)
ASKER
thanks guys
:-)
hehe - thank you both ;)
String[] protocolArray = socket.getSupportedProtoco