1
- // Copyright (c) 2020, 2022 , Oracle and/or its affiliates.
1
+ // Copyright (c) 2020, 2023 , Oracle and/or its affiliates.
2
2
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
3
3
4
4
package oracle .weblogic .kubernetes ;
@@ -420,7 +420,10 @@ private void runExtHttpsClient(String routeHost, int httpsTunnelingPort, int ser
420
420
StringBuffer httpsUrl = new StringBuffer ("https://" );
421
421
httpsUrl .append (hostAndPort );
422
422
423
- StringBuffer javasCmd = new StringBuffer ("java -cp " );
423
+ // StringBuffer javasCmd = new StringBuffer("java -cp ");
424
+ StringBuffer javasCmd = new StringBuffer ("" );
425
+ javasCmd .append (Paths .get (RESULTS_ROOT , "/jdk/bin/java " ));
426
+ javasCmd .append ("-cp " );
424
427
javasCmd .append (Paths .get (RESULTS_ROOT , "wlthint3client.jar" ));
425
428
javasCmd .append (":" );
426
429
javasCmd .append (Paths .get (RESULTS_ROOT ));
@@ -473,17 +476,22 @@ private void runClientInsidePod(int serverCount, boolean checkConnection) {
473
476
testUntil (runJmsClient (new String (javapCmd )), logger , "Wait for t3 JMS Client to access WLS" );
474
477
}
475
478
476
- // Run the RMI client outside the K8s Cluster
477
479
private void runExtClient (int httpTunnelingPort , int serverCount , boolean checkConnection ) {
478
480
runExtClient (null , httpTunnelingPort , serverCount , checkConnection );
479
481
}
480
482
483
+ // Run the RMI client outside the K8s Cluster using the JDK binary copied
484
+ // from the Pod in the method buildClient()
481
485
private void runExtClient (String routeHost , int httpTunnelingPort , int serverCount , boolean checkConnection ) {
482
486
String hostAndPort = getHostAndPort (routeHost , httpTunnelingPort );
483
487
// Generate java command to execute client with classpath
484
488
StringBuffer httpUrl = new StringBuffer ("http://" );
485
489
httpUrl .append (hostAndPort );
486
- StringBuffer javaCmd = new StringBuffer ("java -cp " );
490
+
491
+ // StringBuffer javaCmd = new StringBuffer("java -cp ");
492
+ StringBuffer javaCmd = new StringBuffer ("" );
493
+ javaCmd .append (Paths .get (RESULTS_ROOT , "/jdk/bin/java " ));
494
+ javaCmd .append ("-cp " );
487
495
javaCmd .append (Paths .get (RESULTS_ROOT , "wlthint3client.jar" ));
488
496
javaCmd .append (":" );
489
497
javaCmd .append (Paths .get (RESULTS_ROOT ));
@@ -504,13 +512,30 @@ private void runExtClient(String routeHost, int httpTunnelingPort, int serverCou
504
512
// JMS client that sends messages to a Uniform Distributed Queue using
505
513
// load balancer http(s) url which maps to custom channel on cluster member
506
514
// server on WebLogic cluster.
515
+ // Copy the installed JDK from WebLogic server pod to local filesystem
516
+ // to build and run the JMS client outside of K8s Cluster.
507
517
private void buildClient () {
508
518
509
519
assertDoesNotThrow (() -> copyFileFromPod (domainNamespace ,
510
520
adminServerPodName , "weblogic-server" ,
511
521
"/u01/oracle/wlserver/server/lib/wlthint3client.jar" ,
512
522
Paths .get (RESULTS_ROOT , "wlthint3client.jar" )));
513
- StringBuffer javacCmd = new StringBuffer ("javac -cp " );
523
+
524
+ assertDoesNotThrow (() -> copyFileFromPod (domainNamespace ,
525
+ adminServerPodName , "weblogic-server" ,
526
+ "/u01/jdk" , Paths .get (RESULTS_ROOT , "jdk" )));
527
+ StringBuffer chmodCmd = new StringBuffer ("chmod +x " );
528
+ chmodCmd .append (Paths .get (RESULTS_ROOT , "jdk/bin/java " ));
529
+ chmodCmd .append (Paths .get (RESULTS_ROOT , "jdk/bin/javac " ));
530
+ ExecResult cresult = assertDoesNotThrow (
531
+ () -> exec (new String (chmodCmd ), true ));
532
+ logger .info ("chmod command {0}" , chmodCmd .toString ());
533
+ logger .info ("chmod command returned {0}" , cresult .toString ());
534
+
535
+ // StringBuffer javacCmd = new StringBuffer("javac -cp ");
536
+ StringBuffer javacCmd = new StringBuffer ("" );
537
+ javacCmd .append (Paths .get (RESULTS_ROOT , "/jdk/bin/javac " ));
538
+ javacCmd .append (Paths .get (" -cp " ));
514
539
javacCmd .append (Paths .get (RESULTS_ROOT , "wlthint3client.jar " ));
515
540
javacCmd .append (Paths .get (RESOURCE_DIR , "tunneling" , "JmsTestClient.java" ));
516
541
javacCmd .append (Paths .get (" -d " ));
0 commit comments