From 6605323a2739403d1bc4fe1c34e434a82b8572c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gani=20G=C3=BCrgah?= Date: Fri, 29 May 2026 16:49:26 +0300 Subject: [PATCH] Add WebLogic 14.x and 15.x server support Fixes #6109 **Issue** NetBeans WebLogic plugin did not recognize WebLogic 14.x and 15.x installations as supported versions and did not offer them as deployment targets for Jakarta EE projects. **Fix** - WebLogicLayout.isSupportedVersion(): replaced hardcoded version whitelist with isAboveOrEqual("9.0.0.0") so future versions are supported without code changes - WLDeploymentFactory: added VERSION_1411 and VERSION_1511 constants - WLJ2eePlatformFactory: added Java EE 8, Jakarta EE 8, Jakarta EE 9, 9.1, 10 and 11 profile support for WebLogic 14+ and 15+; added JDK 11 and 17 as supported Java versions for WebLogic 14+ and 15+ - BaseDescriptorModel: added VERSION_14_1_1 constant - WebLogicLayoutTest: added test coverage for versions 14.x and 15.x - Bumped javac.source to 11 which is the minimum required by WebLogic 14.x; this also fixes a build error caused by InputStream.transferTo() not being available at source level 1.8 Co-Authored-By: Claude Sonnet 4.6 --- .../nbproject/project.properties | 2 +- .../j2ee/weblogic9/WLDeploymentFactory.java | 4 +++ .../dd/model/BaseDescriptorModel.java | 2 ++ .../weblogic9/deploy/WLDriverDeployer.java | 6 ++++- .../weblogic9/deploy/WLJpa2SwitchSupport.java | 6 ++++- .../weblogic9/j2ee/WLJ2eePlatformFactory.java | 26 +++++++++++++++++++ .../weblogic/common/api/WebLogicLayout.java | 7 ++--- .../weblogic/common/WebLogicLayoutTest.java | 4 +++ 8 files changed, 49 insertions(+), 8 deletions(-) diff --git a/contrib/j2ee.weblogic9/nbproject/project.properties b/contrib/j2ee.weblogic9/nbproject/project.properties index 60a158d66617..42d7d05ab219 100644 --- a/contrib/j2ee.weblogic9/nbproject/project.properties +++ b/contrib/j2ee.weblogic9/nbproject/project.properties @@ -17,7 +17,7 @@ # under the License. # -javac.source=1.8 +javac.source=11 spec.version.base=1.45.0 test.config.stableBTD.includes=**/*Test.class diff --git a/contrib/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/WLDeploymentFactory.java b/contrib/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/WLDeploymentFactory.java index b39e04d8b948..ba62c9519e09 100644 --- a/contrib/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/WLDeploymentFactory.java +++ b/contrib/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/WLDeploymentFactory.java @@ -67,6 +67,10 @@ public class WLDeploymentFactory implements DeploymentFactory { public static final Version VERSION_1221 = Version.fromJsr277NotationWithFallback("12.2.1"); // NOI18N + public static final Version VERSION_1411 = Version.fromJsr277NotationWithFallback("14.1.1"); // NOI18N + + public static final Version VERSION_1511 = Version.fromJsr277NotationWithFallback("15.1.1"); // NOI18N + private static final Logger LOGGER = Logger.getLogger(WLDeploymentFactory.class.getName()); /** diff --git a/contrib/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/dd/model/BaseDescriptorModel.java b/contrib/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/dd/model/BaseDescriptorModel.java index e6df206b1cf8..d531e8b870ec 100644 --- a/contrib/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/dd/model/BaseDescriptorModel.java +++ b/contrib/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/dd/model/BaseDescriptorModel.java @@ -45,6 +45,8 @@ public class BaseDescriptorModel { protected static final Version VERSION_12_1_1 = Version.fromJsr277NotationWithFallback("12.1.1"); // NOI18N protected static final Version VERSION_12_2_1 = Version.fromJsr277NotationWithFallback("12.2.1"); // NOI18N + + protected static final Version VERSION_14_1_1 = Version.fromJsr277NotationWithFallback("14.1.1"); // NOI18N private final CommonDDBean bean; diff --git a/contrib/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/deploy/WLDriverDeployer.java b/contrib/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/deploy/WLDriverDeployer.java index efbcf95fe23b..1146fcfec90b 100644 --- a/contrib/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/deploy/WLDriverDeployer.java +++ b/contrib/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/deploy/WLDriverDeployer.java @@ -114,7 +114,11 @@ public void run() { ActionType.EXECUTE, CommandType.DISTRIBUTE, StateType.RUNNING, NbBundle.getMessage(WLDriverDeployer.class, "MSG_DeployingJDBCDrivers", toJar.getPath()))); try (BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(toJar))) { - is.transferTo(os); + byte[] buf = new byte[4096]; + int n; + while ((n = is.read(buf)) != -1) { + os.write(buf, 0, n); + } } } } catch (IOException e) { diff --git a/contrib/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/deploy/WLJpa2SwitchSupport.java b/contrib/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/deploy/WLJpa2SwitchSupport.java index 9b4070a33987..dce178d6127f 100644 --- a/contrib/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/deploy/WLJpa2SwitchSupport.java +++ b/contrib/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/deploy/WLJpa2SwitchSupport.java @@ -397,7 +397,11 @@ private void createContributionsJar(File jarFile, String classpath) throws IOExc private void copy(File source, File dest) throws IOException { try (InputStream is = new BufferedInputStream(new FileInputStream(source)); OutputStream os = new BufferedOutputStream(new FileOutputStream(dest))) { - is.transferTo(os); + byte[] buf = new byte[4096]; + int n; + while ((n = is.read(buf)) != -1) { + os.write(buf, 0, n); + } } } diff --git a/contrib/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/j2ee/WLJ2eePlatformFactory.java b/contrib/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/j2ee/WLJ2eePlatformFactory.java index a7f3c5aaeb31..d7dabdbe016f 100644 --- a/contrib/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/j2ee/WLJ2eePlatformFactory.java +++ b/contrib/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/j2ee/WLJ2eePlatformFactory.java @@ -130,6 +130,10 @@ public class WLJ2eePlatformFactory extends J2eePlatformFactory { private static final Version JDK8_SUPPORTED_SERVER_VERSION = Version.fromJsr277NotationWithFallback("12.1.3"); // NOI18N + private static final Version JDK11_SUPPORTED_SERVER_VERSION = Version.fromJsr277NotationWithFallback("14.1.1"); // NOI18N + + private static final Version JDK17_SUPPORTED_SERVER_VERSION = Version.fromJsr277NotationWithFallback("15.1.1"); // NOI18N + private static final Version JPA2_SUPPORTED_SERVER_VERSION = Version.fromJsr277NotationWithFallback("12.1.1"); // NOI18N private static final Version JPA21_SUPPORTED_SERVER_VERSION = Version.fromJsr277NotationWithFallback("12.1.3"); // NOI18N @@ -529,6 +533,22 @@ public J2eePlatformImplImpl(WLDeploymentManager dm) { profiles.add(Profile.JAVA_EE_7_FULL); profiles.add(Profile.JAVA_EE_7_WEB); } + if (version.isAboveOrEqual(WLDeploymentFactory.VERSION_1411)) { + profiles.add(Profile.JAVA_EE_8_FULL); + profiles.add(Profile.JAVA_EE_8_WEB); + profiles.add(Profile.JAKARTA_EE_8_FULL); + profiles.add(Profile.JAKARTA_EE_8_WEB); + } + if (version.isAboveOrEqual(WLDeploymentFactory.VERSION_1511)) { + profiles.add(Profile.JAKARTA_EE_9_FULL); + profiles.add(Profile.JAKARTA_EE_9_WEB); + profiles.add(Profile.JAKARTA_EE_9_1_FULL); + profiles.add(Profile.JAKARTA_EE_9_1_WEB); + profiles.add(Profile.JAKARTA_EE_10_FULL); + profiles.add(Profile.JAKARTA_EE_10_WEB); + profiles.add(Profile.JAKARTA_EE_11_FULL); + profiles.add(Profile.JAKARTA_EE_11_WEB); + } } domainChangeListener = new DomainChangeListener(this); @@ -621,6 +641,12 @@ public Set getSupportedTypes() { if (serverVersion.isAboveOrEqual(JDK8_SUPPORTED_SERVER_VERSION)) { versions.add("1.8"); // NOI18N } + if (serverVersion.isAboveOrEqual(JDK11_SUPPORTED_SERVER_VERSION)) { + versions.add("11"); // NOI18N + } + if (serverVersion.isAboveOrEqual(JDK17_SUPPORTED_SERVER_VERSION)) { + versions.add("17"); // NOI18N + } } return versions; } diff --git a/enterprise/weblogic.common/src/org/netbeans/modules/weblogic/common/api/WebLogicLayout.java b/enterprise/weblogic.common/src/org/netbeans/modules/weblogic/common/api/WebLogicLayout.java index 525e161e9b7c..4ab54b66e7bf 100644 --- a/enterprise/weblogic.common/src/org/netbeans/modules/weblogic/common/api/WebLogicLayout.java +++ b/enterprise/weblogic.common/src/org/netbeans/modules/weblogic/common/api/WebLogicLayout.java @@ -134,13 +134,10 @@ public static boolean isSupportedLayout(File candidate){ } /** - * Checks whether the server root contains weblogic.jar of version 9, 10 or 11. + * Checks whether the server root contains weblogic.jar of version 9 or above. */ public static boolean isSupportedVersion(Version version) { - return version != null && (Integer.valueOf(9).equals(version.getMajor()) - || Integer.valueOf(10).equals(version.getMajor()) - || Integer.valueOf(11).equals(version.getMajor()) - || Integer.valueOf(12).equals(version.getMajor())); + return version != null && version.isAboveOrEqual(Version.fromDottedNotationWithFallback("9.0.0.0")); } @NonNull diff --git a/enterprise/weblogic.common/test/unit/src/org/netbeans/modules/weblogic/common/WebLogicLayoutTest.java b/enterprise/weblogic.common/test/unit/src/org/netbeans/modules/weblogic/common/WebLogicLayoutTest.java index 81d68f5d78de..0ad7d5d0f1d8 100644 --- a/enterprise/weblogic.common/test/unit/src/org/netbeans/modules/weblogic/common/WebLogicLayoutTest.java +++ b/enterprise/weblogic.common/test/unit/src/org/netbeans/modules/weblogic/common/WebLogicLayoutTest.java @@ -73,6 +73,10 @@ public void testIsSupportedVersion() throws Exception { assertTrue(WebLogicLayout.isSupportedVersion(WebLogicLayout.getServerVersion(baseFolder))); createJar(file, "Implementation-Version: 8.0.0.0"); assertFalse(WebLogicLayout.isSupportedVersion(WebLogicLayout.getServerVersion(baseFolder))); + createJar(file, "Implementation-Version: 14.1.1.0"); + assertTrue(WebLogicLayout.isSupportedVersion(WebLogicLayout.getServerVersion(baseFolder))); + createJar(file, "Implementation-Version: 15.0.0.0"); + assertTrue(WebLogicLayout.isSupportedVersion(WebLogicLayout.getServerVersion(baseFolder))); createJar(file, "Missing-Implementation-Version: 10.0.0.0"); assertFalse(WebLogicLayout.isSupportedVersion(WebLogicLayout.getServerVersion(baseFolder))); }