Merge pull request #23774 from dmatej/sync-6.x-to-master220130
diff --git a/Jenkinsfile b/Jenkinsfile
index e823d46..8ff6f63 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2018-2021 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -14,40 +15,23 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
-
// the label is unique and identifies the pod descriptor and its resulting pods
// without this, the agent could be using a pod created from a different descriptor
env.label = "glassfish-ci-pod-${UUID.randomUUID().toString()}"
-// list of test ids
+// Docker image defined in this project in [glassfish]/etc/docker/Dockerfile
+env.gfImage = "ee4jglassfish/ci:tini-jdk-11.0.10"
+
def jobs = [
- "cdi_all",
- "ql_gf_full_profile_all",
- "ql_gf_web_profile_all",
- "web_jsp"
-]
-
-
-def jobs_all = [
+ "verifyPhase",
"cdi_all",
"ql_gf_full_profile_all",
"ql_gf_web_profile_all",
"web_jsp",
-
- "deployment_all",
"ejb_group_1",
"ejb_group_2",
"ejb_group_3",
- "ejb_web_all",
- "ql_gf_nucleus_all",
- "nucleus_admin_all",
- "jdbc_all",
- "batch_all",
- "persistence_all",
- "connector_group_1",
- "connector_group_2",
- "connector_group_3",
- "connector_group_4"
+ "ejb_group_embedded"
]
def parallelStagesMap = jobs.collectEntries {
@@ -55,106 +39,113 @@
}
def generateStage(job) {
- return {
- podTemplate(label: env.label) {
- node(label) {
- stage("${job}") {
- container('glassfish-ci') {
- // do the scm checkout
- retry(10) {
- sleep 60
- checkout scm
- }
+ if (job == 'verifyPhase') {
+ return generateMvnPodTemplate(job)
+ } else {
+ return generateAntPodTemplate(job)
+ }
+}
- // run the test
- unstash 'build-bundles'
-
- try {
- retry(3) {
- timeout(time: 2, unit: 'HOURS') {
- sh """
- export CLASSPATH=$WORKSPACE/glassfish7/javadb
- ./appserver/tests/gftest.sh run_test ${job}
- """
- }
- }
- } finally {
- // archive what we can...
- archiveArtifacts artifacts: "${job}-results.tar.gz"
- junit testResults: 'results/junitreports/*.xml', allowEmptyResults: false
- }
- }
- }
+def generateMvnPodTemplate(job) {
+ return {
+ podTemplate(
+ inheritFrom: "${env.label}",
+ containers: [
+ containerTemplate(
+ name: "glassfish-build",
+ image: "${env.gfImage}",
+ resourceRequestMemory: "7Gi",
+ resourceRequestCpu: "2650m"
+ )
+ ]
+ ) {
+ node(label) {
+ stage("${job}") {
+ container('glassfish-build') {
+ retry(5) {
+ sleep 1
+ checkout scm
}
+ timeout(time: 1, unit: 'HOURS') {
+ sh """
+ mvn clean install
+ """
+ junit testResults: '**/*-reports/*.xml', allowEmptyResults: false
+ }
+ }
}
+ }
}
+ }
+}
+
+def generateAntPodTemplate(job) {
+ return {
+ podTemplate(
+ inheritFrom: "${env.label}",
+ containers: [
+ containerTemplate(
+ name: "glassfish-build",
+ image: "${env.gfImage}",
+ resourceRequestMemory: "4Gi",
+ resourceRequestCpu: "2650m"
+ )
+ ]
+ ) {
+ node(label) {
+ stage("${job}") {
+ container('glassfish-build') {
+ retry(5) {
+ sleep 1
+ checkout scm
+ }
+ unstash 'build-bundles'
+ try {
+ timeout(time: 1, unit: 'HOURS') {
+ sh """
+ export CLASSPATH=$WORKSPACE/glassfish6/javadb
+ ./appserver/tests/gftest.sh run_test ${job}
+ """
+ }
+ } finally {
+ archiveArtifacts artifacts: "${job}-results.tar.gz"
+ junit testResults: 'results/junitreports/*.xml', allowEmptyResults: false
+ }
+ }
+ }
+ }
+ }
+ }
}
pipeline {
- options {
- // keep at most 50 builds
- buildDiscarder(logRotator(numToKeepStr: '10'))
-
- // preserve the stashes to allow re-running a test stage
- preserveStashes()
-
- // issue related to default 'implicit' checkout, disable it
- skipDefaultCheckout()
-
- // abort pipeline if previous stage is unstable
- skipStagesAfterUnstable()
-
- // show timestamps in logs
- timestamps()
-
- // global timeout, abort after 6 hours
- timeout(time: 6, unit: 'HOURS')
- }
-
agent {
kubernetes {
label "${env.label}"
- defaultContainer 'glassfish-ci'
yaml """
apiVersion: v1
kind: Pod
metadata:
spec:
- volumes:
- - name: "jenkins-home"
- emptyDir: {}
- - name: maven-repo-shared-storage
- persistentVolumeClaim:
- claimName: glassfish-maven-repo-storage
- - name: settings-xml
- secret:
- secretName: m2-secret-dir
- items:
- - key: settings.xml
- path: settings.xml
- - name: settings-security-xml
- secret:
- secretName: m2-secret-dir
- items:
- - key: settings-security.xml
- path: settings-security.xml
- - name: maven-repo-local-storage
- emptyDir: {}
containers:
- name: jnlp
- image: jenkins/jnlp-slave:alpine
+ image: jenkins/inbound-agent:4.11-1-alpine-jdk11
imagePullPolicy: IfNotPresent
env:
- name: JAVA_TOOL_OPTIONS
- value: -Xmx1G
+ value: "-Xmx768m -Xss768k"
resources:
+ # fixes random failure: minimum cpu usage per Pod is 200m, but request is 100m.
+ # affects performance on large repositories
limits:
- memory: "1Gi"
- cpu: "1"
- - name: glassfish-ci
- # Docker image defined in this project in [glassfish]/etc/docker/Dockerfile
- image: ee4jglassfish/ci:tini-jdk-11.0.10
+ memory: "1200Mi"
+ cpu: "300m"
+ requests:
+ memory: "1200Mi"
+ cpu: "300m"
+ - name: glassfish-build
+ image: ${env.gfImage}
args:
- cat
tty: true
@@ -177,13 +168,38 @@
mountPath: "/home/jenkins/.m2/repository/org/glassfish/main"
env:
- name: "MAVEN_OPTS"
- value: "-Duser.home=/home/jenkins"
+ value: "-Duser.home=/home/jenkins -Xmx2500m -Xss768k -XX:+UseStringDeduplication"
- name: "MVN_EXTRA"
value: "--batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn"
+ - name: JAVA_TOOL_OPTIONS
+ value: "-Xmx2g -Xss768k -XX:+UseStringDeduplication"
resources:
limits:
+ memory: "12Gi"
+ cpu: "8000m"
+ requests:
memory: "7Gi"
- cpu: "3"
+ cpu: "4000m"
+ volumes:
+ - name: "jenkins-home"
+ emptyDir: {}
+ - name: maven-repo-shared-storage
+ persistentVolumeClaim:
+ claimName: glassfish-maven-repo-storage
+ - name: settings-xml
+ secret:
+ secretName: m2-secret-dir
+ items:
+ - key: settings.xml
+ path: settings.xml
+ - name: settings-security-xml
+ secret:
+ secretName: m2-secret-dir
+ items:
+ - key: settings-security.xml
+ path: settings-security.xml
+ - name: maven-repo-local-storage
+ emptyDir: {}
"""
}
}
@@ -198,7 +214,27 @@
PORT_HTTPS=8181
}
+ options {
+ buildDiscarder(logRotator(numToKeepStr: '10'))
+
+ // to allow re-running a test stage
+ preserveStashes()
+
+ // issue related to default 'implicit' checkout, disable it
+ skipDefaultCheckout()
+
+ // abort pipeline if previous stage is unstable
+ skipStagesAfterUnstable()
+
+ // show timestamps in logs
+ timestamps()
+
+ // global timeout, abort after 6 hours
+ timeout(time: 6, unit: 'HOURS')
+ }
+
stages {
+
stage('build') {
agent {
kubernetes {
@@ -206,13 +242,9 @@
}
}
steps {
- container('glassfish-ci') {
+ container('glassfish-build') {
timeout(time: 1, unit: 'HOURS') {
-
- // do the scm checkout
checkout scm
-
- // do the build
sh '''
echo Maven version
mvn -v
@@ -223,10 +255,12 @@
echo Uname
uname -a
- bash -xe ./gfbuild.sh build_re_dev
+ # Until we fix ANTLR in cmp-support-sqlstore, broken in parallel builds. Just -Pfast after the fix.
+ mvn clean install -Pfastest,staging -T4C
+ ./gfbuild.sh archive_bundles
+ ls -la ./bundles
'''
archiveArtifacts artifacts: 'bundles/*.zip'
- // junit testResults: 'test-results/build-unit-tests/results/junitreports/test_results_junit.xml'
stash includes: 'bundles/*', name: 'build-bundles'
}
}
diff --git a/appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/CLIBootstrap.java b/appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/CLIBootstrap.java
index 0861a09..64c7a27 100644
--- a/appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/CLIBootstrap.java
+++ b/appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/CLIBootstrap.java
@@ -85,12 +85,12 @@
private JavaInfo java = new JavaInfo();
private GlassFishInfo gfInfo = new GlassFishInfo();
- private UserVMArgs userVMArgs = new UserVMArgs(System.getProperty(ENV_VAR_PROP_PREFIX + "VMARGS"));
+ private final UserVMArgs userVMArgs = new UserVMArgs(System.getProperty(ENV_VAR_PROP_PREFIX + "VMARGS"));
/**
* Set up with various sub-types of command line elements
*/
- private CommandLineElement
+ private final CommandLineElement
/** options to the ACC that take a value */
accValuedOptions = new ACCValuedOption("-mainclass|-name|-xml|-configxml|-user|-password|-passwordfile|-targetserver"),
@@ -106,7 +106,7 @@
private final JVMMainOption jvmMainSetting = new JVMMainOption();
/** command line elements from most specific to least specific matching pattern */
- private CommandLineElement[] elementsInScanOrder = new CommandLineElement[] {
+ private final CommandLineElement[] elementsInScanOrder = new CommandLineElement[] {
accValuedOptions, // collects options into "agentArgs"
accUnvaluedOptions, // collects options into "agentArgs"
jvmValuedOptions,
@@ -119,7 +119,7 @@
* Command line elements in the order they should appear on the generated command line
* Add the elements in this order so they appear in the generated java command in the correct positions.
*/
- private CommandLineElement[] elementsInOutputOrder = new CommandLineElement[] {
+ private final CommandLineElement[] elementsInOutputOrder = new CommandLineElement[] {
jvmValuedOptions,
jvmPropertySettings,
otherJVMOptions,
@@ -287,7 +287,6 @@
*/
private void addProperties(final StringBuilder command) {
command.append(' ').append("-Dorg.glassfish.gmbal.no.multipleUpperBoundsException=true");
- command.append(' ').append("-Dorg.glassfish.gmbal.no.multipleUpperBoundsException=true");
command.append(' ').append("--add-opens=java.base/java.lang=ALL-UNNAMED");
command.append(' ').append(INSTALL_ROOT_PROPERTY_EXPR).append(quote(gfInfo.home().getAbsolutePath()));
command.append(' ').append(SECURITY_POLICY_PROPERTY_EXPR).append(quote(gfInfo.securityPolicy().getAbsolutePath()));
@@ -381,7 +380,7 @@
*/
private static class AgentArgs {
private final StringBuilder args = new StringBuilder("=mode=acscript");
- private char sep = ',';
+ private final char sep = ',';
AgentArgs() {
final String appcPath = System.getProperty(ENV_VAR_PROP_PREFIX + "APPCPATH");
@@ -430,7 +429,7 @@
private final Pattern whiteSpacePattern = Pattern.compile("[\\r\\n]");
/** Allows multiple values; not all command line elements support this */
- final List<String> values = new ArrayList<String>();
+ final List<String> values = new ArrayList<>();
CommandLineElement(String patternString) {
this(patternString, 0);
@@ -584,8 +583,8 @@
private class ValuedOption extends Option {
class OptionValue {
- private String option;
- private String value;
+ private final String option;
+ private final String value;
OptionValue(String option, String value) {
this.option = option;
@@ -1035,7 +1034,7 @@
private CommandLineElement evJVMValuedOptions;
private CommandLineElement evOtherJVMOptions;
- private final List<CommandLineElement> evElements = new ArrayList<CommandLineElement>();
+ private final List<CommandLineElement> evElements = new ArrayList<>();
UserVMArgs(String vmargs) throws UserError {
diff --git a/appserver/common/container-common/src/main/java/com/sun/enterprise/container/common/impl/util/JavaEEIOUtilsImpl.java b/appserver/common/container-common/src/main/java/com/sun/enterprise/container/common/impl/util/JavaEEIOUtilsImpl.java
index a909336..d23ca31 100644
--- a/appserver/common/container-common/src/main/java/com/sun/enterprise/container/common/impl/util/JavaEEIOUtilsImpl.java
+++ b/appserver/common/container-common/src/main/java/com/sun/enterprise/container/common/impl/util/JavaEEIOUtilsImpl.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -16,23 +17,28 @@
package com.sun.enterprise.container.common.impl.util;
-import org.jvnet.hk2.annotations.Contract;
-import jakarta.inject.Inject;
-import org.jvnet.hk2.annotations.Service;
-import org.glassfish.hk2.api.PostConstruct;
-import org.glassfish.hk2.api.ServiceLocator;
-
-import com.sun.enterprise.container.common.spi.util.GlassFishOutputStreamHandler;
import com.sun.enterprise.container.common.spi.util.GlassFishInputStreamHandler;
+import com.sun.enterprise.container.common.spi.util.GlassFishOutputStreamHandler;
import com.sun.enterprise.container.common.spi.util.JavaEEIOUtils;
import com.sun.logging.LogDomains;
-import java.io.*;
+import jakarta.inject.Inject;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
import java.util.Collection;
import java.util.HashSet;
import java.util.logging.Level;
import java.util.logging.Logger;
+import org.glassfish.hk2.api.ServiceLocator;
+import org.jvnet.hk2.annotations.Service;
+
/**
* A contract that defines a set of methods to serialize / deserialze Java EE
* objects (even if they are not directly serializable).
@@ -53,20 +59,23 @@
@Inject
ServiceLocator habitat;
- private Collection<GlassFishOutputStreamHandler> outputHandlers = new HashSet<GlassFishOutputStreamHandler>();
+ private final Collection<GlassFishOutputStreamHandler> outputHandlers = new HashSet<>();
- private Collection<GlassFishInputStreamHandler> inputHandlers = new HashSet<GlassFishInputStreamHandler>();
+ private final Collection<GlassFishInputStreamHandler> inputHandlers = new HashSet<>();
+ @Override
public ObjectInputStream createObjectInputStream(InputStream is,
boolean resolveObject, ClassLoader loader) throws Exception {
return new GlassFishObjectInputStream(inputHandlers, is, loader, resolveObject);
}
+ @Override
public ObjectOutputStream createObjectOutputStream(OutputStream os,
boolean replaceObject) throws IOException {
return new GlassFishObjectOutputStream(outputHandlers, os, replaceObject);
}
+ @Override
public byte[] serializeObject(Object obj, boolean replaceObject)
throws java.io.IOException {
@@ -101,6 +110,7 @@
return data;
}
+ @Override
public Object deserializeObject(byte[] data, boolean resolveObject,
ClassLoader appClassLoader) throws Exception {
@@ -129,20 +139,24 @@
return obj;
}
+ @Override
public void addGlassFishOutputStreamHandler(GlassFishOutputStreamHandler handler) {
outputHandlers.add(handler);
}
+ @Override
public void removeGlassFishOutputStreamHandler(GlassFishOutputStreamHandler handler) {
outputHandlers.remove(handler);
}
+ @Override
public void addGlassFishInputStreamHandler(
GlassFishInputStreamHandler handler) {
inputHandlers.add(handler);
}
+ @Override
public void removeGlassFishInputStreamHandler(
GlassFishInputStreamHandler handler) {
inputHandlers.remove(handler);
diff --git a/appserver/core/api-exporter-fragment/pom.xml b/appserver/core/api-exporter-fragment/pom.xml
index 0b24a2f..a7e5234 100755
--- a/appserver/core/api-exporter-fragment/pom.xml
+++ b/appserver/core/api-exporter-fragment/pom.xml
@@ -224,8 +224,6 @@
javax.lang.model.type;
javax.lang.model.util;
javax.management;
- javax.management.j2ee;
- javax.management.j2ee.statistics;
javax.management.loading;
javax.management.modelmbean;
javax.management.monitor;
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/appserv/ejb/.gitkeep_empty_dir b/appserver/ejb/ejb-container/src/main/java/com/sun/appserv/ejb/.gitkeep_empty_dir
deleted file mode 100644
index e69de29..0000000
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/appserv/ejb/.gitkeep_empty_dir
+++ /dev/null
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/EJBUtils.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/EJBUtils.java
index 9a46d90..df490db 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/EJBUtils.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/EJBUtils.java
@@ -1,6 +1,6 @@
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2021 Contributors to the Eclipse Foundation
+ * Copyright (c) 2021-2022 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -18,9 +18,9 @@
package com.sun.ejb;
import com.sun.ejb.codegen.AsmSerializableBeanGenerator;
-import com.sun.ejb.codegen.ClassGeneratorFactory;
+import com.sun.ejb.codegen.EjbClassGeneratorFactory;
import com.sun.ejb.codegen.Generator;
-import com.sun.ejb.codegen.GenericHomeGenerator;
+import com.sun.ejb.codegen.GeneratorException;
import com.sun.ejb.codegen.Remote30WrapperGenerator;
import com.sun.ejb.codegen.RemoteGenerator;
import com.sun.ejb.containers.BaseContainer;
@@ -31,35 +31,24 @@
import com.sun.enterprise.deployment.EjbReferenceDescriptor;
import com.sun.logging.LogDomains;
-import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
-import java.io.PrintStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
-import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Collection;
-import java.util.Properties;
import java.util.SortedMap;
import java.util.TreeMap;
-import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;
-import org.glassfish.pfl.dynamic.codegen.spi.Wrapper;
-
-import static com.sun.ejb.codegen.GenericHomeGenerator.GENERIC_HOME_CLASSNAME;
import static java.util.logging.Level.FINE;
-import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper.DUMP_AFTER_SETUP_VISITOR;
-import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper.TRACE_BYTE_CODE_GENERATION;
-import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper.USE_ASM_VERIFIER;
/**
* A handy class with static utility methods.
@@ -331,7 +320,7 @@
public static Object lookupRemote30BusinessObject(Object jndiObj, String businessInterface) throws NamingException {
try {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
- Class<?> genericEJBHome = loadGeneratedGenericEJBHomeClass(loader);
+ Class<?> genericEJBHome = loadGeneratedGenericEJBHomeClass(loader, jndiObj.getClass());
final Object genericHomeObj = PortableRemoteObject.narrow(jndiObj, genericEJBHome);
// The generated remote business interface and the
@@ -356,11 +345,16 @@
}
- public static Class loadGeneratedSerializableClass(ClassLoader loader, String className) throws Exception {
- String generatedSerializableClassName = AsmSerializableBeanGenerator.getGeneratedSerializableClassName(className);
- Class developerClass = loader.loadClass(className);
- AsmSerializableBeanGenerator gen =
- new AsmSerializableBeanGenerator(loader, developerClass, generatedSerializableClassName);
+ public static Class loadGeneratedSerializableClass(final ClassLoader loader, final Class<?> originalClass)
+ throws Exception {
+ final String generatedClassName = AsmSerializableBeanGenerator
+ .getGeneratedSerializableClassName(originalClass.getName());
+ try {
+ return loader.loadClass(generatedClassName);
+ } catch (ClassNotFoundException e) {
+ // Not loaded yet. Just continue
+ }
+ AsmSerializableBeanGenerator gen = new AsmSerializableBeanGenerator(loader, originalClass, generatedClassName);
return gen.generateSerializableSubclass();
}
@@ -377,117 +371,41 @@
* @return full class name of the generated remote interface
* @throws Exception
*/
- public static String loadGeneratedRemoteBusinessClasses(ClassLoader appClassLoader, String businessInterfaceName)
+ public static Class<?> loadGeneratedRemoteBusinessClasses(ClassLoader appClassLoader, String businessInterfaceName)
throws Exception {
- String generatedRemoteIntfName = RemoteGenerator.getGeneratedRemoteIntfName(businessInterfaceName);
- String wrapperClassName = Remote30WrapperGenerator.getGeneratedRemoteWrapperName(businessInterfaceName);
- Class<?> generatedRemoteIntf = loadClassIgnoringExceptions(appClassLoader, generatedRemoteIntfName);
- Class<?> generatedRemoteWrapper = loadClassIgnoringExceptions(appClassLoader, wrapperClassName);
- if (generatedRemoteIntf != null && generatedRemoteWrapper != null) {
- return generatedRemoteIntfName;
- }
-
- Wrapper._setClassLoader(appClassLoader);
- try {
- if (generatedRemoteIntf == null) {
- RemoteGenerator generator = new RemoteGenerator(appClassLoader, businessInterfaceName);
- generateAndLoad(generator, appClassLoader);
- }
- if (generatedRemoteWrapper == null) {
- Remote30WrapperGenerator generator
- = new Remote30WrapperGenerator(appClassLoader, businessInterfaceName, generatedRemoteIntfName);
- generateAndLoad(generator, appClassLoader);
- }
- } finally {
- // Make sure no classloader is bound to threadlocal: avoid possible classloader leak.
- Wrapper._setClassLoader(null) ;
- }
- return generatedRemoteIntfName;
- }
-
-
- public static Class<?> loadGeneratedGenericEJBHomeClass(final ClassLoader appClassLoader) throws Exception {
- final Class<?> generatedGenericEJBHomeClass = loadClassIgnoringExceptions(appClassLoader, GENERIC_HOME_CLASSNAME);
- if (generatedGenericEJBHomeClass != null) {
- return generatedGenericEJBHomeClass;
- }
- final GenericHomeGenerator generator = new GenericHomeGenerator();
- return generateAndLoad(generator, appClassLoader);
- }
-
-
- public static Class<?> generateSEI(ClassGeneratorFactory cgf, ClassLoader loader) {
- Class<?> clazz = loadClassIgnoringExceptions(loader, cgf.getGeneratedClassName());
- if (clazz != null) {
- return clazz;
- }
- return generateAndLoad(cgf, loader);
- }
-
-
- /**
- * Checks if the class wasn't already generated by another thread and if not, generates it.
- * The class name is retrieved from {@link ClassGeneratorFactory#getGeneratedClassName()}
- * and if it wasn't found, generator knows it's definition.
- */
- // made package visible just for tests
- static synchronized Class<?> generateAndLoad(final ClassGeneratorFactory generator, final ClassLoader loader) {
- Class<?> clazz = loadClassIgnoringExceptions(loader, generator.getGeneratedClassName());
- if (clazz != null) {
- return clazz;
- }
-
- generator.evaluate();
-
- final Properties props = new Properties();
- if (_logger.isLoggable(Level.FINEST)) {
- props.put(DUMP_AFTER_SETUP_VISITOR, "true");
- props.put(TRACE_BYTE_CODE_GENERATION, "true");
- props.put(USE_ASM_VERIFIER, "true");
- try {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- PrintStream ps = new PrintStream(baos);
- Wrapper._sourceCode(ps, props);
- _logger.fine(baos.toString());
- } catch (Exception e) {
- _logger.log(Level.SEVERE, "Exception generating src for logs", e);
- }
- }
-
- if (System.getSecurityManager() == null) {
- return Wrapper._generate(loader, generator.getAnchorClass().getProtectionDomain(), props);
- }
- PrivilegedAction<Class<?>> action = () ->
- Wrapper._generate(loader, generator.getAnchorClass().getProtectionDomain(), props);
- return AccessController.doPrivileged(action);
- }
-
- private static Class<?> loadClassIgnoringExceptions(ClassLoader classLoader, String className) {
- try {
- return classLoader.loadClass(className);
- } catch (ClassNotFoundException e) {
- _logger.log(FINE, "Could not load class: " + className + " by classloader " + classLoader, e);
- return null;
+ try (EjbClassGeneratorFactory factory = new EjbClassGeneratorFactory(appClassLoader)) {
+ return factory.ensureRemote(businessInterfaceName);
}
}
- public static RemoteBusinessWrapperBase createRemoteBusinessObject
- (String businessInterface, java.rmi.Remote delegate)
- throws Exception {
- ClassLoader appClassLoader =
- getBusinessIntfClassLoader(businessInterface);
-
- return createRemoteBusinessObject(appClassLoader,
- businessInterface, delegate);
+ public static Class<?> loadGeneratedGenericEJBHomeClass(ClassLoader appClassLoader, Class<?> anchorClass) throws GeneratorException {
+ try (EjbClassGeneratorFactory factory = new EjbClassGeneratorFactory(appClassLoader)) {
+ return factory.ensureGenericHome(anchorClass);
+ }
}
- public static RemoteBusinessWrapperBase createRemoteBusinessObject(ClassLoader loader, String businessInterface,
+ public static Class<?> generateSEI(ClassLoader loader, final Class<?> ejbClass) throws GeneratorException {
+ try (EjbClassGeneratorFactory factory = new EjbClassGeneratorFactory(loader)) {
+ return factory.ensureServiceInterface(ejbClass);
+ }
+ }
+
+
+ public static RemoteBusinessWrapperBase createRemoteBusinessObject(
+ String businessInterface,
java.rmi.Remote delegate) throws Exception {
+ ClassLoader appClassLoader = getBusinessIntfClassLoader(businessInterface);
+ return createRemoteBusinessObject(appClassLoader, businessInterface, delegate);
+ }
+
+
+ public static RemoteBusinessWrapperBase createRemoteBusinessObject(
+ ClassLoader loader, String businessInterface, java.rmi.Remote delegate) throws Exception {
String wrapperClassName = Remote30WrapperGenerator.getGeneratedRemoteWrapperName(businessInterface);
Class clientWrapperClass = loader.loadClass(wrapperClassName);
- Constructor ctors[] = clientWrapperClass.getConstructors();
+ Constructor[] ctors = clientWrapperClass.getConstructors();
Constructor ctor = null;
for (Constructor next : ctors) {
if (next.getParameterTypes().length > 0) {
@@ -503,70 +421,43 @@
}
- private static ClassLoader getBusinessIntfClassLoader
- (String businessInterface) throws Exception {
-
- ClassLoader contextLoader = null;
- if(System.getSecurityManager() == null) {
+ private static ClassLoader getBusinessIntfClassLoader(String businessInterface) throws Exception {
+ final ClassLoader contextLoader;
+ if (System.getSecurityManager() == null) {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
- contextLoader = (cl != null) ? cl :
- ClassLoader.getSystemClassLoader();
+ contextLoader = cl == null ? ClassLoader.getSystemClassLoader() : cl;
} else {
- contextLoader = (ClassLoader)
- java.security.AccessController.doPrivileged
- (new java.security.PrivilegedAction() {
- @Override
- public java.lang.Object run() {
- // Return context class loader. If there is none,
- // which could happen within Appclient container,
- // return system class loader.
- ClassLoader cl =
- Thread.currentThread().getContextClassLoader();
- return (cl != null) ? cl :
- ClassLoader.getSystemClassLoader();
-
- }});
+ PrivilegedAction<ClassLoader> action = () -> {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ return cl == null ? ClassLoader.getSystemClassLoader() : cl;
+ };
+ contextLoader = java.security.AccessController.doPrivileged(action);
}
- final Class businessInterfaceClass =
- contextLoader.loadClass(businessInterface);
-
- ClassLoader appClassLoader = null;
- if(System.getSecurityManager() == null) {
- appClassLoader = businessInterfaceClass.getClassLoader();
- } else {
- appClassLoader = (ClassLoader)
- java.security.AccessController.doPrivileged
- (new java.security.PrivilegedAction() {
- @Override
- public java.lang.Object run() {
- return businessInterfaceClass.getClassLoader();
-
- }});
+ final Class<?> businessInterfaceClass = contextLoader.loadClass(businessInterface);
+ if (System.getSecurityManager() == null) {
+ return businessInterfaceClass.getClassLoader();
}
-
- return appClassLoader;
+ PrivilegedAction<ClassLoader> action = () -> businessInterfaceClass.getClassLoader();
+ return java.security.AccessController.doPrivileged(action);
}
- public static void serializeObjectFields(
- Object instance,
- ObjectOutputStream oos)
- throws IOException {
+ // warning: accessed by reflection (AsmSerializableBeanGenerator)
+ public static void serializeObjectFields(Object instance, ObjectOutputStream oos) throws IOException {
serializeObjectFields(instance, oos, true);
}
- public static void serializeObjectFields(
- Object instance,
- ObjectOutputStream oos,
- boolean usesSuperClass)
+
+ // warning: accessed by reflection (AsmSerializableBeanGenerator)
+ public static void serializeObjectFields(Object instance, ObjectOutputStream oos, boolean usesSuperClass)
throws IOException {
Class clazz = (usesSuperClass)? instance.getClass().getSuperclass() : instance.getClass();
final ObjectOutputStream objOutStream = oos;
// Write out list of fields eligible for serialization in sorted order.
- for(Field next : getSerializationFields(clazz)) {
+ for (Field next : getSerializationFields(clazz)) {
final Field nextField = next;
final Object theInstance = instance;
@@ -594,39 +485,26 @@
}
objOutStream.writeObject(value);
- } catch(Throwable t) {
- if( _logger.isLoggable(FINE) ) {
- _logger.log(FINE, "=====> failed serializing field: " + nextField +
- " =====> of class: " + clazz + " =====> using: " + oos.getClass() +
- " =====> serializing value of type: " + ((value == null)? null : value.getClass().getName()) +
- " ===> Error: " + t);
- _logger.log(FINE, "", t);
+ } catch (Throwable t) {
+ if (_logger.isLoggable(FINE)) {
+ _logger.log(FINE,
+ "Failed serializing field: " + nextField + " of " + clazz
+ + " using: " + oos.getClass() + " serializing value of type: "
+ + (value == null ? null : value.getClass().getName()) + ", cause: " + t);
}
- IOException ioe = new IOException();
- Throwable cause = (t instanceof InvocationTargetException) ?
- ((InvocationTargetException)t).getCause() : t;
- ioe.initCause( cause );
- throw ioe;
+ throw new IOException(t instanceof InvocationTargetException ? t.getCause() : t);
}
}
}
- public static void deserializeObjectFields(
- Object instance,
- ObjectInputStream ois)
- throws IOException {
-
+ // note: accessed by reflection!
+ public static void deserializeObjectFields(Object instance, ObjectInputStream ois) throws IOException {
deserializeObjectFields(instance, ois, null, true);
-
}
- public static void deserializeObjectFields(
- Object instance,
- ObjectInputStream ois,
- Object replaceValue,
- boolean usesSuperClass)
- throws IOException {
-
+ // note: accessed by reflection!
+ public static void deserializeObjectFields(Object instance, ObjectInputStream ois, Object replaceValue,
+ boolean usesSuperClass) throws IOException {
Class clazz = (usesSuperClass)? instance.getClass().getSuperclass() : instance.getClass();
if( _logger.isLoggable(FINE) ) {
_logger.log(FINE, "=====> Deserializing class: " + clazz);
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/base/io/EJBObjectOutputStreamHandler.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/base/io/EJBObjectOutputStreamHandler.java
index 44c4f02..4d27c32 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/base/io/EJBObjectOutputStreamHandler.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/base/io/EJBObjectOutputStreamHandler.java
@@ -32,12 +32,16 @@
import javax.naming.NamingException;
import java.io.IOException;
import java.io.Serializable;
+import java.rmi.Remote;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.glassfish.enterprise.iiop.api.ProtocolManager;
import org.glassfish.enterprise.iiop.api.GlassFishORBHelper;
import org.glassfish.internal.api.Globals;
+
+import static com.sun.logging.LogDomains.EJB_LOGGER;
+
import org.glassfish.api.naming.GlassfishNamingManager;
import com.sun.enterprise.container.common.spi.util.GlassFishOutputStreamHandler;
@@ -48,21 +52,19 @@
*
* @author Mahesh Kannan
*/
-public class EJBObjectOutputStreamHandler
- implements GlassFishOutputStreamHandler
-{
+public class EJBObjectOutputStreamHandler implements GlassFishOutputStreamHandler {
+
static JavaEEIOUtils _javaEEIOUtils;
- protected static final Logger _ejbLogger =
- LogDomains.getLogger(EJBObjectOutputStreamHandler.class, LogDomains.EJB_LOGGER);
+ private static final Logger LOG = LogDomains.getLogger(EJBObjectOutputStreamHandler.class, EJB_LOGGER);
static final int EJBID_OFFSET = 0;
static final int INSTANCEKEYLEN_OFFSET = 8;
static final int INSTANCEKEY_OFFSET = 12;
- private static final byte HOME_KEY = (byte)0xff;
+ private static final byte HOME_KEY = (byte) 0xff;
- //Ugly,
+ // FIXME: @JavaEEIOUtils is a Service, but this is really a bad thing!
public static final void setJavaEEIOUtils(JavaEEIOUtils javaEEIOUtils) {
_javaEEIOUtils = javaEEIOUtils;
}
@@ -72,24 +74,21 @@
* can be part of a bean's state. See EJB2.0 section 7.4.1.
*/
@Override
- public Object replaceObject(Object obj)
- throws IOException {
+ public Object replaceObject(Object obj) throws IOException {
Object result = obj;
// Until we've identified a remote object, we can't assume the orb is
- // available in the container. If the orb is not present, this will be null.
+ // available in the container. If the orb is not present, this will be null.
ProtocolManager protocolMgr = getProtocolManager();
if (obj instanceof RemoteBusinessWrapperBase) {
- result = getRemoteBusinessObjectFactory
- ((RemoteBusinessWrapperBase) obj);
+ result = getRemoteBusinessObjectFactory((RemoteBusinessWrapperBase) obj);
} else if ((protocolMgr != null) && protocolMgr.isStub(obj) && protocolMgr.isLocal(obj)) {
org.omg.CORBA.Object target = (org.omg.CORBA.Object) obj;
// If we're here, it's always for the 2.x RemoteHome view.
// There is no remote business wrapper class.
result = getSerializableEJBReference(target, protocolMgr, null);
}
-
return result;
}
@@ -104,75 +103,47 @@
return orbHelper.isORBInitialized() ? orbHelper.getProtocolManager() : null;
}
- private Serializable getRemoteBusinessObjectFactory
- (RemoteBusinessWrapperBase remoteBusinessWrapper)
+
+ private Serializable getRemoteBusinessObjectFactory(RemoteBusinessWrapperBase remoteBusinessWrapper)
throws IOException {
// Create a serializable object with the remote delegate and
// the name of the client wrapper class.
- org.omg.CORBA.Object target = (org.omg.CORBA.Object)
- remoteBusinessWrapper.getStub();
- return getSerializableEJBReference(target,
- getProtocolManager(),
- remoteBusinessWrapper.getBusinessInterfaceName());
+ org.omg.CORBA.Object target = (org.omg.CORBA.Object) remoteBusinessWrapper.getStub();
+ return getSerializableEJBReference(target, getProtocolManager(), remoteBusinessWrapper.getBusinessInterfaceName());
}
- private Serializable getSerializableEJBReference(org.omg.CORBA.Object obj,
- ProtocolManager protocolMgr,
- String remoteBusinessInterface)
- throws IOException
- {
- Serializable result = (Serializable) obj;
+
+ private Serializable getSerializableEJBReference(
+ org.omg.CORBA.Object obj, ProtocolManager protocolMgr, String remoteBusinessInterface) throws IOException {
try {
-
-
byte[] oid = protocolMgr.getObjectID(obj);
-
-
- if ((oid != null) && (oid.length > INSTANCEKEY_OFFSET)) {
+ if (oid != null && oid.length > INSTANCEKEY_OFFSET) {
long containerId = Utility.bytesToLong(oid, EJBID_OFFSET);
- //To be really sure that is indeed a ref generated
+ // To be really sure that is indeed a ref generated
// by our container we do the following checks
int keyLength = Utility.bytesToInt(oid, INSTANCEKEYLEN_OFFSET);
if (oid.length == keyLength + INSTANCEKEY_OFFSET) {
- boolean isHomeReference =
- ((keyLength == 1) && (oid[INSTANCEKEY_OFFSET] == HOME_KEY));
+ boolean isHomeReference = keyLength == 1 && oid[INSTANCEKEY_OFFSET] == HOME_KEY;
if (isHomeReference) {
- result = new SerializableS1ASEJBHomeReference(containerId);
- } else {
- SerializableS1ASEJBObjectReference serRef =
- new SerializableS1ASEJBObjectReference(containerId,
- oid, keyLength, remoteBusinessInterface);
- result = serRef;
- /* TODO
- if (serRef.isHAEnabled()) {
- SimpleKeyGenerator gen = new SimpleKeyGenerator();
- Object key = gen.byteArrayToKey(oid, INSTANCEKEY_OFFSET, 20);
- long version = SFSBClientVersionManager.getClientVersion(
- containerId, key);
- serRef.setSFSBClientVersion(key, version);
- } */
+ return new SerializableS1ASEJBHomeReference(containerId);
}
+ return new SerializableS1ASEJBObjectReference(containerId, oid, keyLength, remoteBusinessInterface);
}
}
+ return (Serializable) obj;
} catch (Exception ex) {
- _ejbLogger.log(Level.WARNING, "Exception while getting serializable object", ex);
- IOException ioEx = new IOException("Exception during extraction of instance key");
- ioEx.initCause(ex);
- throw ioEx;
+ LOG.log(Level.WARNING, "Exception while getting serializable object", ex);
+ throw new IOException("Exception during extraction of instance key", ex);
}
- return result;
}
-
}
-final class SerializableJNDIContext
- implements SerializableObjectFactory
-{
+
+final class SerializableJNDIContext implements SerializableObjectFactory {
+
private String name;
- SerializableJNDIContext(Context ctx)
- throws IOException
- {
+ SerializableJNDIContext(Context ctx) throws IOException {
try {
// Serialize state for a jndi context. The spec only requires
// support for serializing contexts pointing to java:comp/env
@@ -183,127 +154,92 @@
// throw an exception during deserialization.
this.name = ctx.getNameInNamespace();
} catch (NamingException ex) {
- IOException ioe = new IOException();
- ioe.initCause(ex);
- throw ioe;
+ throw new IOException(ex);
}
}
+
@Override
- public Object createObject()
- throws IOException
- {
+ public Object createObject() throws IOException {
try {
- if ((name == null) || (name.length() == 0)) {
+ if (name == null || name.isEmpty()) {
return new InitialContext();
- } else {
- return Globals.getDefaultHabitat().<GlassfishNamingManager>getService(GlassfishNamingManager.class).restoreJavaCompEnvContext(name);
}
- } catch (NamingException namEx) {
- IOException ioe = new IOException();
- ioe.initCause(namEx);
- throw ioe;
- }
+ return Globals.getDefaultHabitat().<GlassfishNamingManager> getService(GlassfishNamingManager.class)
+ .restoreJavaCompEnvContext(name);
+ } catch (NamingException e) {
+ throw new IOException(e);
+ }
}
}
-abstract class AbstractSerializableS1ASEJBReference
- implements SerializableObjectFactory
-{
+
+abstract class AbstractSerializableS1ASEJBReference implements SerializableObjectFactory {
+
+ protected static final Logger LOG = LogDomains.getLogger(AbstractSerializableS1ASEJBReference.class, EJB_LOGGER);
protected long containerId;
- protected String debugStr; //used for loggin purpose only
- protected static Logger _ejbLogger =
- LogDomains.getLogger(AbstractSerializableS1ASEJBReference.class, LogDomains.EJB_LOGGER);
-
AbstractSerializableS1ASEJBReference(long containerId) {
- this.containerId = containerId;
- BaseContainer container = EjbContainerUtilImpl.getInstance().getContainer(containerId);
-
- //container can be null if the app has been undeployed
- // after this was serialized
- if (container == null) {
- _ejbLogger.log(Level.WARNING, "ejb.base.io.EJBOutputStream.null_container: "
- + containerId);
- debugStr = "" + containerId;
- } else {
- debugStr = container.toString();
- }
- }
-
-
- protected static java.rmi.Remote doRemoteRefClassLoaderConversion
- (java.rmi.Remote reference) throws IOException {
-
- Thread currentThread = Thread.currentThread();
- ClassLoader contextClassLoader =
- currentThread.getContextClassLoader();
-
- java.rmi.Remote returnReference = reference;
-
- if( reference.getClass().getClassLoader() !=
- contextClassLoader) {
- try {
- byte[] serializedRef = EJBObjectOutputStreamHandler._javaEEIOUtils.serializeObject
- (reference, false);
- returnReference = (java.rmi.Remote)
- EJBObjectOutputStreamHandler._javaEEIOUtils.deserializeObject(serializedRef, false,
- contextClassLoader);
- GlassFishORBHelper orbHelper = EjbContainerUtilImpl.getInstance().getORBHelper();
- ProtocolManager protocolMgr = orbHelper.getProtocolManager();
-
- protocolMgr.connectObject(returnReference);
-
- } catch(IOException ioe) {
- throw ioe;
- } catch(Exception e) {
- IOException ioEx = new IOException(e.getMessage());
- ioEx.initCause(e);
- throw ioEx;
- }
+ this.containerId = containerId;
+ BaseContainer container = EjbContainerUtilImpl.getInstance().getContainer(containerId);
+ // container can be null if the app has been undeployed after this was serialized
+ if (container == null) {
+ LOG.log(Level.WARNING, "ejb.base.io.null_container", containerId);
}
+ }
- return returnReference;
+
+ protected static java.rmi.Remote doRemoteRefClassLoaderConversion(final java.rmi.Remote reference) throws IOException {
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ if (contextClassLoader == reference.getClass().getClassLoader()) {
+ return reference;
+ }
+ try {
+ byte[] serializedRef = EJBObjectOutputStreamHandler._javaEEIOUtils.serializeObject(reference, false);
+ Remote returnReference = (java.rmi.Remote) EJBObjectOutputStreamHandler._javaEEIOUtils
+ .deserializeObject(serializedRef, false, contextClassLoader);
+ GlassFishORBHelper orbHelper = EjbContainerUtilImpl.getInstance().getORBHelper();
+ ProtocolManager protocolMgr = orbHelper.getProtocolManager();
+ protocolMgr.connectObject(returnReference);
+ return returnReference;
+ } catch (IOException ioe) {
+ throw ioe;
+ } catch (Exception e) {
+ throw new IOException(e.getMessage(), e);
+ }
}
}
-final class SerializableS1ASEJBHomeReference
- extends AbstractSerializableS1ASEJBReference
-{
+
+final class SerializableS1ASEJBHomeReference extends AbstractSerializableS1ASEJBReference {
+
+ private static final long serialVersionUID = 1L;
SerializableS1ASEJBHomeReference(long containerId) {
- super(containerId);
+ super(containerId);
}
@Override
- public Object createObject()
- throws IOException
- {
- Object result = null;
+ public Object createObject() throws IOException {
BaseContainer container = EjbContainerUtilImpl.getInstance().getContainer(containerId);
//container can be null if the app has been undeployed
// after this was serialized
if (container == null) {
- _ejbLogger.log(Level.WARNING, "ejb.base.io.EJBOutputStream.null_container "
- + debugStr);
- result = null;
- } else {
- // Note that we can assume it's a RemoteHome stub because an
- // application never sees a reference to the internal
- // Home for the Remote Business view.
- result = AbstractSerializableS1ASEJBReference.
- doRemoteRefClassLoaderConversion(container.getEJBHomeStub());
+ LOG.log(Level.WARNING, "ejb.base.io.null_container", containerId);
+ return null;
}
-
- return result;
+ // Note that we can assume it's a RemoteHome stub because an
+ // application never sees a reference to the internal
+ // Home for the Remote Business view.
+ return AbstractSerializableS1ASEJBReference.doRemoteRefClassLoaderConversion(container.getEJBHomeStub());
}
}
-final class SerializableS1ASEJBObjectReference
- extends AbstractSerializableS1ASEJBReference
-{
+
+final class SerializableS1ASEJBObjectReference extends AbstractSerializableS1ASEJBReference {
+ private static final long serialVersionUID = 1L;
private final byte[] instanceKey;
private Object sfsbKey;
private long sfsbClientVersion;
@@ -322,8 +258,7 @@
}
remoteBusinessInterface = remoteBusinessInterfaceName;
instanceKey = new byte[keySize];
- System.arraycopy(objKey, EJBObjectOutputStreamHandler.INSTANCEKEY_OFFSET,
- instanceKey, 0, keySize);
+ System.arraycopy(objKey, EJBObjectOutputStreamHandler.INSTANCEKEY_OFFSET, instanceKey, 0, keySize);
}
void setSFSBClientVersion(Object key, long val) {
@@ -336,63 +271,30 @@
}
@Override
- public Object createObject()
- throws IOException
- {
- Object result = null;
+ public Object createObject() throws IOException {
BaseContainer container = EjbContainerUtilImpl.getInstance().getContainer(containerId);
- //container can be null if the app has been undeployed
- // after this was serialized
+ //container can be null if the app has been undeployed after this was serialized
if (container == null) {
- _ejbLogger.log(Level.WARNING,
- "ejb.base.io.EJBOutputStream.null_container: "
- + debugStr);
- result = null;
- } else {
- try {
- if( remoteBusinessInterface == null ) {
- java.rmi.Remote reference = container.
- createRemoteReferenceWithId(instanceKey, null);
- result = AbstractSerializableS1ASEJBReference.
- doRemoteRefClassLoaderConversion(reference);
-
- } else {
-
- String generatedRemoteIntfName = RemoteGenerator.
- getGeneratedRemoteIntfName(remoteBusinessInterface);
-
- java.rmi.Remote remoteRef = container.
- createRemoteReferenceWithId(instanceKey,
- generatedRemoteIntfName);
-
- java.rmi.Remote newRemoteRef =
- AbstractSerializableS1ASEJBReference.
- doRemoteRefClassLoaderConversion(remoteRef);
-
-
- Thread currentThread = Thread.currentThread();
- ClassLoader contextClassLoader =
- currentThread.getContextClassLoader();
-
- result = EJBUtils.createRemoteBusinessObject
- (contextClassLoader, remoteBusinessInterface,
- newRemoteRef);
-
- }
- /*TODO
- if (haEnabled) {
- SFSBClientVersionManager.setClientVersion(
- containerId, sfsbKey, sfsbClientVersion);
- }*/
- } catch(Exception e) {
- IOException ioex = new IOException("remote ref create error");
- ioex.initCause(e);
- throw ioex;
- }
+ LOG.log(Level.WARNING, "ejb.base.io.null_container", containerId);
+ return null;
}
+ try {
+ if (remoteBusinessInterface == null) {
+ java.rmi.Remote reference = container.createRemoteReferenceWithId(instanceKey, null);
+ return AbstractSerializableS1ASEJBReference.doRemoteRefClassLoaderConversion(reference);
+ }
+ String generatedRemoteIntfName = RemoteGenerator.getGeneratedRemoteIntfName(remoteBusinessInterface);
+ java.rmi.Remote remoteRef = container.createRemoteReferenceWithId(instanceKey, generatedRemoteIntfName);
+ java.rmi.Remote newRemoteRef = AbstractSerializableS1ASEJBReference
+ .doRemoteRefClassLoaderConversion(remoteRef);
- return result;
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ return EJBUtils.createRemoteBusinessObject(contextClassLoader, remoteBusinessInterface, newRemoteRef);
+ } catch (Exception e) {
+ IOException ioex = new IOException("remote ref create error");
+ ioex.initCause(e);
+ throw ioex;
+ }
}
}
-
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/AsmSerializableBeanGenerator.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/AsmSerializableBeanGenerator.java
index ca099bb..a184973 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/AsmSerializableBeanGenerator.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/AsmSerializableBeanGenerator.java
@@ -1,6 +1,6 @@
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2021 Contributors to the Eclipse Foundation
+ * Copyright (c) 2021-2022 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -19,28 +19,27 @@
import java.io.Serializable;
import java.lang.reflect.Constructor;
-import java.lang.reflect.ReflectPermission;
import java.security.AccessController;
-import java.security.Permission;
import java.security.PrivilegedAction;
-import java.security.ProtectionDomain;
-
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.MethodVisitor;
-import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
-public class AsmSerializableBeanGenerator implements Opcodes {
+import static org.objectweb.asm.Opcodes.ACC_PRIVATE;
+import static org.objectweb.asm.Opcodes.ACC_PUBLIC;
+import static org.objectweb.asm.Opcodes.ALOAD;
+import static org.objectweb.asm.Opcodes.INVOKESPECIAL;
+import static org.objectweb.asm.Opcodes.INVOKESTATIC;
+import static org.objectweb.asm.Opcodes.RETURN;
+import static org.objectweb.asm.Opcodes.V11;
+
+public class AsmSerializableBeanGenerator {
private static final int INTF_FLAGS = ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES;
- private byte[] classData;
- private Class loadedClass;
private final ClassLoader loader;
-
- private final Class baseClass;
-
+ private final Class<?> baseClass;
private final String subclassName;
@@ -60,23 +59,15 @@
public AsmSerializableBeanGenerator(ClassLoader loader, Class baseClass, String serializableSubclassName) {
this.loader = loader;
this.baseClass = baseClass;
- subclassName = serializableSubclassName;
+ this.subclassName = serializableSubclassName;
}
public String getSerializableSubclassName() {
return subclassName;
}
- public Class generateSerializableSubclass()
- throws Exception {
- try {
- loadedClass = loader.loadClass(subclassName);
- return loadedClass;
- } catch(ClassNotFoundException e) {
- // Not loaded yet. Just continue
- }
-
+ public Class generateSerializableSubclass() throws Exception {
ClassWriter cw = new ClassWriter(INTF_FLAGS);
//ClassVisitor tv = //(_debug)
@@ -88,7 +79,7 @@
Type.getType(Serializable.class).getInternalName()
};
- tv.visit(V1_1, ACC_PUBLIC,
+ tv.visit(V11, ACC_PUBLIC,
subclassInternalName, null,
Type.getType(baseClass).getInternalName(), interfaces);
@@ -97,9 +88,9 @@
// JSR 299 added requirements that allow a single constructor to define
// parameters injected by CDI.
- Constructor[] ctors = baseClass.getConstructors();
- Constructor ctorWithParams = null;
- for(Constructor ctor : ctors) {
+ Constructor<?>[] ctors = baseClass.getConstructors();
+ Constructor<?> ctorWithParams = null;
+ for(Constructor<?> ctor : ctors) {
if(ctor.getParameterTypes().length == 0) {
ctorWithParams = null; //exists the no-arg ctor, use it
break;
@@ -111,27 +102,25 @@
int numArgsToPass = 1; // default is 1 to just handle 'this'
String paramTypeString = "()V";
- if( ctorWithParams != null ) {
- Class[] paramTypes = ctorWithParams.getParameterTypes();
+ if (ctorWithParams != null) {
+ Class<?>[] paramTypes = ctorWithParams.getParameterTypes();
numArgsToPass = paramTypes.length + 1;
paramTypeString = Type.getConstructorDescriptor(ctorWithParams);
}
MethodVisitor ctorv = tv.visitMethod(ACC_PUBLIC, "<init>", paramTypeString, null, null);
- for(int i = 0; i < numArgsToPass; i++) {
+ for (int i = 0; i < numArgsToPass; i++) {
ctorv.visitVarInsn(ALOAD, i);
}
-
- ctorv.visitMethodInsn(INVOKESPECIAL, Type.getType(baseClass).getInternalName(), "<init>",
- paramTypeString);
+ ctorv.visitMethodInsn(INVOKESPECIAL, Type.getType(baseClass).getInternalName(), "<init>", paramTypeString, false);
ctorv.visitInsn(RETURN);
ctorv.visitMaxs(numArgsToPass, numArgsToPass);
MethodVisitor cv = cw.visitMethod(ACC_PRIVATE, "writeObject", "(Ljava/io/ObjectOutputStream;)V", null, new String[] { "java/io/IOException" });
cv.visitVarInsn(ALOAD, 0);
cv.visitVarInsn(ALOAD, 1);
- cv.visitMethodInsn(INVOKESTATIC, "com/sun/ejb/EJBUtils", "serializeObjectFields", "(Ljava/lang/Object;Ljava/io/ObjectOutputStream;)V");
+ cv.visitMethodInsn(INVOKESTATIC, "com/sun/ejb/EJBUtils", "serializeObjectFields", "(Ljava/lang/Object;Ljava/io/ObjectOutputStream;)V", false);
cv.visitInsn(RETURN);
cv.visitMaxs(2, 2);
@@ -139,60 +128,16 @@
cv = cw.visitMethod(ACC_PRIVATE, "readObject", "(Ljava/io/ObjectInputStream;)V", null, new String[] { "java/io/IOException", "java/lang/ClassNotFoundException" });
cv.visitVarInsn(ALOAD, 0);
cv.visitVarInsn(ALOAD, 1);
- cv.visitMethodInsn(INVOKESTATIC, "com/sun/ejb/EJBUtils", "deserializeObjectFields", "(Ljava/lang/Object;Ljava/io/ObjectInputStream;)V");
+ cv.visitMethodInsn(INVOKESTATIC, "com/sun/ejb/EJBUtils", "deserializeObjectFields", "(Ljava/lang/Object;Ljava/io/ObjectInputStream;)V", false);
cv.visitInsn(RETURN);
cv.visitMaxs(2, 2);
tv.visitEnd();
- classData = cw.toByteArray();
+ byte[] classData = cw.toByteArray();
- loadedClass = (Class) java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
- @Override
- public java.lang.Object run() {
- return makeClass(subclassName, classData, baseClass.getProtectionDomain(), loader);
- }
- }
- );
-
- return loadedClass;
- }
-
- // A Method for the protected ClassLoader.defineClass method, which we access
- // using reflection. This requires the supressAccessChecks permission.
- private static final java.lang.reflect.Method defineClassMethod = AccessController.doPrivileged(
- new PrivilegedAction<java.lang.reflect.Method>() {
- @Override
- public java.lang.reflect.Method run() {
- try {
- java.lang.reflect.Method meth = ClassLoader.class.getDeclaredMethod(
- "defineClass", String.class,
- byte[].class, int.class, int.class,
- ProtectionDomain.class);
- meth.setAccessible(true);
- return meth;
- } catch (Exception exc) {
- throw new RuntimeException(
- "Could not find defineClass method!", exc ) ;
- }
- }
- }
- );
-
- private static final Permission accessControlPermission = new ReflectPermission("suppressAccessChecks");
-
- // This requires a permission check
- private Class<?> makeClass(String name, byte[] def, ProtectionDomain pd, ClassLoader loader) {
- SecurityManager sman = System.getSecurityManager() ;
- if (sman != null) {
- sman.checkPermission( accessControlPermission ) ;
- }
-
- try {
- return (Class) defineClassMethod.invoke(loader, name, def, 0, def.length, pd);
- } catch (Exception exc) {
- throw new RuntimeException("Could not invoke defineClass!", exc);
- }
+ PrivilegedAction<Class<?>> action = () -> ClassGenerator.defineClass(loader, subclassName, classData,
+ baseClass.getProtectionDomain());
+ return AccessController.doPrivileged(action);
}
}
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/ClassGenerator.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/ClassGenerator.java
new file mode 100644
index 0000000..14289c3
--- /dev/null
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/ClassGenerator.java
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2022 Eclipse Foundation and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package com.sun.ejb.codegen;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.security.AccessController;
+import java.security.PrivilegedExceptionAction;
+import java.security.ProtectionDomain;
+import java.util.logging.Logger;
+
+import static java.util.logging.Level.CONFIG;
+
+/**
+ * This class serves to generate classes, which cannot be generated by the
+ * {@link java.lang.invoke.MethodHandles.Lookup} class, because it restricts
+ * the generated class to use an already existing class as a source of the package
+ * and {@link ProtectionDomain}.
+ * <p>
+ * Also {@link Proxy#newProxyInstance(ClassLoader, Class[], java.lang.reflect.InvocationHandler)}
+ * has another requirements, ie. all referred classes must be loadable by used classloader.
+ *
+ * @author David Matejcek
+ */
+public final class ClassGenerator {
+
+ private static final Logger LOG = Logger.getLogger(ClassGenerator.class.getName());
+ private static Method defineClassMethod;
+ private static Method defineClassMethodSM;
+
+ static {
+ try {
+ final PrivilegedExceptionAction<Void> action = () -> {
+ final Class<?> cl = Class.forName("java.lang.ClassLoader");
+ final String name = "defineClass";
+ defineClassMethod = cl.getDeclaredMethod(name, String.class, byte[].class, int.class, int.class);
+ defineClassMethod.setAccessible(true);
+ defineClassMethodSM = cl.getDeclaredMethod(
+ name, String.class, byte[].class, int.class, int.class, ProtectionDomain.class);
+ defineClassMethodSM.setAccessible(true);
+ return null;
+ };
+ AccessController.doPrivileged(action);
+ LOG.config("ClassLoader methods capable of generating classes were successfully detected.");
+ } catch (final Exception e) {
+ throw new Error("Could not initialize access to ClassLoader.defineClass method.", e);
+ }
+ }
+
+
+ private ClassGenerator() {
+ // hidden
+ }
+
+
+ /**
+ * Calls the {@link ClassLoader}'s protected defineClass method to create a new class
+ *
+ * @param loader the classloader instance used to generate the class
+ * @param className expected binary name or null
+ * @param classData the valid bytes that make up the class data.
+ * @return the new generated class
+ * @throws ClassDefinitionException invalid data, missing dependency, or another error related
+ * to the class generation
+ */
+ public static Class<?> defineClass(final ClassLoader loader, final String className, final byte[] classData)
+ throws ClassDefinitionException {
+ return defineClass(loader, className, classData, 0, classData.length);
+ }
+
+
+ /**
+ * Calls the {@link ClassLoader}'s protected defineClass method to create a new class
+ *
+ * @param loader the classloader instance used to generate the class
+ * @param className expected binary name or null
+ * @param classData the valid bytes that make up the class data.
+ * @param offset The start offset in {@code b} of the class data
+ * @param length The length of the class data
+ * @return the new generated class
+ * @throws ClassDefinitionException invalid data, missing dependency, or another error related
+ * to the class generation
+ */
+ public static Class<?> defineClass(
+ final ClassLoader loader, final String className,
+ final byte[] classData, final int offset, final int length) throws ClassDefinitionException {
+ LOG.log(CONFIG, "Defining class: {0} by loader: {1}", new Object[] {className, loader});
+ try {
+ return (Class<?>) defineClassMethod.invoke(loader, className, classData, 0, length);
+ } catch (final Exception | NoClassDefFoundError | ClassFormatError e) {
+ throw new ClassDefinitionException(className, loader, e);
+ }
+ }
+
+
+ /**
+ * Calls the {@link ClassLoader}'s protected defineClass method to create a new class
+ *
+ * @param loader the classloader instance used to generate the class
+ * @param className expected binary name or null
+ * @param classData the valid bytes that make up the class data.
+ * @param protectionDomain The {@code ProtectionDomain} of the class
+ * @return the new generated class
+ * @throws ClassDefinitionException invalid data, missing dependency, or another error related
+ * to the class generation
+ */
+ public static Class<?> defineClass(final ClassLoader loader, final String className, final byte[] classData,
+ final ProtectionDomain protectionDomain) throws ClassDefinitionException {
+ return defineClass(loader, className, classData, 0, classData.length, protectionDomain);
+ }
+
+
+ /**
+ * Calls the {@link ClassLoader}'s protected defineClass method to create a new class
+ *
+ * @param loader the classloader instance used to generate the class
+ * @param className expected binary name or null
+ * @param classData the valid bytes that make up the class data.
+ * @param offset The start offset in {@code b} of the class data
+ * @param length The length of the class data
+ * @param protectionDomain The {@code ProtectionDomain} of the class
+ * @return the new generated class
+ * @throws ClassDefinitionException invalid data, missing dependency, or another error related
+ * to the class generation
+ */
+ public static Class<?> defineClass(
+ final ClassLoader loader, final String className,
+ final byte[] classData, final int offset, final int length,
+ final ProtectionDomain protectionDomain) throws ClassDefinitionException {
+ LOG.log(CONFIG, "Defining class: {0} by loader: {1}", new Object[] {className, loader});
+ try {
+ return (Class<?>) defineClassMethodSM.invoke(loader, className, classData, 0, length, protectionDomain);
+ } catch (final Exception | NoClassDefFoundError | ClassFormatError e) {
+ throw new ClassDefinitionException(className, loader, e);
+ }
+ }
+
+
+ /**
+ * The class wasn't generated. See the message and cause to see what happened.
+ */
+ public static class ClassDefinitionException extends RuntimeException {
+ private static final long serialVersionUID = -8955780830818904365L;
+
+ ClassDefinitionException(final String className, final ClassLoader loader, final Throwable cause) {
+ super("Could not define class '" + className + "' by the class loader: " + loader, cause);
+ }
+ }
+}
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/ClassGeneratorFactory.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/ClassGeneratorFactory.java
deleted file mode 100644
index 84a1263..0000000
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/ClassGeneratorFactory.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2021 Contributors to the Eclipse Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-package com.sun.ejb.codegen;
-
-import org.glassfish.pfl.dynamic.codegen.spi.Wrapper;
-
-/**
- * Convenience interface that defines a factory for ClassGenerator instances.
- * It puts the class name of the generated class in a single place.
- */
-public interface ClassGeneratorFactory {
-
- /**
- * @return name of the generated class or interface
- */
- String getGeneratedClassName();
-
- /**
- * @return loadable class of the same package as {@link #getGeneratedClassName()}
- */
- Class<?> getAnchorClass();
-
- /**
- * Calls {@link Wrapper} methods to configure the class definition.
- */
- void evaluate();
-}
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/EjbClassGeneratorFactory.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/EjbClassGeneratorFactory.java
new file mode 100644
index 0000000..48123ec
--- /dev/null
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/EjbClassGeneratorFactory.java
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2022 Eclipse Foundation and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package com.sun.ejb.codegen;
+
+import java.util.Objects;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.glassfish.pfl.dynamic.codegen.spi.Type;
+
+import static java.util.logging.Level.FINE;
+import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper._clear;
+import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper._setClassLoader;
+
+/**
+ * @author David Matejcek
+ */
+public class EjbClassGeneratorFactory implements AutoCloseable {
+ private static final Logger LOG = Logger.getLogger(EjbClassGeneratorFactory.class.getName());
+
+ private final ClassLoader loader;
+
+ public EjbClassGeneratorFactory(final ClassLoader loader) {
+ this.loader = loader;
+ // WARN: Calls also org.glassfish.pfl.dynamic.codegen.spi.Type.clearCaches() which
+ // makes them inaccessible for some classloader implementations (and for
+ // some classloaders it means they will be reloaded.
+ _setClassLoader(loader);
+ }
+
+ /**
+ * @return {@link ClassLoader} owning the generated class.
+ */
+ protected ClassLoader getClassLoader() {
+ return this.loader;
+ }
+
+
+ public Class<?> ensureGenericHome(final Class<?> anchorClass) throws GeneratorException {
+ GenericHomeGenerator generator = new GenericHomeGenerator(loader, anchorClass);
+ Class<?> clazz = loadClassIgnoringExceptions(loader, generator.getGeneratedClassName());
+ if (clazz != null) {
+ return clazz;
+ }
+ return generate(generator);
+ }
+
+
+ public Class<?> ensureServiceInterface(Class<?> ejbClass) throws GeneratorException {
+ ServiceInterfaceGenerator generator = new ServiceInterfaceGenerator(loader, ejbClass);
+ Class<?> clazz = loadClassIgnoringExceptions(loader, generator.getGeneratedClassName());
+ if (clazz != null) {
+ return clazz;
+ }
+ return generate(generator);
+ }
+
+
+ /**
+ * The generated remote business interface and the client wrapper
+ * for the business interface are produced dynamically.
+ * This call must be made before any EJB 3.0 Remote business interface
+ * runtime behavior is needed for a particular classloader.
+ */
+ public Class<?> ensureRemote(String businessInterfaceName) throws GeneratorException {
+ String generatedRemoteIntfName = RemoteGenerator.getGeneratedRemoteIntfName(businessInterfaceName);
+ String wrapperClassName = Remote30WrapperGenerator.getGeneratedRemoteWrapperName(businessInterfaceName);
+ Class<?> foundRemoteIntf = loadClassIgnoringExceptions(loader, generatedRemoteIntfName);
+ Class<?> foundRemoteWrapper = loadClassIgnoringExceptions(loader, wrapperClassName);
+ if (foundRemoteIntf != null && foundRemoteWrapper != null) {
+ return foundRemoteIntf;
+ }
+ final Class<?> remoteIntf;
+ if (foundRemoteIntf == null) {
+ RemoteGenerator generator = new RemoteGenerator(loader, businessInterfaceName);
+ remoteIntf = generate(generator);
+ } else {
+ remoteIntf = foundRemoteIntf;
+ }
+ if (foundRemoteWrapper == null) {
+ Remote30WrapperGenerator generator
+ = new Remote30WrapperGenerator(loader, businessInterfaceName, generatedRemoteIntfName);
+ generate(generator);
+ }
+ return remoteIntf;
+ }
+
+
+ private Class<?> generate(Generator generator) throws GeneratorException {
+ // if more threads use the same classloader and same classes, we don't want
+ // to allow any collisions.
+ synchronized (loader) {
+ // Other implementations don't clear after themselves, so we have to do it.
+ _clear();
+ Class<?> clazz = loadClassIgnoringExceptions(loader, generator.getGeneratedClassName());
+ if (clazz != null) {
+ return clazz;
+ }
+ final ClassLoader origClassLoader = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(getClassLoader());
+ final Class<?> generatedClass = generator.generate();
+ LOG.log(Level.CONFIG, "Generated class: {0} by generator: {1}",
+ new Object[] {generatedClass, generator});
+
+ // Some classloaders don't remember generated classes (ie. ASURLClassLoader used by EJB clients)
+ // Type has an internal cache. Otherwise it would try to load the class and fail.
+ Objects.requireNonNull(Type.type(generatedClass));
+ return generatedClass;
+ } catch (IllegalAccessException | RuntimeException e) {
+ throw new GeneratorException("Generator failed: " + generator, e);
+ } finally {
+ _clear();
+ Thread.currentThread().setContextClassLoader(origClassLoader);
+ }
+ }
+ }
+
+
+ @Override
+ public void close() {
+ _setClassLoader(null);
+ }
+
+
+ private static Class<?> loadClassIgnoringExceptions(ClassLoader classLoader, String className) {
+ try {
+ return classLoader.loadClass(className);
+ } catch (ClassNotFoundException e) {
+ LOG.log(FINE, "Could not load class: " + className + " by classloader " + classLoader, e);
+ return null;
+ }
+ }
+
+
+}
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/EjbOptionalIntfGenerator.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/EjbOptionalIntfGenerator.java
index 27788be..862a30d 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/EjbOptionalIntfGenerator.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/EjbOptionalIntfGenerator.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -16,40 +17,58 @@
package com.sun.ejb.codegen;
+import com.sun.ejb.spi.container.OptionalLocalInterfaceProvider;
import com.sun.enterprise.container.common.spi.util.IndirectlySerializable;
import com.sun.enterprise.container.common.spi.util.SerializableObjectFactory;
-import com.sun.ejb.spi.container.OptionalLocalInterfaceProvider;
-import org.objectweb.asm.*;
-import org.objectweb.asm.commons.GeneratorAdapter;
-import org.objectweb.asm.commons.Method;
+import com.sun.enterprise.deployment.util.TypeUtil;
+import java.io.Serializable;
import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;
-import java.lang.reflect.ReflectPermission;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Set;
-import java.io.Serializable;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.ProtectionDomain;
-import java.security.Permission;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
-import com.sun.enterprise.deployment.util.TypeUtil;
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.ClassWriter;
+import org.objectweb.asm.FieldVisitor;
+import org.objectweb.asm.MethodVisitor;
+import org.objectweb.asm.Type;
+import org.objectweb.asm.commons.GeneratorAdapter;
+import org.objectweb.asm.commons.Method;
-public class EjbOptionalIntfGenerator
- implements Opcodes {
+import static org.objectweb.asm.Opcodes.ACC_ABSTRACT;
+import static org.objectweb.asm.Opcodes.ACC_INTERFACE;
+import static org.objectweb.asm.Opcodes.ACC_PRIVATE;
+import static org.objectweb.asm.Opcodes.ACC_PUBLIC;
+import static org.objectweb.asm.Opcodes.ACONST_NULL;
+import static org.objectweb.asm.Opcodes.ALOAD;
+import static org.objectweb.asm.Opcodes.ARETURN;
+import static org.objectweb.asm.Opcodes.CHECKCAST;
+import static org.objectweb.asm.Opcodes.DUP;
+import static org.objectweb.asm.Opcodes.GETFIELD;
+import static org.objectweb.asm.Opcodes.INVOKEINTERFACE;
+import static org.objectweb.asm.Opcodes.INVOKESPECIAL;
+import static org.objectweb.asm.Opcodes.INVOKESTATIC;
+import static org.objectweb.asm.Opcodes.INVOKEVIRTUAL;
+import static org.objectweb.asm.Opcodes.NEW;
+import static org.objectweb.asm.Opcodes.PUTFIELD;
+import static org.objectweb.asm.Opcodes.RETURN;
+import static org.objectweb.asm.Opcodes.V11;
+
+public class EjbOptionalIntfGenerator {
private static final int INTF_FLAGS = ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES;
private static final String DELEGATE_FIELD_NAME = "__ejb31_delegate";
- private static final Class[] emptyClassArray = new Class[] {};
+ private final Map<String, byte[]> classMap = new HashMap<>();
- private Map<String, byte[]> classMap = new HashMap<String, byte[]>();
-
- private ClassLoader loader;
+ private final ClassLoader loader;
private ProtectionDomain protectionDomain;
@@ -57,34 +76,22 @@
this.loader = loader;
}
- public Class loadClass(final String name)
- throws ClassNotFoundException
- {
- Class clz = null;
+ public Class loadClass(final String name) throws ClassNotFoundException {
+ Class clz = null;
try {
clz = loader.loadClass(name);
- } catch(ClassNotFoundException cnfe) {
-
- final byte[] classData = (byte []) classMap.get(name);
-
+ } catch (ClassNotFoundException cnfe) {
+ final byte[] classData = classMap.get(name);
if (classData != null) {
-
- clz = (Class) java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
- public java.lang.Object run() {
- return makeClass(name, classData, protectionDomain, loader);
- }
- }
- );
+ PrivilegedAction<Class<?>> action = () -> ClassGenerator.defineClass(loader, name, classData,
+ protectionDomain);
+ clz = AccessController.doPrivileged(action);
}
}
-
- if( clz == null ) {
-
+ if (clz == null) {
throw new ClassNotFoundException(name);
}
-
return clz;
}
@@ -100,17 +107,15 @@
interfaceNames[i] = Type.getType(interfaces[i]).getInternalName();
}
- if( protectionDomain == null ) {
+ if (protectionDomain == null) {
protectionDomain = ejbClass.getProtectionDomain();
}
ClassWriter cw = new ClassWriter(INTF_FLAGS);
-// ClassVisitor tv = (_debug)
-// ? new TraceClassVisitor(cw, new PrintWriter(System.out)) : cw;
ClassVisitor tv = cw;
String intfInternalName = intfClassName.replace('.', '/');
- tv.visit(V1_1, ACC_PUBLIC + ACC_ABSTRACT + ACC_INTERFACE,
+ tv.visit(V11, ACC_PUBLIC + ACC_ABSTRACT + ACC_INTERFACE,
intfInternalName, null,
Type.getType(Object.class).getInternalName(),
interfaceNames );
@@ -153,26 +158,22 @@
return sameSignature;
}
- public void generateOptionalLocalInterfaceSubClass(Class superClass, String subClassName,
- Class delegateClass)
- throws Exception {
+ public void generateOptionalLocalInterfaceSubClass(Class superClass, String subClassName, Class delegateClass)
+ throws Exception {
generateSubclass(superClass, subClassName, delegateClass, IndirectlySerializable.class);
}
+
public void generateSubclass(Class superClass, String subClassName, Class delegateClass, Class... interfaces)
- throws Exception {
-
-
- if( protectionDomain == null ) {
+ throws Exception {
+ if (protectionDomain == null) {
protectionDomain = superClass.getProtectionDomain();
}
ClassWriter cw = new ClassWriter(INTF_FLAGS);
- ClassVisitor tv = cw;
-// ClassVisitor tv = (_debug)
-// ? new TraceClassVisitor(cw, new PrintWriter(System.out)) : cw;
+ ClassVisitor tv = cw;
String[] interfaceNames = new String[interfaces.length + 1];
interfaceNames[0] = OptionalLocalInterfaceProvider.class.getName().replace('.', '/');
@@ -180,7 +181,7 @@
interfaceNames[i+1] = interfaces[i].getName().replace('.', '/');
}
- tv.visit(V1_1, ACC_PUBLIC, subClassName.replace('.', '/'), null,
+ tv.visit(V11, ACC_PUBLIC, subClassName.replace('.', '/'), null,
Type.getType(superClass).getInternalName(), interfaceNames);
String fldDesc = Type.getDescriptor(delegateClass);
@@ -196,12 +197,12 @@
Constructor[] ctors = superClass.getConstructors();
Constructor ctorWithParams = null;
for(Constructor ctor : ctors) {
- if(ctor.getParameterTypes().length == 0) {
- ctorWithParams = null; //exists the no-arg ctor, use it
- break;
- } else if(ctorWithParams == null) {
- ctorWithParams = ctor;
- }
+ if(ctor.getParameterTypes().length == 0) {
+ ctorWithParams = null; //exists the no-arg ctor, use it
+ break;
+ } else if(ctorWithParams == null) {
+ ctorWithParams = ctor;
+ }
}
MethodVisitor cv = tv.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
@@ -209,17 +210,16 @@
String paramTypeString = "()V";
// if void, only one param (implicit 'this' param)
int maxValue = 1;
- if( ctorWithParams != null ) {
- Class[] paramTypes = ctorWithParams.getParameterTypes();
- for(int i = 0; i < paramTypes.length; i++) {
- cv.visitInsn(ACONST_NULL);
+ if (ctorWithParams != null) {
+ Class[] paramTypes = ctorWithParams.getParameterTypes();
+ for (Class paramType : paramTypes) {
+ cv.visitInsn(ACONST_NULL);
+ }
+ paramTypeString = Type.getConstructorDescriptor(ctorWithParams);
+ // num params + one for 'this' pointer
+ maxValue = paramTypes.length + 1;
}
- paramTypeString = Type.getConstructorDescriptor(ctorWithParams);
- // num params + one for 'this' pointer
- maxValue = paramTypes.length + 1;
- }
- cv.visitMethodInsn(INVOKESPECIAL, Type.getType(superClass).getInternalName(), "<init>",
- paramTypeString);
+ cv.visitMethodInsn(INVOKESPECIAL, Type.getType(superClass).getInternalName(), "<init>", paramTypeString);
cv.visitInsn(RETURN);
cv.visitMaxs(maxValue, 1);
}
@@ -244,7 +244,7 @@
}
- Set<java.lang.reflect.Method> allMethods = new HashSet<java.lang.reflect.Method>();
+ Set<java.lang.reflect.Method> allMethods = new HashSet<>();
for (java.lang.reflect.Method m : superClass.getMethods()) {
if (qualifiedAsBeanMethod(m)) {
@@ -274,8 +274,7 @@
// add toString() method if it was not overridden
java.lang.reflect.Method mth = Object.class.getDeclaredMethod("toString");
- if( !hasSameSignatureAsExisting(mth, allMethods)) {
- //generateBeanMethod(tv, subClassName, mth, delegateClass);
+ if (!hasSameSignatureAsExisting(mth, allMethods)) {
generateToStringBeanMethod(tv, superClass);
}
@@ -419,39 +418,4 @@
mg2.returnValue();
mg2.endMethod();
}
-
- // A Method for the protected ClassLoader.defineClass method, which we access
- // using reflection. This requires the supressAccessChecks permission.
- private static final java.lang.reflect.Method defineClassMethod = AccessController.doPrivileged(
- new PrivilegedAction<java.lang.reflect.Method>() {
- public java.lang.reflect.Method run() {
- try {
- java.lang.reflect.Method meth = ClassLoader.class.getDeclaredMethod(
- "defineClass", String.class,
- byte[].class, int.class, int.class,
- ProtectionDomain.class ) ;
- meth.setAccessible( true ) ;
- return meth ;
- } catch (Exception exc) {
- throw new RuntimeException(
- "Could not find defineClass method!", exc ) ;
- }
- }
- }
- );
-
- private static final Permission accessControlPermission = new ReflectPermission("suppressAccessChecks");
-
- // This requires a permission check
- private Class<?> makeClass(String name, byte[] def, ProtectionDomain pd, ClassLoader loader) {
- SecurityManager sman = System.getSecurityManager();
- if (sman != null) {
- sman.checkPermission(accessControlPermission);
- }
- try {
- return (Class) defineClassMethod.invoke(loader, name, def, 0, def.length, pd);
- } catch (Exception exc) {
- throw new RuntimeException("Could not invoke defineClass!", exc);
- }
- }
}
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/Generator.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/Generator.java
index 63c52a8..6acfb2f 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/Generator.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/Generator.java
@@ -1,6 +1,6 @@
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2021 Contributors to the Eclipse Foundation
+ * Copyright (c) 2021-2022 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -17,29 +17,158 @@
package com.sun.ejb.codegen;
+import com.sun.enterprise.loader.ASURLClassLoader;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodHandles.Lookup;
import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.glassfish.pfl.dynamic.codegen.impl.ClassGeneratorImpl;
+import org.glassfish.pfl.dynamic.codegen.spi.ImportList;
+import org.glassfish.pfl.dynamic.codegen.spi.Wrapper;
+
+import static org.glassfish.pfl.dynamic.codegen.impl.CodeGenerator.generateBytecode;
+import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper.DUMP_AFTER_SETUP_VISITOR;
+import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper.TRACE_BYTE_CODE_GENERATION;
+import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper.USE_ASM_VERIFIER;
+import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper._classGenerator;
+import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper._package;
/**
* The base class for all code generators.
*/
-public abstract class Generator implements ClassGeneratorFactory {
+public abstract class Generator {
+ private static final Logger LOG = Logger.getLogger(Generator.class.getName());
+
+ private final ClassLoader loader;
+
+
+ /**
+ * @param loader {@link ClassLoader} owning generated classes
+ */
+ public Generator(final ClassLoader loader) {
+ this.loader = Objects.requireNonNull(loader);
+ }
+
+ /**
+ * @return the name of the package of the generated class. Can be null.
+ */
+ protected abstract String getPackageName();
+
+ /**
+ * @return name of the generated class or interface
+ */
+ public abstract String getGeneratedClassName();
+
+ /**
+ * @return loadable class of the same package as {@link #getGeneratedClassName()}
+ */
+ protected abstract Class<?> getAnchorClass();
+
+ /**
+ * Calls {@link Wrapper} methods to configure the class definition.
+ * The {@link Wrapper} uses {@link ThreadLocal} internally, so you should
+ * always call {@link Wrapper#_clear()} in finally block after generation
+ * to avoid leakages.
+ */
+ protected abstract void defineClassBody();
+
+
+ /**
+ * @return {@link ClassLoader} owning the generated class.
+ */
+ public ClassLoader getClassLoader() {
+ return this.loader;
+ }
+
+
+ /**
+ * Generates the bytecode of the configured class with the usage of the PFL tool.
+ * Then uses {@link MethodHandles} or {@link ClassGenerator} to generate the class.
+ * <p>
+ * WARNING: This selection depends on the classloader capabilities and JVM rules,
+ * which change between JDK versions.
+ *
+ * @return {@link Class}
+ * @throws IllegalAccessException
+ */
+ public Class<?> generate() throws IllegalAccessException {
+ if (getPackageName() == null) {
+ _package();
+ } else {
+ _package(getPackageName());
+ }
+ final ImportList imports = Wrapper._import();
+ defineClassBody();
+ final Properties props = new Properties();
+ if (LOG.isLoggable(Level.FINEST)) {
+ props.put(DUMP_AFTER_SETUP_VISITOR, "true");
+ props.put(TRACE_BYTE_CODE_GENERATION, "true");
+ props.put(USE_ASM_VERIFIER, "true");
+ try {
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ final PrintStream ps = new PrintStream(baos);
+ Wrapper._sourceCode(ps, props);
+ LOG.finest(baos.toString());
+ } catch (final Exception e) {
+ LOG.log(Level.WARNING, "Exception generating src for logs", e);
+ }
+ }
+
+ final ClassGeneratorImpl codeGenerator = (ClassGeneratorImpl) _classGenerator();
+ final byte[] bytecode = generateBytecode(codeGenerator, getClassLoader(), imports, props, System.out);
+
+ if (useMethodHandles()) {
+ LOG.log(Level.FINEST, "Using MethodHandles to define {0}, anchorClass: {1}",
+ new Object[] {getGeneratedClassName(), getAnchorClass()});
+ final Lookup lookup = MethodHandles.privateLookupIn(getAnchorClass(), MethodHandles.lookup());
+ return lookup.defineClass(bytecode);
+ }
+
+ if (System.getSecurityManager() == null) {
+ return ClassGenerator.defineClass(getClassLoader(), getGeneratedClassName(), bytecode,
+ getAnchorClass().getProtectionDomain());
+ }
+ final PrivilegedAction<Class<?>> action = () -> ClassGenerator.defineClass(getClassLoader(),
+ getGeneratedClassName(), bytecode);
+ return AccessController.doPrivileged(action);
+ }
+
+
+ private boolean useMethodHandles() {
+ // The bootstrap CL used by embedded glassfish doesn't remember generated classes
+ // Further ClassLoader.findClass calls will fail.
+ if (loader.getParent() == null || loader.getClass() == ASURLClassLoader.class) {
+ return false;
+ }
+ return Objects.equals(getPackageName(), getAnchorClass().getPackageName());
+ }
+
/**
* @return the package name or null.
*/
- public static String getPackageName(String fullClassName) {
- int dot = fullClassName.lastIndexOf('.');
+ public static String getPackageName(final String fullClassName) {
+ final int dot = fullClassName.lastIndexOf('.');
return dot == -1 ? null : fullClassName.substring(0, dot);
}
/**
* @return simple class name (including wrapper class and dollar sign if it is internal class)
*/
- public static String getBaseName(String fullClassName) {
- int dot = fullClassName.lastIndexOf('.');
+ public static String getBaseName(final String fullClassName) {
+ final int dot = fullClassName.lastIndexOf('.');
return dot == -1 ? fullClassName : fullClassName.substring(dot + 1);
}
@@ -56,12 +185,12 @@
* @param methods
* @return methods which can be generated in an interface
*/
- protected Method[] removeRedundantMethods(Method[] methods) {
+ protected Method[] removeRedundantMethods(final Method[] methods) {
final List<Method> nodups = new ArrayList<>();
- for (Method method : methods) {
+ for (final Method method : methods) {
boolean duplicationDetected = false;
final List<Method> previousResult = new ArrayList<>(nodups);
- for (Method alreadyProcessed : previousResult) {
+ for (final Method alreadyProcessed : previousResult) {
// m1 and m2 are duplicates if they have the same signature
// (name and same parameters).
if (!method.getName().equals(alreadyProcessed.getName())) {
@@ -93,8 +222,8 @@
private boolean haveSameParams(final Method method1, final Method method2) {
- Class<?>[] m1parms = method1.getParameterTypes();
- Class<?>[] m2parms = method2.getParameterTypes();
+ final Class<?>[] m1parms = method1.getParameterTypes();
+ final Class<?>[] m2parms = method2.getParameterTypes();
if (m1parms.length != m2parms.length) {
return false;
}
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/GeneratorException.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/GeneratorException.java
index cdcf97f..b89bbc6 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/GeneratorException.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/GeneratorException.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -22,14 +23,27 @@
*/
public class GeneratorException extends java.lang.Exception {
+ private static final long serialVersionUID = -6932740662092591668L;
+
+
/**
* Constructs the Generator exception with the specified string.
*
- * @param the string description
+ * @param message string description
*/
- public GeneratorException(String s) {
- super(s);
- this.reason = s;
+ public GeneratorException(String message) {
+ super(message);
+ }
+
+
+ /**
+ * Constructs the Generator exception with the specified string.
+ *
+ * @param message string description
+ * @param cause exception which caused the failure
+ */
+ public GeneratorException(String message, Exception cause) {
+ super(message, cause);
}
@@ -40,11 +54,6 @@
*/
@Override
public String toString() {
- return reason;
+ return getMessage();
}
-
- /**
- * @serial XXX needs doc
- */
- private final String reason;
}
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/GenericHomeGenerator.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/GenericHomeGenerator.java
index 789dc91..2da65d5 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/GenericHomeGenerator.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/GenericHomeGenerator.java
@@ -1,6 +1,6 @@
/*
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2021 Contributors to the Eclipse Foundation
+ * Copyright (c) 2021-2022 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -26,12 +26,9 @@
import static java.lang.reflect.Modifier.PUBLIC;
import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper._String;
import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper._arg;
-import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper._classGenerator;
-import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper._clear;
import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper._end;
import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper._interface;
import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper._method;
-import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper._package;
import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper._t;
/**
@@ -41,11 +38,26 @@
*/
public class GenericHomeGenerator extends Generator {
+ public static final String GENERIC_HOME_CLASSNAME = "GenericEJBHome_Generated";
+ private final Class<?> anchorClass;
+ private final String packageName;
+
/**
- * This class name is relative to the classloader used, but has always the same name.
+ * @param loader {@link ClassLoader} owning generated classes
+ * @param anchorClass
*/
- public static final String GENERIC_HOME_CLASSNAME = GenericHomeGenerator.class.getPackageName()
- + ".GenericEJBHome_Generated";
+ public GenericHomeGenerator(final ClassLoader loader, final Class<?> anchorClass) {
+ super(loader);
+ this.anchorClass = anchorClass;
+ this.packageName = getClass().getPackageName();
+ }
+
+
+ @Override
+ public String getPackageName() {
+ return this.packageName;
+ }
+
/**
* Get the fully qualified name of the generated class.
@@ -53,34 +65,21 @@
*/
@Override
public final String getGeneratedClassName() {
- return GENERIC_HOME_CLASSNAME;
+ return packageName + "." + GENERIC_HOME_CLASSNAME;
}
@Override
public Class<?> getAnchorClass() {
- return GenericHomeGenerator.class;
+ return this.anchorClass;
}
@Override
- public void evaluate() {
- _clear();
-
- String packageName = getPackageName(getGeneratedClassName());
- String simpleName = getBaseName(getGeneratedClassName());
-
- _package(packageName);
-
- _interface(PUBLIC, simpleName, _t(GenericEJBHome.class.getName()));
-
+ public void defineClassBody() {
+ _interface(PUBLIC, GENERIC_HOME_CLASSNAME, _t(GenericEJBHome.class.getName()));
_method(PUBLIC | ABSTRACT, _t(Remote.class.getName()), "create", _t(RemoteException.class.getName()));
-
_arg(_String(), "generatedBusinessIntf");
-
_end();
-
- _classGenerator() ;
}
-
}
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/InvalidBean.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/InvalidBean.java
deleted file mode 100644
index 5e431f2..0000000
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/InvalidBean.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-package com.sun.ejb.codegen;
-
-public class InvalidBean extends GeneratorException {
-
- /**
- * Constructs the InvalidBean exception with the specified string.
- */
- public InvalidBean(String s) {
- super(s);
- }
-}
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/MethodNotFound.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/MethodNotFound.java
index cd2921b..b27905e 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/MethodNotFound.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/MethodNotFound.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -18,10 +19,12 @@
public class MethodNotFound extends GeneratorException {
+ private static final long serialVersionUID = -5823170654151164530L;
+
/**
* Constructs the MethodNotFound exception with the specified string.
*/
- public MethodNotFound(String s) {
- super(s);
+ public MethodNotFound(String message) {
+ super(message);
}
}
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/Remote30WrapperGenerator.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/Remote30WrapperGenerator.java
index c90f20a..f84f935 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/Remote30WrapperGenerator.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/Remote30WrapperGenerator.java
@@ -1,6 +1,6 @@
/*
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2021 Contributors to the Eclipse Foundation
+ * Copyright (c) 2021-2022 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -22,6 +22,15 @@
import com.sun.ejb.containers.RemoteBusinessWrapperBase;
import com.sun.enterprise.util.LocalStringManagerImpl;
+import jakarta.ejb.EJBAccessException;
+import jakarta.ejb.EJBException;
+import jakarta.ejb.EJBObject;
+import jakarta.ejb.EJBTransactionRequiredException;
+import jakarta.ejb.EJBTransactionRolledbackException;
+import jakarta.ejb.NoSuchEJBException;
+import jakarta.transaction.TransactionRequiredException;
+import jakarta.transaction.TransactionRolledbackException;
+
import java.lang.reflect.Method;
import java.rmi.AccessException;
import java.rmi.NoSuchObjectException;
@@ -29,30 +38,21 @@
import java.rmi.RemoteException;
import java.util.LinkedList;
import java.util.List;
-import java.util.Properties;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
import org.glassfish.pfl.dynamic.codegen.spi.Expression;
import org.glassfish.pfl.dynamic.codegen.spi.Type;
import org.omg.CORBA.SystemException;
-import jakarta.ejb.EJBAccessException;
-import jakarta.ejb.EJBException;
-import jakarta.ejb.EJBTransactionRequiredException;
-import jakarta.ejb.EJBTransactionRolledbackException;
-import jakarta.ejb.NoSuchEJBException;
-import jakarta.transaction.TransactionRequiredException;
-import jakarta.transaction.TransactionRolledbackException;
-
import static java.lang.reflect.Modifier.PRIVATE;
import static java.lang.reflect.Modifier.PUBLIC;
import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper.*;
+
+/**
+ * Generator of EJB 3.0+ Remote client stub implementations.
+ */
public final class Remote30WrapperGenerator extends Generator {
- private static final LocalStringManagerImpl localStrings = new LocalStringManagerImpl(Remote30WrapperGenerator.class);
- private static final Logger LOG = Logger.getLogger(Remote30WrapperGenerator.class.getName());
+ private static final LocalStringManagerImpl I18N = new LocalStringManagerImpl(Remote30WrapperGenerator.class);
private final String remoteInterfaceName;
private final Class<?> businessInterface;
@@ -61,18 +61,16 @@
private final String remoteClientSimpleName;
private final Method[] methodsToGenerate;
- private final ClassLoader loader;
-
-
/**
* Adds _Wrapper to the original name.
*
* @param businessIntf full class name
+ * @return [businessIntf]_Wrapper
*/
- public static String getGeneratedRemoteWrapperName(String businessIntf) {
- String packageName = getPackageName(businessIntf);
- String simpleName = getBaseName(businessIntf);
- String generatedSimpleName = "_" + simpleName + "_Wrapper";
+ public static String getGeneratedRemoteWrapperName(final String businessIntf) {
+ final String packageName = getPackageName(businessIntf);
+ final String simpleName = getBaseName(businessIntf);
+ final String generatedSimpleName = "_" + simpleName + "_Wrapper";
return packageName == null ? generatedSimpleName : packageName + "." + generatedSimpleName;
}
@@ -86,23 +84,23 @@
*
* @throws GeneratorException
*/
- public Remote30WrapperGenerator(ClassLoader loader, String businessIntfName, String remoteInterfaceName)
+ public Remote30WrapperGenerator(final ClassLoader loader, final String businessIntfName, final String remoteInterfaceName)
throws GeneratorException {
- this.loader = loader;
+ super(loader);
this.remoteInterfaceName = remoteInterfaceName;
try {
businessInterface = loader.loadClass(businessIntfName);
- } catch (ClassNotFoundException ex) {
- throw new InvalidBean(localStrings.getLocalString(
+ } catch (final ClassNotFoundException ex) {
+ throw new GeneratorException(I18N.getLocalString(
"generator.remote_interface_not_found",
"Business interface " + businessIntfName + " not found "));
}
- if (jakarta.ejb.EJBObject.class.isAssignableFrom(businessInterface)) {
+ if (EJBObject.class.isAssignableFrom(businessInterface)) {
throw new GeneratorException("Invalid Remote Business Interface " + businessInterface
- + ". A Remote Business interface MUST not extend jakarta.ejb.EJBObject.");
+ + ". A Remote Business interface MUST NOT extend jakarta.ejb.EJBObject.");
}
remoteClientClassName = getGeneratedRemoteWrapperName(businessIntfName);
@@ -111,11 +109,16 @@
methodsToGenerate = removeRedundantMethods(businessInterface.getMethods());
- // NOTE : no need to remove ejb object methods because EJBObject
+ // NOTE: no need to remove ejb object methods because EJBObject
// is only visible through the RemoteHome view.
}
@Override
+ public String getPackageName() {
+ return this.remoteClientPackageName;
+ }
+
+ @Override
public String getGeneratedClassName() {
return remoteClientClassName;
}
@@ -126,17 +129,7 @@
}
@Override
- public void evaluate() {
-
- _clear();
-
- if (remoteClientPackageName != null) {
- _package(remoteClientPackageName);
- } else {
- // no-arg _package() call is required for default package
- _package();
- }
-
+ public void defineClassBody() {
_class(PUBLIC, remoteClientSimpleName,
_t(RemoteBusinessWrapperBase.class.getName()),
_t(businessInterface.getName()));
@@ -152,39 +145,28 @@
_assign(_v("delegate_"), _v("stub"));
_end();
- for (Method method : methodsToGenerate) {
+ for (final Method method : methodsToGenerate) {
printMethodImpl(method);
}
_end();
-
- try {
- Properties p = new Properties();
- p.put("Wrapper.DUMP_AFTER_SETUP_VISITOR", "true");
- p.put("Wrapper.TRACE_BYTE_CODE_GENERATION", "true");
- p.put("Wrapper.USE_ASM_VERIFIER", "true");
- _byteCode(loader, p);
- } catch(Exception e) {
- LOG.log(Level.WARNING, "Got exception when generating byte code", e);
- }
-
- _classGenerator() ;
}
- private void printMethodImpl(Method m) {
- List<Type> exceptionList = new LinkedList<>();
- for (Class<?> exception : m.getExceptionTypes()) {
+ private void printMethodImpl(final Method m) {
+ final List<Type> exceptionList = new LinkedList<>();
+ for (final Class<?> exception : m.getExceptionTypes()) {
exceptionList.add(Type.type(exception));
}
- _method(PUBLIC, Type.type(m.getReturnType()), m.getName(), exceptionList);
+ final Type returnType = Type.type(m.getReturnType());
+ _method(PUBLIC, returnType, m.getName(), exceptionList);
int i = 0;
- List<Type> expressionListTypes = new LinkedList<>();
- List<Expression> expressionList = new LinkedList<>();
- for (Class<?> param : m.getParameterTypes()) {
- String paramName = "param" + i;
+ final List<Type> expressionListTypes = new LinkedList<>();
+ final List<Expression> expressionList = new LinkedList<>();
+ for (final Class<?> param : m.getParameterTypes()) {
+ final String paramName = "param" + i;
_arg(Type.type(param), paramName);
i++;
expressionListTypes.add(Type.type(param));
@@ -195,17 +177,15 @@
_try();
- Class<?> returnType = m.getReturnType();
-
- if (returnType == void.class) {
+ if (m.getReturnType() == void.class) {
_expr(
- _call(_v("delegate_"), m.getName(), _s(Type.type(returnType), expressionListTypes), expressionList));
+ _call(_v("delegate_"), m.getName(), _s(returnType, expressionListTypes), expressionList));
} else {
_return(
- _call(_v("delegate_"), m.getName(), _s(Type.type(returnType), expressionListTypes), expressionList));
+ _call(_v("delegate_"), m.getName(), _s(returnType, expressionListTypes), expressionList));
}
- boolean doExceptionTranslation = !Remote.class.isAssignableFrom(businessInterface);
+ final boolean doExceptionTranslation = !Remote.class.isAssignableFrom(businessInterface);
if (doExceptionTranslation) {
_catch(_t(TransactionRolledbackException.class.getName()), "trex");
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/RemoteGenerator.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/RemoteGenerator.java
index 8580703..942c560 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/RemoteGenerator.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/RemoteGenerator.java
@@ -1,6 +1,6 @@
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2021 Contributors to the Eclipse Foundation
+ * Copyright (c) 2021-2022 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -30,17 +30,13 @@
import static java.lang.reflect.Modifier.ABSTRACT;
import static java.lang.reflect.Modifier.PUBLIC;
import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper._arg;
-import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper._classGenerator;
-import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper._clear;
import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper._end;
import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper._interface;
import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper._method;
-import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper._package;
import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper._t;
/**
- * This class is used to generate the RMI-IIOP version of a
- * remote business interface.
+ * This class is used to generate the RMI-IIOP version of a remote business interface.
*/
public final class RemoteGenerator extends Generator {
@@ -72,13 +68,14 @@
*
* @param classLoader
* @param businessIntf
- * @throws InvalidBean if the businessInterface doesn't exist.
+ * @throws GeneratorException if the businessInterface doesn't exist.
*/
- public RemoteGenerator(ClassLoader classLoader, String businessIntf) throws InvalidBean {
+ public RemoteGenerator(ClassLoader classLoader, String businessIntf) throws GeneratorException {
+ super(classLoader);
try {
businessInterface = classLoader.loadClass(businessIntf);
} catch (ClassNotFoundException ex) {
- throw new InvalidBean(
+ throw new GeneratorException(
localStrings.getLocalString("generator.remote_interface_not_found", "Remote interface not found "));
}
@@ -92,6 +89,11 @@
// is only visible through the RemoteHome view.
}
+ @Override
+ public String getPackageName() {
+ return this.remoteInterfacePackageName;
+ }
+
/**
* Get the fully qualified name of the generated class.
* <p>
@@ -111,16 +113,7 @@
}
@Override
- public void evaluate() {
-
- _clear();
-
- if (remoteInterfacePackageName != null) {
- _package(remoteInterfacePackageName);
- } else {
- _package();
- }
-
+ public void defineClassBody() {
_interface(PUBLIC, remoteInterfaceSimpleName,
_t(java.rmi.Remote.class.getName()),
_t(RemoteBusinessObject.class.getName())
@@ -131,8 +124,6 @@
}
_end();
-
- _classGenerator() ;
}
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/ServiceInterfaceGenerator.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/ServiceInterfaceGenerator.java
index ed9abd8..ed38f43 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/ServiceInterfaceGenerator.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/ServiceInterfaceGenerator.java
@@ -1,6 +1,6 @@
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2021 Contributors to the Eclipse Foundation
+ * Copyright (c) 2021-2022 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -17,24 +17,22 @@
package com.sun.ejb.codegen;
+import jakarta.jws.WebMethod;
import java.lang.reflect.Method;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
-import org.glassfish.pfl.dynamic.codegen.spi.Type ;
-import jakarta.jws.WebMethod;
+import org.glassfish.pfl.dynamic.codegen.spi.Type ;
import static java.lang.reflect.Modifier.ABSTRACT;
import static java.lang.reflect.Modifier.PUBLIC;
import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper._arg;
-import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper._clear;
import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper._end;
import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper._interface;
import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper._method;
-import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper._package;
import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper._t;
/**
@@ -51,11 +49,15 @@
private final String serviceIntfSimpleName;
private final Method[] intfMethods;
- /**
+ /**
* Construct the Wrapper generator with the specified deployment
* descriptor and class loader.
+ *
+ * @param loader {@link ClassLoader} owning generated classes
+ * @param ejbClass
*/
- public ServiceInterfaceGenerator(Class<?> ejbClass) {
+ public ServiceInterfaceGenerator(final ClassLoader loader, final Class<?> ejbClass) {
+ super(loader);
this.ejbClass = ejbClass;
packageName = getPackageName(ejbClass.getName());
serviceIntfSimpleName = getServiceIntfName(ejbClass);
@@ -66,6 +68,10 @@
// is only visible through the RemoteHome view.
}
+ @Override
+ public String getPackageName() {
+ return this.packageName;
+ }
/**
* Get the fully qualified name of the generated class.
@@ -88,13 +94,7 @@
@Override
- public void evaluate() {
- _clear();
-
- if (packageName != null) {
- _package(packageName);
- }
-
+ public void defineClassBody() {
_interface(PUBLIC, serviceIntfSimpleName);
for (Method intfMethod : intfMethods) {
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/BaseContainer.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/BaseContainer.java
index f19c2fa..426fa2b 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/BaseContainer.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/BaseContainer.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -17,13 +18,12 @@
package com.sun.ejb.containers;
import java.io.Serializable;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Proxy;
import java.rmi.AccessException;
+import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.ArrayDeque;
import java.util.ArrayList;
@@ -78,7 +78,6 @@
import com.sun.ejb.InvocationInfo;
import com.sun.ejb.MethodLockInfo;
import com.sun.ejb.codegen.EjbOptionalIntfGenerator;
-import com.sun.ejb.codegen.ServiceInterfaceGenerator;
import com.sun.ejb.containers.interceptors.InterceptorManager;
import com.sun.ejb.containers.interceptors.SystemInterceptorProxy;
import com.sun.ejb.containers.util.MethodMap;
@@ -153,7 +152,6 @@
* subclasses provide the remaining implementation of the container functionality.
*
*/
-
public abstract class BaseContainer implements Container, EjbContainerFacade, JavaEEContainer {
public enum ContainerType {
STATELESS, STATEFUL, SINGLETON, MESSAGE_DRIVEN, ENTITY, READ_ONLY
@@ -196,9 +194,7 @@
protected static final Class[] NO_PARAMS = new Class[] {};
- protected Object[] logParams = null;
-
- protected ContainerType containerType;
+ protected final ContainerInfo containerInfo;
// constants for EJB(Local)Home/EJB(Local)Object methods,
// used in authorizeRemoteMethod and authorizeLocalMethod
@@ -230,20 +226,20 @@
protected static final String SINGLETON_BEAN_POOL_PROP = "singleton-bean-pool";
- protected ClassLoader loader = null;
- protected Class ejbClass = null;
- protected Class sfsbSerializedClass = null;
- protected Method ejbPassivateMethod = null;
- protected Method ejbActivateMethod = null;
- protected Method ejbRemoveMethod = null;
- private Method ejbTimeoutMethod = null;
+ protected final ClassLoader loader;
+ protected Class<?> ejbClass;
+ protected Class sfsbSerializedClass;
+ protected Method ejbPassivateMethod;
+ protected Method ejbActivateMethod;
+ protected Method ejbRemoveMethod;
+ private Method ejbTimeoutMethod;
- protected Class webServiceEndpointIntf = null;
+ protected Class webServiceEndpointIntf;
// true if exposed as a web service endpoint.
- protected boolean isWebServiceEndpoint = false;
+ protected boolean isWebServiceEndpoint;
- private boolean isTimedObject_ = false;
+ private boolean isTimedObject_;
/*****************************************
* Data members for Local views *
@@ -251,15 +247,15 @@
// True if bean has a LocalHome/Local view
// OR a Local business view OR both.
- protected boolean isLocal = false;
+ protected boolean isLocal;
// True if bean exposes a local home view
- protected boolean hasLocalHomeView = false;
+ protected boolean hasLocalHomeView;
// True if bean exposes a local business view
- protected boolean hasLocalBusinessView = false;
+ protected boolean hasLocalBusinessView;
- protected boolean hasOptionalLocalBusinessView = false;
+ protected boolean hasOptionalLocalBusinessView;
protected Class ejbGeneratedOptionalLocalBusinessIntfClass;
//
@@ -267,10 +263,10 @@
//
// LocalHome interface written by developer
- protected Class localHomeIntf = null;
+ protected Class localHomeIntf;
// Local interface written by developer
- private Class localIntf = null;
+ private Class localIntf;
// Client reference to ejb local home
protected EJBLocalHome ejbLocalHome;
@@ -279,17 +275,14 @@
// object as ejbLocalHome, for example in the case of dynamic proxies.
protected EJBLocalHomeImpl ejbLocalHomeImpl;
- // Constructor used to instantiate ejb local object proxy.
- private Constructor ejbLocalObjectProxyCtor;
-
//
// Data members for 3.x Local business view
//
// Internal interface describing operation used to create an
// instance of a local business object. (GenericEJBLocalHome)
- protected Class localBusinessHomeIntf = null;
- protected Class ejbOptionalLocalBusinessHomeIntf = null;
+ protected Class localBusinessHomeIntf;
+ protected Class ejbOptionalLocalBusinessHomeIntf;
// Local business interface written by developer
protected Set<Class> localBusinessIntfs = new HashSet();
@@ -307,13 +300,7 @@
// Implementation of internal local business home interface.
protected EJBLocalHomeImpl ejbOptionalLocalBusinessHomeImpl;
- // Constructor used to instantiate local business object proxy.
- private Constructor ejbLocalBusinessObjectProxyCtor;
-
- // Constructor used to instantiate local business object proxy.
- private Constructor ejbOptionalLocalBusinessObjectProxyCtor;
-
- private Collection<EjbContainerInterceptor> interceptors = null;
+ private Collection<EjbContainerInterceptor> interceptors;
/*****************************************
* Data members for Remote views *
@@ -321,23 +308,23 @@
// True if bean has a RemoteHome/Remote view
// OR a Remote business view OR both.
- protected boolean isRemote = false;
+ protected boolean isRemote;
// True if bean exposes a RemoteHome view
- protected boolean hasRemoteHomeView = false;
+ protected boolean hasRemoteHomeView;
// True if bean exposes a Remote Business view.
- protected boolean hasRemoteBusinessView = false;
+ protected boolean hasRemoteBusinessView;
//
// Data members for RemoteHome/Remote view
//
// Home interface written by developer.
- protected Class homeIntf = null;
+ protected Class homeIntf;
// Remote interface written by developer.
- protected Class remoteIntf = null;
+ protected Class remoteIntf;
// Container implementation of EJB Home. May or may not be the same
// object as ejbHome, for example in the case of dynamic proxies.
@@ -353,11 +340,8 @@
// Remote interface proxy class
private Class ejbObjectProxyClass;
- // Remote interface proxy constructor.
- private Constructor ejbObjectProxyCtor;
-
// RemoteReference Factory for RemoteHome view
- protected RemoteReferenceFactory remoteHomeRefFactory = null;
+ protected RemoteReferenceFactory remoteHomeRefFactory;
//
// Data members for 3.x Remote business view
@@ -365,7 +349,7 @@
// Internal interface describing operation used to create an
// instance of a remote business object.
- protected Class remoteBusinessHomeIntf = null;
+ protected Class remoteBusinessHomeIntf;
// Container implementation of internal EJB Business Home. May or may
// not be same object as ejbRemoteBusinessHome, for example in the
@@ -389,7 +373,7 @@
// END -- Data members for Remote views
//
- protected EJBMetaData metadata = null;
+ protected EJBMetaData metadata;
protected final SecurityManager securityManager;
@@ -421,9 +405,9 @@
protected InvocationInfo[] ejbIntfMethodInfo;
protected Properties envProps;
- protected boolean isBeanManagedTran = false;
+ protected boolean isBeanManagedTran;
- protected boolean debugMonitorFlag = false;
+ protected boolean debugMonitorFlag;
private static LocalStringManagerImpl localStrings = new LocalStringManagerImpl(BaseContainer.class);
@@ -438,7 +422,7 @@
protected int containerState = CONTAINER_INITIALIZING;
protected HashMap methodMonitorMap;
- protected boolean monitorOn = false;
+ protected boolean monitorOn;
protected EjbMonitoringStatsProvider ejbProbeListener;
protected EjbMonitoringProbeProvider ejbProbeNotifier;
@@ -448,19 +432,16 @@
protected EjbCacheProbeProvider cacheProbeNotifier;
protected EjbCacheStatsProvider cacheProbeListener;
- protected ContainerInfo containerInfo;
-
private final String _debugDescription;
- //protected Agent callFlowAgent;
-
protected CallFlowInfo callFlowInfo;
protected InterceptorManager interceptorManager;
// the order must be the same as CallbackType and getPre30LifecycleMethodNames
- private static final Class[] lifecycleCallbackAnnotationClasses = { AroundConstruct.class, PostConstruct.class, PreDestroy.class,
- PrePassivate.class, PostActivate.class };
+ private static final Class[] lifecycleCallbackAnnotationClasses = {
+ AroundConstruct.class, PostConstruct.class, PreDestroy.class, PrePassivate.class, PostActivate.class
+ };
private final Set<Class> monitoredGeneratedClasses = new HashSet<>();
@@ -492,10 +473,10 @@
// Used to track whether we've done the base container cleanup (JNDI entries, etc.)
// Only. Not applicable to concrete containers.
- private boolean baseContainerCleanupDone = false;
+ private boolean baseContainerCleanupDone;
// True if there is at least one asynchronous method exposed from the bean.
- private boolean hasAsynchronousInvocations = false;
+ private boolean hasAsynchronousInvocations;
// Information about a web service ejb endpoint. Used as a conduit
// between webservice runtime and ejb container. Contains a Remote
@@ -511,20 +492,21 @@
private final JCDIService jcdiService;
+ private Class[] ejbLocalBusinessProxyInterfaces;
+
+ private Class[] ejbOptionalLocalBusinessHomeProxyInterfaces;
+
/**
* This constructor is called from ContainerFactoryImpl when an EJB Jar is deployed.
*/
- protected BaseContainer(ContainerType type, EjbDescriptor ejbDesc, ClassLoader loader, SecurityManager sm) throws Exception {
- this.containerType = type;
+ protected BaseContainer(final ContainerType type, final EjbDescriptor ejbDesc, final ClassLoader loader,
+ final SecurityManager sm) throws Exception {
+ this.ejbDescriptor = ejbDesc;
+ this.loader = loader;
this.securityManager = sm;
+ this.containerInfo = createContainerInfo(type, ejbDesc);
try {
- this.loader = loader;
- this.ejbDescriptor = ejbDesc;
- //this.callFlowAgent = ejbContainerUtilImpl.getCallFlowAgent();
-
- logParams = new Object[1];
- logParams[0] = ejbDesc.getName();
invocationManager = ejbContainerUtilImpl.getInvocationManager();
injectionManager = ejbContainerUtilImpl.getInjectionManager();
namingManager = ejbContainerUtilImpl.getGlassfishNamingManager();
@@ -560,8 +542,7 @@
* uses ASM directly instead of the CORBA codegen library since none of the corba .jars are part of the Web Profile.
*/
if (!Serializable.class.isAssignableFrom(ejbClass)) {
-
- sfsbSerializedClass = EJBUtils.loadGeneratedSerializableClass(ejbClass.getClassLoader(), ejbClass.getName());
+ sfsbSerializedClass = EJBUtils.loadGeneratedSerializableClass(loader, ejbClass);
}
}
@@ -599,20 +580,10 @@
isRemote = true;
hasRemoteBusinessView = true;
- remoteBusinessHomeIntf = EJBUtils.loadGeneratedGenericEJBHomeClass(loader);
+ remoteBusinessHomeIntf = EJBUtils.loadGeneratedGenericEJBHomeClass(loader, ejbClass);
for (String next : ejbDescriptor.getRemoteBusinessClassNames()) {
-
- // The generated remote business interface and the
- // client wrapper for the business interface are
- // produced dynamically. The following call must be
- // made before any EJB 3.0 Remote business interface
- // runtime behavior is needed for a particular
- // classloader.
- String nextGen = EJBUtils.loadGeneratedRemoteBusinessClasses(loader, next);
-
- Class<?> genRemoteIntf = loader.loadClass(nextGen);
-
+ Class<?> genRemoteIntf = EJBUtils.loadGeneratedRemoteBusinessClasses(loader, next);
RemoteBusinessIntfInfo info = new RemoteBusinessIntfInfo();
info.generatedRemoteIntf = genRemoteIntf;
info.remoteBusinessIntf = loader.loadClass(next);
@@ -626,7 +597,7 @@
remoteBusinessIntfInfo.put(genRemoteIntf.getName(), info);
- addToGeneratedMonitoredMethodInfo(nextGen, genRemoteIntf);
+ addToGeneratedMonitoredMethodInfo(genRemoteIntf);
}
}
@@ -651,7 +622,7 @@
for (String next : ejbDescriptor.getLocalBusinessClassNames()) {
Class clz = loader.loadClass(next);
localBusinessIntfs.add(clz);
- addToGeneratedMonitoredMethodInfo(next, clz);
+ addToGeneratedMonitoredMethodInfo(clz);
}
}
@@ -661,7 +632,7 @@
ejbOptionalLocalBusinessHomeIntf = GenericEJBLocalHome.class;
Class clz = loader.loadClass(ejbDescriptor.getEjbClassName());
- addToGeneratedMonitoredMethodInfo(ejbDescriptor.getEjbClassName(), clz);
+ addToGeneratedMonitoredMethodInfo(clz);
this.optIntfClassName = EJBUtils.getGeneratedOptionalInterfaceName(ejbClass.getName());
optIntfClassLoader = new EjbOptionalIntfGenerator(loader);
@@ -672,13 +643,11 @@
if (isStatelessSession || isSingleton) {
EjbBundleDescriptorImpl bundle = ejbDescriptor.getEjbBundleDescriptor();
WebServicesDescriptor webServices = bundle.getWebServices();
- Collection endpoints = webServices.getEndpointsImplementedBy(ejbDescriptor);
+ Collection<?> endpoints = webServices.getEndpointsImplementedBy(ejbDescriptor);
// JSR 109 doesn't require support for a single ejb
// implementing multiple port ex.
if (endpoints.size() == 1) {
-
assertFullProfile("is a Web Service Endpoint");
-
webServiceEndpointIntf = loader.loadClass(ejbDescriptor.getWebServiceEndpointInterfaceName());
isWebServiceEndpoint = true;
}
@@ -715,9 +684,7 @@
ejbClass.getName(), schd.getTimeoutMethod().getFormattedString()));
}
- if (_logger.isLoggable(Level.FINE)) {
- _logger.log(Level.FINE, "... processing " + method);
- }
+ _logger.log(Level.FINE, "... processing {0}", method);
processEjbTimeoutMethod(method);
List<ScheduledTimerDescriptor> list = schedules.get(method);
@@ -767,7 +734,7 @@
initEjbInterceptors();
} catch (Exception ex) {
- _logger.log(Level.FINE, "Exception creating BaseContainer : [{0}]", logParams);
+ _logger.log(Level.FINE, "Exception creating BaseContainer : [{0}]", containerInfo);
_logger.log(Level.FINE, "", ex);
throw ex;
}
@@ -780,8 +747,8 @@
return protocolMgr;
}
- public ContainerType getContainerType() {
- return containerType;
+ public ContainerInfo getContainerInfo() {
+ return this.containerInfo;
}
protected void doEJBHomeRemove(Object pk, Method m, boolean isLocal) throws RemoteException, RemoveException {
@@ -789,7 +756,7 @@
localStrings.getLocalString("ejb.ejbhome_remove_on_nonentity", "EJBHome.remove() called on non entity container"));
}
- private void addToGeneratedMonitoredMethodInfo(String qualifiedClassName, Class generatedClass) {
+ private void addToGeneratedMonitoredMethodInfo(Class generatedClass) {
monitoredGeneratedClasses.add(generatedClass);
}
@@ -1045,12 +1012,11 @@
}
});
}
- java.rmi.Remote remoteRef = null;
+ final java.rmi.Remote remoteRef;
if (generatedRemoteBusinessIntf == null) {
remoteRef = remoteHomeRefFactory.createRemoteReference(instanceKey);
} else {
RemoteReferenceFactory remoteBusinessRefFactory = remoteBusinessIntfInfo.get(generatedRemoteBusinessIntf).referenceFactory;
-
remoteRef = remoteBusinessRefFactory.createRemoteReference(instanceKey);
}
return remoteRef;
@@ -1092,24 +1058,21 @@
EjbBundleDescriptorImpl bundle = ejbDescriptor.getEjbBundleDescriptor();
WebServicesDescriptor webServices = bundle.getWebServices();
- Collection myEndpoints = webServices.getEndpointsImplementedBy(ejbDescriptor);
+ Collection<WebServiceEndpoint> myEndpoints = webServices.getEndpointsImplementedBy(ejbDescriptor);
// An ejb can only be exposed through 1 web service endpoint
- Iterator iter = myEndpoints.iterator();
- webServiceEndpoint = (com.sun.enterprise.deployment.WebServiceEndpoint) iter.next();
+ webServiceEndpoint = myEndpoints.iterator().next();
- Class serviceEndpointIntfClass = loader.loadClass(webServiceEndpoint.getServiceEndpointInterface());
-
+ Class<?> serviceEndpointIntfClass = loader.loadClass(webServiceEndpoint.getServiceEndpointInterface());
if (!serviceEndpointIntfClass.isInterface()) {
- ServiceInterfaceGenerator generator = new ServiceInterfaceGenerator(ejbClass);
- serviceEndpointIntfClass = EJBUtils.generateSEI(generator, loader);
+ serviceEndpointIntfClass = EJBUtils.generateSEI(loader, ejbClass);
if (serviceEndpointIntfClass == null) {
throw new RuntimeException(localStrings.getLocalString("ejb.error_generating_sei",
"Error in generating service endpoint interface class for EJB class {0}", this.ejbClass));
}
}
- Class tieClass = null;
+ Class<?> tieClass = null;
WebServiceInvocationHandler invocationHandler = new WebServiceInvocationHandler(ejbClass, webServiceEndpoint,
serviceEndpointIntfClass, ejbContainerUtilImpl, webServiceInvocationInfoMap);
@@ -1122,16 +1085,13 @@
tieClass = loader.loadClass(webServiceEndpoint.getTieClassName());
}
- // Create a facade for container services to be used by web services runtime.
- EjbEndpointFacade endpointFacade = new EjbEndpointFacadeImpl(this, ejbContainerUtilImpl);
-
wsejbEndpointRegistry = Globals.getDefaultHabitat().getService(WSEjbEndpointRegistry.class);
- if (wsejbEndpointRegistry != null) {
- wsejbEndpointRegistry.registerEndpoint(webServiceEndpoint, endpointFacade, servant, tieClass);
- } else {
+ if (wsejbEndpointRegistry == null) {
throw new DeploymentException(localStrings.getLocalString("ejb.no_webservices_module",
"EJB-based Webservice endpoint is detected but there is no webservices module installed to handle it"));
}
+ EjbEndpointFacade endpointFacade = new EjbEndpointFacadeImpl(this, ejbContainerUtilImpl);
+ wsejbEndpointRegistry.registerEndpoint(webServiceEndpoint, endpointFacade, servant, tieClass);
}
Map<String, Object> intfsForPortableJndi = new HashMap<>();
@@ -1170,12 +1130,6 @@
this.ejbHomeImpl = instantiateEJBHomeImpl();
this.ejbHome = ejbHomeImpl.getEJBHome();
- // Since some containers might create multiple EJBObjects for
- // the same ejb, make sure we use the same Proxy class to
- // instantiate all the proxy instances.
- ejbObjectProxyClass = Proxy.getProxyClass(loader, new Class[] { remoteIntf });
- ejbObjectProxyCtor = ejbObjectProxyClass.getConstructor(new Class[] { InvocationHandler.class });
-
//
// Make sure all Home/Remote interfaces conform to RMI-IIOP
// rules. Checking for conformance here keeps the exposed
@@ -1230,11 +1184,6 @@
getProtocolManager().validateTargetObjectInterfaces(this.ejbRemoteBusinessHome);
for (RemoteBusinessIntfInfo next : remoteBusinessIntfInfo.values()) {
-
- next.proxyClass = Proxy.getProxyClass(loader, new Class[] { next.generatedRemoteIntf });
-
- next.proxyCtor = next.proxyClass.getConstructor(new Class[] { InvocationHandler.class });
-
// Remotereference factory needs instances of
// Home and Remote to get repository Ids since it
// doesn't have stubs and ties. This must be done before
@@ -1350,12 +1299,6 @@
this.ejbLocalHomeImpl = instantiateEJBLocalHomeImpl();
this.ejbLocalHome = ejbLocalHomeImpl.getEJBLocalHome();
- // Since some containers might create multiple EJBLocalObjects
- // for the same ejb, make sure we use the same Proxy class to
- // instantiate all the proxy instances.
- Class ejbLocalObjectProxyClass = Proxy.getProxyClass(loader, new Class[] { IndirectlySerializable.class, localIntf });
- ejbLocalObjectProxyCtor = ejbLocalObjectProxyClass.getConstructor(new Class[] { InvocationHandler.class });
-
// Portable JNDI name for EJB 2.x LocalHome. We don't provide a
// glassfish-specific way of accessing Local EJBs.
@@ -1368,24 +1311,20 @@
ejbLocalBusinessHomeImpl = instantiateEJBLocalBusinessHomeImpl();
ejbLocalBusinessHome = (GenericEJBLocalHome) ejbLocalBusinessHomeImpl.getEJBLocalHome();
- Class[] proxyInterfaces = new Class[localBusinessIntfs.size() + 1];
- proxyInterfaces[0] = IndirectlySerializable.class;
+ ejbLocalBusinessProxyInterfaces = new Class[localBusinessIntfs.size() + 1];
+ ejbLocalBusinessProxyInterfaces[0] = IndirectlySerializable.class;
int index = 1;
for (Class next : localBusinessIntfs) {
- proxyInterfaces[index] = next;
+ ejbLocalBusinessProxyInterfaces[index] = next;
index++;
}
- Class proxyClass = Proxy.getProxyClass(loader, proxyInterfaces);
- ejbLocalBusinessObjectProxyCtor = proxyClass.getConstructor(new Class[] { InvocationHandler.class });
-
for (Class next : localBusinessIntfs) {
// Portable JNDI name for EJB 3.x Local business interface.
// We don't provide a glassfish-specific way of accessing Local EJBs.
JavaGlobalJndiNamingObjectProxy namingProxy = new JavaGlobalJndiNamingObjectProxy(this, next.getName());
intfsForPortableJndi.put(next.getName(), namingProxy);
}
-
}
if (hasOptionalLocalBusinessView) {
@@ -1394,14 +1333,12 @@
ejbOptionalLocalBusinessHome = (GenericEJBLocalHome) ejbOptionalLocalBusinessHomeImpl.getEJBLocalHome();
- Class[] proxyInterfaces = new Class[2];
- proxyInterfaces[0] = IndirectlySerializable.class;
+ ejbOptionalLocalBusinessHomeProxyInterfaces = new Class[2];
+ ejbOptionalLocalBusinessHomeProxyInterfaces[0] = IndirectlySerializable.class;
+
String optionalIntfName = EJBUtils.getGeneratedOptionalInterfaceName(ejbClass.getName());
-
- proxyInterfaces[1] = ejbGeneratedOptionalLocalBusinessIntfClass = optIntfClassLoader.loadClass(optionalIntfName);
-
- Class proxyClass = Proxy.getProxyClass(loader, proxyInterfaces);
- ejbOptionalLocalBusinessObjectProxyCtor = proxyClass.getConstructor(new Class[] { InvocationHandler.class });
+ ejbGeneratedOptionalLocalBusinessIntfClass = optIntfClassLoader.loadClass(optionalIntfName);
+ ejbOptionalLocalBusinessHomeProxyInterfaces[1] = ejbGeneratedOptionalLocalBusinessIntfClass;
// Portable JNDI name for no-interface view.
// We don't provide a glassfish-specific way of accessing the
@@ -1837,7 +1774,7 @@
}
} catch (Exception ex) {
- _logger.log(Level.FINE, "Exception while running pre-invoke : ejbName = [{0}]", logParams);
+ _logger.log(Level.FINE, "Exception while running pre-invoke : ejb: [{0}]", containerInfo);
_logger.log(Level.FINE, "", ex);
EJBException ejbEx;
@@ -2476,7 +2413,7 @@
// be released.
} catch (EJBException e) {
- _logger.log(Level.WARNING, CONTEXT_FAILURE_JACC, logParams[0]);
+ _logger.log(Level.WARNING, CONTEXT_FAILURE_JACC, containerInfo);
_logger.log(Level.WARNING, "", e);
}
@@ -2999,7 +2936,7 @@
if (initMethod != null) {
invInfo.targetMethod1 = initMethod;
} else {
- Object[] params = { logParams[0], (isLocal ? "LocalHome" : "Home"), invInfo.method.toString() };
+ Object[] params = { containerInfo, (isLocal ? "LocalHome" : "Home"), invInfo.method.toString() };
_logger.log(Level.WARNING, BEAN_CLASS_METHOD_NOT_FOUND, params);
// Treat this as a warning instead of a fatal error.
// That matches the behavior of the generated code.
@@ -3048,7 +2985,7 @@
}
} catch (NoSuchMethodException nsme) {
- Object[] params = { logParams[0] + ":" + nsme.toString(), (isLocal ? "Local" : "Remote"), invInfo.method.toString() };
+ Object[] params = { containerInfo + ":" + nsme.toString(), (isLocal ? "Local" : "Remote"), invInfo.method.toString() };
_logger.log(Level.WARNING, BEAN_CLASS_METHOD_NOT_FOUND, params);
// Treat this as a warning instead of a fatal error.
// That matches the behavior of the generated code.
@@ -3302,18 +3239,15 @@
}
private EJBHomeImpl instantiateEJBRemoteBusinessHomeImpl() throws Exception {
-
EJBHomeInvocationHandler handler = getEJBHomeInvocationHandler(remoteBusinessHomeIntf);
handler.setMethodMap(proxyInvocationInfoMap);
EJBHomeImpl remoteBusinessHomeImpl = handler;
-
- EJBHome ejbRemoteBusinessHomeProxy = (EJBHome) Proxy.newProxyInstance(loader, new Class[] { remoteBusinessHomeIntf }, handler);
-
+ EJBHome ejbRemoteBusinessHomeProxy = (EJBHome) Proxy.newProxyInstance(
+ loader, new Class[] {remoteBusinessHomeIntf}, handler);
handler.setProxy(ejbRemoteBusinessHomeProxy);
remoteBusinessHomeImpl.setContainer(this);
-
return remoteBusinessHomeImpl;
}
@@ -3406,7 +3340,8 @@
localObjImpl = handler;
try {
- EJBLocalObject localObjectProxy = (EJBLocalObject) ejbLocalObjectProxyCtor.newInstance(new Object[] { handler });
+ EJBLocalObject localObjectProxy = (EJBLocalObject) Proxy.newProxyInstance(
+ loader, new Class[] {IndirectlySerializable.class, localIntf}, handler);
handler.setProxy(localObjectProxy);
} catch (ClassCastException e) {
String msg = localStrings.getLocalString("ejb.basecontainer_invalid_local_interface",
@@ -3428,9 +3363,7 @@
EJBLocalObjectInvocationHandler handler = new EJBLocalObjectInvocationHandler(proxyInvocationInfoMap, false);
EJBLocalObjectImpl localBusinessObjImpl = handler;
-
- ejbLocalBusinessObjectProxyCtor.newInstance(new Object[] { handler });
-
+ Proxy.newProxyInstance(loader, ejbLocalBusinessProxyInterfaces, handler);
localBusinessObjImpl.setContainer(this);
for (Class businessIntfClass : localBusinessIntfs) {
@@ -3445,17 +3378,15 @@
protected EJBLocalObjectImpl instantiateOptionalEJBLocalBusinessObjectImpl() throws Exception {
EJBLocalObjectInvocationHandler handler = new EJBLocalObjectInvocationHandler(proxyInvocationInfoMap, true);
-
EJBLocalObjectImpl localBusinessObjImpl = handler;
-
- ejbOptionalLocalBusinessObjectProxyCtor.newInstance(new Object[] { handler });
-
+ Proxy.newProxyInstance(loader, ejbOptionalLocalBusinessHomeProxyInterfaces, handler);
localBusinessObjImpl.setContainer(this);
Class businessIntfClass = ejbGeneratedOptionalLocalBusinessIntfClass;
- EJBLocalObjectInvocationHandlerDelegate delegate = new EJBLocalObjectInvocationHandlerDelegate(businessIntfClass, getContainerId(),
- handler);
- Proxy proxy = (Proxy) Proxy.newProxyInstance(loader, new Class[] { IndirectlySerializable.class, businessIntfClass }, delegate);
+ EJBLocalObjectInvocationHandlerDelegate delegate = new EJBLocalObjectInvocationHandlerDelegate(
+ businessIntfClass, getContainerId(), handler);
+ Proxy proxy = (Proxy) Proxy.newProxyInstance(
+ loader, new Class[] {IndirectlySerializable.class, businessIntfClass}, delegate);
String beanSubClassName = ejbGeneratedOptionalLocalBusinessIntfClass.getName() + "__Bean__";
@@ -3465,7 +3396,7 @@
optIntfClassLoader.loadClass(ejbGeneratedOptionalLocalBusinessIntfClass.getName());
Class subClass = optIntfClassLoader.loadClass(beanSubClassName);
- OptionalLocalInterfaceProvider provider = (OptionalLocalInterfaceProvider) subClass.newInstance();
+ OptionalLocalInterfaceProvider provider = (OptionalLocalInterfaceProvider) subClass.getConstructor().newInstance();
provider.setOptionalLocalIntfProxy(proxy);
localBusinessObjImpl.mapClientObject(ejbClass.getName(), provider);
@@ -3481,7 +3412,8 @@
EJBObjectImpl ejbObjImpl = handler;
try {
- EJBObject ejbObjectProxy = (EJBObject) ejbObjectProxyCtor.newInstance(new Object[] { handler });
+ EJBObject ejbObjectProxy = (EJBObject) Proxy.newProxyInstance(loader, new Class[] {remoteIntf}, handler);
+ this.ejbObjectProxyClass = ejbObjectProxyClass == null ? ejbObjectProxy.getClass() : ejbObjectProxyClass;
handler.setEJBObject(ejbObjectProxy);
} catch (ClassCastException e) {
String msg = localStrings.getLocalString("ejb.basecontainer_invalid_remote_interface",
@@ -3519,11 +3451,10 @@
for (RemoteBusinessIntfInfo next : remoteBusinessIntfInfo.values()) {
EJBObjectInvocationHandlerDelegate delegate = new EJBObjectInvocationHandlerDelegate(next.remoteBusinessIntf, handler);
-
- java.rmi.Remote ejbBusinessObjectProxy = (java.rmi.Remote) next.proxyCtor.newInstance(new Object[] { delegate });
-
+ Remote ejbBusinessObjectProxy = (Remote) Proxy.newProxyInstance(
+ loader, new Class[] {next.generatedRemoteIntf}, delegate);
+ next.proxyClass = ejbBusinessObjectProxy.getClass();
ejbBusinessObjImpl.setEJBObject(next.generatedRemoteIntf.getName(), ejbBusinessObjectProxy);
-
}
ejbBusinessObjImpl.setContainer(this);
@@ -3935,7 +3866,9 @@
remoteHomeRefFactory.cleanupClass(homeIntf);
remoteHomeRefFactory.cleanupClass(remoteIntf);
remoteHomeRefFactory.cleanupClass(ejbHome.getClass());
- remoteHomeRefFactory.cleanupClass(ejbObjectProxyClass);
+ if (ejbObjectProxyClass != null) {
+ remoteHomeRefFactory.cleanupClass(ejbObjectProxyClass);
+ }
// destroy the factory itself
remoteHomeRefFactory.destroy();
@@ -3956,7 +3889,9 @@
next.referenceFactory.cleanupClass(next.generatedRemoteIntf);
- next.referenceFactory.cleanupClass(next.proxyClass);
+ if (next.proxyClass != null) {
+ next.referenceFactory.cleanupClass(next.proxyClass);
+ }
// destroy the factory itself
next.referenceFactory.destroy();
@@ -3965,7 +3900,7 @@
}
} catch (Exception ex) {
- _logger.log(Level.FINE, "Exception during undeploy", logParams);
+ _logger.log(Level.FINE, "Exception during undeploy {0}", containerInfo);
_logger.log(Level.FINE, "", ex);
}
}
@@ -3973,7 +3908,7 @@
try {
ejbContainerUtilImpl.getComponentEnvManager().unbindFromComponentNamespace(ejbDescriptor);
} catch (javax.naming.NamingException namEx) {
- _logger.log(Level.FINE, "Exception during undeploy", logParams);
+ _logger.log(Level.FINE, "Exception during undeploy: {0}", containerInfo);
_logger.log(Level.FINE, "", namEx);
}
@@ -4312,45 +4247,46 @@
protected abstract EjbMonitoringStatsProvider getMonitoringStatsProvider(String appName, String modName, String ejbName);
protected void createMonitoringRegistry() {
- String appName = null;
- String modName = null;
- String ejbName = null;
boolean isMonitorRegistryMediatorCreated = false;
try {
- appName = (ejbDescriptor.getApplication().isVirtual()) ? null : ejbDescriptor.getApplication().getRegistrationName();
- if (appName == null) {
- modName = ejbDescriptor.getApplication().getRegistrationName();
- } else {
- String archiveuri = ejbDescriptor.getEjbBundleDescriptor().getModuleDescriptor().getArchiveUri();
- modName = com.sun.enterprise.util.io.FileUtils.makeFriendlyFilename(archiveuri);
- }
- ejbName = ejbDescriptor.getName();
- containerInfo = new ContainerInfo(appName, modName, ejbName);
-
isMonitorRegistryMediatorCreated = true;
- registerEjbMonitoringProbeProvider(appName, modName, ejbName);
- ejbProbeListener = getMonitoringStatsProvider(appName, modName, ejbName);
- ejbProbeListener.addMethods(getContainerId(), appName, modName, ejbName, getMonitoringMethodsArray());
+ registerEjbMonitoringProbeProvider();
+ ejbProbeListener = getMonitoringStatsProvider(containerInfo.appName, containerInfo.modName, containerInfo.ejbName);
+ ejbProbeListener.addMethods(getContainerId(), containerInfo.appName, containerInfo.modName, containerInfo.ejbName, getMonitoringMethodsArray());
ejbProbeListener.register();
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE,
- "Created MonitoringRegistry: " + EjbMonitoringUtils.getDetailedLoggingName(appName, modName, ejbName));
+ "Created MonitoringRegistry: " + EjbMonitoringUtils.getDetailedLoggingName(containerInfo.appName, containerInfo.modName, containerInfo.ejbName));
}
} catch (Exception ex) {
_logger.log(Level.SEVERE, COULD_NOT_CREATE_MONITORREGISTRYMEDIATOR,
- new Object[] { EjbMonitoringUtils.getDetailedLoggingName(appName, modName, ejbName), ex });
+ new Object[] { EjbMonitoringUtils.getDetailedLoggingName(containerInfo.appName, containerInfo.modName, containerInfo.ejbName), ex });
if (!isMonitorRegistryMediatorCreated) {
- registerEjbMonitoringProbeProvider(appName, modName, ejbName);
+ registerEjbMonitoringProbeProvider();
}
}
}
- private void registerEjbMonitoringProbeProvider(String appName, String modName, String ejbName) {
+ private static ContainerInfo createContainerInfo(final ContainerType type, final EjbDescriptor ejbDescriptor) {
+ final String appName = ejbDescriptor.getApplication().isVirtual() ? null
+ : ejbDescriptor.getApplication().getRegistrationName();
+ final String modName;
+ if (appName == null) {
+ modName = ejbDescriptor.getApplication().getRegistrationName();
+ } else {
+ String archiveuri = ejbDescriptor.getEjbBundleDescriptor().getModuleDescriptor().getArchiveUri();
+ modName = com.sun.enterprise.util.io.FileUtils.makeFriendlyFilename(archiveuri);
+ }
+ return new ContainerInfo(type, appName, modName, ejbDescriptor.getName());
+ }
+
+ private void registerEjbMonitoringProbeProvider() {
// Always create to avoid NPE
try {
ProbeProviderFactory probeFactory = ejbContainerUtilImpl.getProbeProviderFactory();
- String invokerId = EjbMonitoringUtils.getInvokerId(appName, modName, ejbName);
+ String invokerId = EjbMonitoringUtils.getInvokerId(
+ containerInfo.appName, containerInfo.modName, containerInfo.ejbName);
ejbProbeNotifier = probeFactory.getProbeProvider(EjbMonitoringProbeProvider.class, invokerId);
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "Got ProbeProvider: " + ejbProbeNotifier.getClass().getName());
@@ -4509,38 +4445,46 @@
}
/**
- * PreInvokeException is used to wrap exceptions thrown from BaseContainer.preInvoke, so it indicates that the bean's method will
- * not be called.
+ * PreInvokeException is used to wrap exceptions thrown from BaseContainer.preInvoke,
+ * so it indicates that the bean's method will not be called.
*/
public final static class PreInvokeException extends EJBException {
-
Exception exception;
public PreInvokeException(Exception ex) {
this.exception = ex;
}
- } //PreInvokeException{}
+ }
/**
- * Strings for monitoring info
+ * Informations about this container.
*/
public static final class ContainerInfo {
- public String appName;
- public String modName;
- public String ejbName;
+ public final String appName;
+ public final String modName;
+ public final String ejbName;
+ public final ContainerType type;
- ContainerInfo(String appName, String modName, String ejbName) {
+ ContainerInfo(ContainerType type, String appName, String modName, String ejbName) {
+ this.type = type;
this.appName = appName;
this.modName = modName;
this.ejbName = ejbName;
}
- } //ContainerInfo
+
+ @Override
+ public String toString() {
+ return new StringBuilder(64).append(appName).append('_').append(this.modName).append('_')
+ .append(this.ejbName).append('(').append(this.type).append(')').toString();
+ }
+ }
private static class BeanContext {
ClassLoader previousClassLoader;
boolean classLoaderSwitched;
}
-} //BaseContainer{}
+
+} // BaseContainer class
final class CallFlowInfoImpl implements CallFlowInfo {
@@ -4621,14 +4565,11 @@
}
final class RemoteBusinessIntfInfo {
-
Class generatedRemoteIntf;
Class remoteBusinessIntf;
String jndiName;
RemoteReferenceFactory referenceFactory;
Class proxyClass;
- Constructor proxyCtor;
-
}
final class SafeProperties extends Properties {
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EJBHomeImpl.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EJBHomeImpl.java
index f17efe9..8efa71d 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EJBHomeImpl.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EJBHomeImpl.java
@@ -107,6 +107,7 @@
* This is the implementation of the jakarta.ejb.EJBHome remove method.
* @exception RemoveException on error during removal
*/
+ @Override
public final void remove(Handle handle)
throws RemoteException, RemoveException
{
@@ -130,10 +131,11 @@
* This is the implementation of the jakarta.ejb.EJBHome remove method.
* @exception RemoveException on error during removal
*/
+ @Override
public final void remove(Object primaryKey)
throws RemoteException, RemoveException
{
- if (container.getContainerType() != BaseContainer.ContainerType.ENTITY) {
+ if (container.getContainerInfo().type != BaseContainer.ContainerType.ENTITY) {
// Session beans dont have primary keys. EJB2.0 Section 6.6
throw new RemoveException("Invalid remove operation.");
}
@@ -155,6 +157,7 @@
/**
* This is the implementation of the jakarta.ejb.EJBHome method.
*/
+ @Override
public final EJBMetaData getEJBMetaData()
throws RemoteException
{
@@ -167,6 +170,7 @@
* This is the implementation of the jakarta.ejb.EJBHome getHomeHandle
* method.
*/
+ @Override
public final HomeHandle getHomeHandle()
throws RemoteException
{
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EJBHomeInvocationHandler.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EJBHomeInvocationHandler.java
index ecc02f5..918f301 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EJBHomeInvocationHandler.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EJBHomeInvocationHandler.java
@@ -56,7 +56,7 @@
// but only has InvocationHandler.
private EJBHome proxy_;
- private Class homeIntfClass_;
+ private final Class homeIntfClass_;
// Cache reference to invocation info. There is one of these per
// container. It's populated during container initialization and
@@ -65,7 +65,7 @@
// is created.
private MethodMap invocationInfoMap_;
- private EjbContainerUtil ejbContainerUtil = EjbContainerUtilImpl.getInstance();
+ private final EjbContainerUtil ejbContainerUtil = EjbContainerUtilImpl.getInstance();
protected EJBHomeInvocationHandler(EjbDescriptor ejbDescriptor,
@@ -93,6 +93,7 @@
invocationInfoMap_ = map;
}
+ @Override
protected EJBHome getEJBHome() {
return proxy_;
}
@@ -100,6 +101,7 @@
/**
* Called by EJBHome proxy.
*/
+ @Override
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
@@ -119,17 +121,14 @@
// proceeding. Otherwise, the context classloader could still
// reflect the caller's class loader.
- if( Thread.currentThread().getContextClassLoader() !=
- getContainer().getClassLoader() ) {
- originalClassLoader = Utility.setContextClassLoader
- (getContainer().getClassLoader());
+ if (Thread.currentThread().getContextClassLoader() != getContainer().getClassLoader()) {
+ originalClassLoader = Utility.setContextClassLoader(getContainer().getClassLoader());
}
Class methodClass = method.getDeclaringClass();
- if( methodClass == java.lang.Object.class ) {
- return InvocationHandlerUtil.invokeJavaObjectMethod
- (this, method, args);
+ if (methodClass == java.lang.Object.class) {
+ return InvocationHandlerUtil.invokeJavaObjectMethod(this, method, args);
} else if (invokeSpecialEJBHomeMethod(method, methodClass, args)) {
return null;
}
@@ -236,7 +235,7 @@
inv.invocationInfo = invInfo;
if( ejbObjectImpl != null && invInfo.startsWithCreate ) {
- inv.ejbObject = (EJBLocalRemoteObject) ejbObjectImpl;
+ inv.ejbObject = ejbObjectImpl;
}
BaseContainer container = (BaseContainer) getContainer();
@@ -335,24 +334,24 @@
try {
if( methodName.equals("getEJBMetaData") ) {
- methodIndex = container.EJBHome_getEJBMetaData;
+ methodIndex = BaseContainer.EJBHome_getEJBMetaData;
container.onEjbMethodStart(methodIndex);
returnValue = super.getEJBMetaData();
} else if( methodName.equals("getHomeHandle") ) {
- methodIndex = container.EJBHome_getHomeHandle;
+ methodIndex = BaseContainer.EJBHome_getHomeHandle;
container.onEjbMethodStart(methodIndex);
returnValue = super.getHomeHandle();
} else if( methodName.equals("remove") ) {
if( args[0] instanceof jakarta.ejb.Handle ) {
- methodIndex = container.EJBHome_remove_Handle;
+ methodIndex = BaseContainer.EJBHome_remove_Handle;
container.onEjbMethodStart(methodIndex);
super.remove((jakarta.ejb.Handle)args[0]);
} else {
- methodIndex = container.EJBHome_remove_Pkey;
+ methodIndex = BaseContainer.EJBHome_remove_Pkey;
container.onEjbMethodStart(methodIndex);
super.remove(args[0]);
}
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EJBLocalHomeImpl.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EJBLocalHomeImpl.java
index 905cab1..071912a 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EJBLocalHomeImpl.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EJBLocalHomeImpl.java
@@ -95,10 +95,11 @@
/**
* This is the implementation of the jakarta.ejb.EJBLocalHome remove method.
*/
+ @Override
public final void remove(Object primaryKey)
throws RemoveException, EJBException
{
- if (container.getContainerType() != BaseContainer.ContainerType.ENTITY) {
+ if (container.getContainerInfo().type != BaseContainer.ContainerType.ENTITY) {
// Session beans dont have primary keys. EJB2.0 Section 6.6.
throw new RemoveException("Attempt to call remove(Object primaryKey) on a session bean.");
}
@@ -119,12 +120,11 @@
// This should never be thrown for local invocations, but it's
// part of the removeBean signature. If for some strange
// reason it happens, convert to EJBException
- EJBException ejbEx =new EJBException("unexpected RemoteException");
- ejbEx.initCause(re);
- throw ejbEx;
+ throw new EJBException("unexpected RemoteException", re);
}
}
+ @Override
public SerializableObjectFactory getSerializableObjectFactory() {
return new SerializableLocalHome(
container.getEjbDescriptor().getUniqueId());
@@ -133,12 +133,13 @@
public static final class SerializableLocalHome
implements SerializableObjectFactory
{
- private long ejbId;
+ private final long ejbId;
public SerializableLocalHome(long uniqueId) {
this.ejbId = uniqueId;
}
+ @Override
public Object createObject()
throws IOException
{
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EjbEndpointFacadeImpl.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EjbEndpointFacadeImpl.java
index 271d11f..274480b 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EjbEndpointFacadeImpl.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EjbEndpointFacadeImpl.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -30,30 +31,36 @@
import java.util.logging.Logger;
-/*
+/**
+ * A facade for container services to be used by web services runtime.
+ *
* @author Kenneth Saks
*/
-
public class EjbEndpointFacadeImpl implements EjbEndpointFacade {
- private BaseContainer container_;
- private InvocationManager invManager_;
- private static Logger logger_ = EjbContainerUtilImpl.getLogger();
+ private static final Logger LOG = EjbContainerUtilImpl.getLogger();
+ private final BaseContainer container;
+ private final InvocationManager invocationManager;
-
+ /**
+ * Creates a facade for container services to be used by web services runtime.
+ *
+ * @param container
+ * @param util
+ */
public EjbEndpointFacadeImpl(BaseContainer container, EjbContainerUtil util) {
- container_ = container;
- invManager_ = util.getInvocationManager();
+ this.container = container;
+ this.invocationManager = util.getInvocationManager();
}
+ @Override
public ClassLoader getEndpointClassLoader() {
-
- return container_.getClassLoader();
-
+ return container.getClassLoader();
}
+ @Override
public ComponentInvocation startInvocation() {
// We need to split the preInvoke tasks into stages since handlers
@@ -61,29 +68,23 @@
// place before handlers are run. Note that the application
// classloader was set much earlier when the invocation first arrived
// so we don't need to set it here.
- EjbInvocation inv = container_.createEjbInvocation();
+ EjbInvocation inv = container.createEjbInvocation();
// Do the portions of preInvoke that don't need a Method object.
inv.isWebService = true;
- inv.container = container_;
+ inv.container = container;
inv.transactionAttribute = Container.TX_NOT_INITIALIZED;
- // AS per latest spec change, the MessageContext object in WebSvcCtxt
- // should be the same one as used in the ejb's interceptors'
- // TODO
- // inv.setContextData(wsCtxt);
-
// In all cases, the WebServiceInvocationHandler will do the
// remaining preInvoke tasks : getContext, preInvokeTx, etc.
- invManager_.preInvoke(inv);
-
+ invocationManager.preInvoke(inv);
return inv;
}
+ @Override
public void endInvocation(ComponentInvocation inv) {
-
try {
EjbInvocation ejbInv = (EjbInvocation) inv;
@@ -96,19 +97,13 @@
// and WebServiceInvocationHandler rather than change the
// behavior of BaseContainer.preInvoke and
// BaseContainer.postInvoke.
-
-
- if( ejbInv.ejb != null ) {
- container_.webServicePostInvoke(ejbInv);
+ if (ejbInv.ejb == null) {
+ invocationManager.postInvoke(inv);
} else {
- invManager_.postInvoke(inv);
+ container.webServicePostInvoke(ejbInv);
}
-
- } catch(Throwable t) {
- logger_.log(Level.WARNING,
- "Unexpected error in EJB WebService endpoint post processing", t);
+ } catch (Throwable t) {
+ LOG.log(Level.WARNING, "Unexpected error in EJB WebService endpoint post processing", t);
}
-
}
-
}
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/RemoteBusinessObjectFactory.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/RemoteBusinessObjectFactory.java
index 1a12569..e353d03 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/RemoteBusinessObjectFactory.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/RemoteBusinessObjectFactory.java
@@ -30,26 +30,13 @@
public class RemoteBusinessObjectFactory implements ObjectFactory {
-
-
- public Object getObjectInstance(Object obj,
- Name name,
- Context nameCtx,
- Hashtable env) throws Exception
- {
-
- InitialContext ic = new InitialContext(env);
-
- Reference ref = (Reference) obj;
-
- RefAddr refAddr = ref.get("url");
-
- Object genericRemoteHomeObj = ic.lookup((String) refAddr.getContent());
-
- String busInterface = ref.getClassName();
-
- return EJBUtils.lookupRemote30BusinessObject(genericRemoteHomeObj,
- busInterface);
+ @Override
+ public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable env) throws Exception {
+ InitialContext ic = new InitialContext(env);
+ Reference ref = (Reference) obj;
+ RefAddr refAddr = ref.get("url");
+ Object genericRemoteHomeObj = ic.lookup((String) refAddr.getContent());
+ String busInterface = ref.getClassName();
+ return EJBUtils.lookupRemote30BusinessObject(genericRemoteHomeObj, busInterface);
}
-
}
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/RemoteBusinessWrapperBase.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/RemoteBusinessWrapperBase.java
index df70245..fe6c8bc 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/RemoteBusinessWrapperBase.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/RemoteBusinessWrapperBase.java
@@ -25,10 +25,9 @@
import com.sun.ejb.EJBUtils;
-public class RemoteBusinessWrapperBase
- implements java.io.Serializable {
+public class RemoteBusinessWrapperBase implements java.io.Serializable {
- // This is the name of the developer-written business interface.
+ /** This is the name of the developer-written business interface. */
private String businessInterface_;
private Remote stub_;
@@ -41,16 +40,20 @@
this.hashCode_ = busIntf.hashCode();
}
+
public Remote getStub() {
return stub_;
}
+
+ @Override
public int hashCode() {
return hashCode_;
}
- public boolean equals(Object obj) {
+ @Override
+ public boolean equals(Object obj) {
boolean result = (obj == this); //Most efficient
if ((result == false) && (obj != null)) { //Do elaborate checks
if (obj instanceof RemoteBusinessWrapperBase) {
@@ -70,59 +73,45 @@
return result;
}
+
public String getBusinessInterfaceName() {
return businessInterface_;
}
+
public Object writeReplace() throws ObjectStreamException {
return new RemoteBusinessWrapperBase(stub_, businessInterface_);
}
- private void writeObject(java.io.ObjectOutputStream oos)
- throws java.io.IOException
- {
+ private void writeObject(java.io.ObjectOutputStream oos) throws java.io.IOException {
oos.writeObject(businessInterface_);
oos.writeObject(stub_);
-
}
- private void readObject(ObjectInputStream ois)
- throws IOException, ClassNotFoundException {
+ private void readObject(ObjectInputStream ois) throws IOException {
try {
-
businessInterface_ = (String) ois.readObject();
hashCode_ = businessInterface_.hashCode();
EJBUtils.loadGeneratedRemoteBusinessClasses(businessInterface_);
stub_ = (Remote) ois.readObject();
-
- } catch(Exception e) {
- IOException ioe = new IOException("RemoteBusinessWrapper.readObj "
- + " error");
- ioe.initCause(e);
- throw ioe;
+ } catch (Exception e) {
+ throw new IOException("RemoteBusinessWrapper.readObj error", e);
}
}
+
public Object readResolve() throws ObjectStreamException {
-
try {
-
- return EJBUtils.createRemoteBusinessObject(businessInterface_,
- stub_);
- } catch(Exception e) {
- WriteAbortedException wae = new WriteAbortedException
- ("RemoteBusinessWrapper.readResolve error", e);
+ return EJBUtils.createRemoteBusinessObject(businessInterface_, stub_);
+ } catch (Exception e) {
+ WriteAbortedException wae = new WriteAbortedException("RemoteBusinessWrapper.readResolve error", e);
throw wae;
}
}
-
-
-
-
}
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/StatefulSessionContainer.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/StatefulSessionContainer.java
index 8927b90..5000e92 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/StatefulSessionContainer.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/StatefulSessionContainer.java
@@ -263,8 +263,8 @@
private final static long CONCURRENCY_NOT_ALLOWED = 0;
private final static long BLOCK_INDEFINITELY = -1;
- private ArrayList passivationCandidates = new ArrayList();
- private Object asyncTaskSemaphore = new Object();
+ private final ArrayList passivationCandidates = new ArrayList();
+ private final Object asyncTaskSemaphore = new Object();
private int asyncTaskCount = 0;
@@ -278,21 +278,21 @@
private LruSessionCache sessionBeanCache;
private BackingStore<Serializable, SimpleMetadata> backingStore;
private SFSBUUIDUtil uuidGenerator;
- private ArrayList scheduledTimerTasks = new ArrayList();
+ private final ArrayList scheduledTimerTasks = new ArrayList();
private int statMethodReadyCount = 0;
- private Level TRACE_LEVEL = Level.FINE;
+ private final Level TRACE_LEVEL = Level.FINE;
- private String ejbName;
+ private final String ejbName;
private boolean isHAEnabled;
private int removalGracePeriodInSeconds;
- private InvocationInfo postConstructInvInfo;
- private InvocationInfo preDestroyInvInfo;
- private InvocationInfo postActivateInvInfo;
- private InvocationInfo prePassivateInvInfo;
+ private final InvocationInfo postConstructInvInfo;
+ private final InvocationInfo preDestroyInvInfo;
+ private final InvocationInfo postActivateInvInfo;
+ private final InvocationInfo prePassivateInvInfo;
private StatefulSessionStoreMonitor sfsbStoreMonitor;
@@ -303,7 +303,7 @@
private Method afterBeginMethod;
private Method beforeCompletionMethod;
private Method afterCompletionMethod;
- private boolean isPassivationCapable;
+ private final boolean isPassivationCapable;
/*
* Cache for keeping ref count for shared extended entity manager.
@@ -311,10 +311,10 @@
*/
private static final Map<EntityManager, EEMRefInfo> extendedEMReferenceCountMap
- = new HashMap<EntityManager, EEMRefInfo>();
+ = new HashMap<>();
private static final Map<EEMRefInfoKey, EntityManager> eemKey2EEMMap
- = new HashMap<EEMRefInfoKey, EntityManager>();
+ = new HashMap<>();
/**
* This constructor is called from the JarManager when a Jar is deployed.
@@ -346,6 +346,7 @@
isPassivationCapable = sfulDesc.isPassivationCapable();
}
+ @Override
public boolean isPassivationCapable() {
return isPassivationCapable;
}
@@ -361,6 +362,7 @@
return inv;
}
+ @Override
protected void initializeHome()
throws Exception {
super.initializeHome();
@@ -427,6 +429,7 @@
java.security.AccessController.doPrivileged(
new java.security.PrivilegedExceptionAction() {
+ @Override
public java.lang.Object run() throws Exception {
if( !methodAccessible.isAccessible() ) {
methodAccessible.setAccessible(true);
@@ -439,6 +442,7 @@
// Called before invoking a bean with no Tx or with a new Tx.
// Check if the bean is associated with an unfinished tx.
+ @Override
protected void checkUnfinishedTx(Transaction prevTx, EjbInvocation inv) {
try {
if ( inv.invocationInfo.isBusinessMethod && prevTx != null &&
@@ -488,6 +492,7 @@
}
}
+ @Override
protected void registerMonitorableComponents() {
registerEjbCacheProbeProvider();
super.registerMonitorableComponents();
@@ -552,6 +557,7 @@
return sbuf.toString();
}
+ @Override
protected EjbMonitoringStatsProvider getMonitoringStatsProvider(
String appName, String modName, String ejbName) {
StatefulSessionBeanStatsProvider statsProvider = new StatefulSessionBeanStatsProvider(
@@ -578,7 +584,7 @@
}
**/
- private static final String convertCtxStateToString(
+ private static String convertCtxStateToString(
SessionContextImpl sc) {
switch (sc.getState()) {
case PASSIVATED:
@@ -595,18 +601,20 @@
return "UNKNOWN-STATE";
}
+ @Override
protected boolean isIdentical(EJBObjectImpl ejbo, EJBObject other)
throws RemoteException {
- if (other == ejbo.getStub())
+ if (other == ejbo.getStub()) {
return true;
- else {
+ } else {
try {
// other may be a stub for a remote object.
- if (getProtocolManager().isIdentical(ejbo.getStub(), other))
+ if (getProtocolManager().isIdentical(ejbo.getStub(), other)) {
return true;
- else
+ } else {
return false;
+ }
} catch (Exception ex) {
_logger.log(Level.FINE,
"Exception while getting stub for ejb", ex);
@@ -622,6 +630,7 @@
* ejbCreate on the new bean after createEJBObject() returns.
* Return the EJBObject for the bean.
*/
+ @Override
protected EJBObjectImpl createEJBObjectImpl()
throws CreateException, RemoteException {
try {
@@ -634,9 +643,9 @@
_logger.log(Level.WARNING, CREATE_EJBOBJECT_EXCEPTION, new Object[]{ejbDescriptor.getName(), ex});
- if (ex instanceof EJBException)
+ if (ex instanceof EJBException) {
throw (EJBException) ex;
- else {
+ } else {
CreateException ce =
new CreateException("ERROR creating stateful SessionBean");
ce.initCause(ex);
@@ -645,6 +654,7 @@
}
}
+ @Override
protected EJBObjectImpl createRemoteBusinessObjectImpl()
throws CreateException, RemoteException {
try {
@@ -658,9 +668,9 @@
_logger.log(Level.WARNING, CREATE_EJBOBJECT_EXCEPTION, new Object[]{ejbDescriptor.getName(), ex});
- if (ex instanceof EJBException)
+ if (ex instanceof EJBException) {
throw (EJBException) ex;
- else {
+ } else {
CreateException ce =
new CreateException("ERROR creating stateful SessionBean");
ce.initCause(ex);
@@ -677,6 +687,7 @@
* ejbCreate on the new bean after createEJBLocalObjectImpl() returns.
* Return the EJBLocalObject for the bean.
*/
+ @Override
protected EJBLocalObjectImpl createEJBLocalObjectImpl()
throws CreateException {
try {
@@ -693,9 +704,9 @@
_logger.log(Level.WARNING, CREATE_EJBLOCALOBJECT_EXCEPTION, new Object[]{ejbDescriptor.getName(), ex});
- if (ex instanceof EJBException)
+ if (ex instanceof EJBException) {
throw (EJBException) ex;
- else {
+ } else {
CreateException ce =
new CreateException("ERROR creating stateful SessionBean");
ce.initCause(ex);
@@ -707,6 +718,7 @@
/**
* Internal creation event for Local Business view of SFSB
*/
+ @Override
EJBLocalObjectImpl createEJBLocalBusinessObjectImpl(boolean localBeanView)
throws CreateException {
try {
@@ -830,7 +842,7 @@
Set<EntityManagerReferenceDescriptor> emRefs
= ejbDescriptor.getEntityManagerReferenceDescriptors();
Iterator<EntityManagerReferenceDescriptor> iter = emRefs.iterator();
- Set<EEMRefInfo> eemRefInfos = new HashSet<EEMRefInfo>();
+ Set<EEMRefInfo> eemRefInfos = new HashSet<>();
while (iter.hasNext()) {
EntityManagerReferenceDescriptor refDesc = iter.next();
if (refDesc.getPersistenceContextType() ==
@@ -898,8 +910,7 @@
private PhysicalEntityManagerWrapper findExtendedEMFromInvList(EntityManagerFactory emf) {
PhysicalEntityManagerWrapper em = null;
- ComponentInvocation compInv = (ComponentInvocation)
- invocationManager.getCurrentInvocation();
+ ComponentInvocation compInv = invocationManager.getCurrentInvocation();
if (compInv != null) {
if (compInv.getInvocationType() == ComponentInvocation.ComponentInvocationType.EJB_INVOCATION) {
EjbInvocation ejbInv = (EjbInvocation) compInv;
@@ -915,6 +926,7 @@
return em;
}
+ @Override
public EntityManager lookupExtendedEntityManager(EntityManagerFactory emf) {
PhysicalEntityManagerWrapper physicalEntityManagerWrapper = findExtendedEMFromInvList(emf);
return physicalEntityManagerWrapper == null ? null : physicalEntityManagerWrapper.getEM();
@@ -976,8 +988,9 @@
// called from createEJBObject and activateEJB and createEJBLocalObjectImpl
private EJBLocalObjectImpl createEJBLocalObjectImpl
(SessionContextImpl context) throws Exception {
- if (context.getEJBLocalObjectImpl() != null)
+ if (context.getEJBLocalObjectImpl() != null) {
return context.getEJBLocalObjectImpl();
+ }
// create EJBLocalObject
EJBLocalObjectImpl localObjImpl = instantiateEJBLocalObjectImpl(context.getInstanceKey());
@@ -1007,8 +1020,9 @@
private EJBLocalObjectImpl createEJBLocalBusinessObjectImpl
(SessionContextImpl context) throws Exception {
- if (context.getEJBLocalBusinessObjectImpl() != null)
+ if (context.getEJBLocalBusinessObjectImpl() != null) {
return context.getEJBLocalBusinessObjectImpl();
+ }
EJBLocalObjectImpl localBusinessObjImpl =
instantiateEJBLocalBusinessObjectImpl();
@@ -1038,8 +1052,9 @@
private EJBLocalObjectImpl createOptionalEJBLocalBusinessObjectImpl
(SessionContextImpl context) throws Exception {
- if (context.getOptionalEJBLocalBusinessObjectImpl() != null)
+ if (context.getOptionalEJBLocalBusinessObjectImpl() != null) {
return context.getOptionalEJBLocalBusinessObjectImpl();
+ }
EJBLocalObjectImpl optionalLocalBusinessObjImpl =
instantiateOptionalEJBLocalBusinessObjectImpl();
@@ -1071,8 +1086,9 @@
private EJBObjectImpl createEJBObjectImpl(SessionContextImpl context)
throws Exception {
- if (context.getEJBObjectImpl() != null)
+ if (context.getEJBObjectImpl() != null) {
return context.getEJBObjectImpl();
+ }
// create EJBObject and associate it with the key
Object sessionKey = context.getInstanceKey();
@@ -1115,8 +1131,9 @@
private EJBObjectImpl createRemoteBusinessObjectImpl
(SessionContextImpl context) throws Exception {
- if (context.getEJBRemoteBusinessObjectImpl() != null)
+ if (context.getEJBRemoteBusinessObjectImpl() != null) {
return context.getEJBRemoteBusinessObjectImpl();
+ }
// create EJBObject
EJBObjectImpl ejbBusinessObjImpl =
@@ -1163,6 +1180,7 @@
// Called from EJBObjectImpl.remove, EJBLocalObjectImpl.remove,
// EJBHomeImpl.remove(Handle).
+ @Override
protected void removeBean(EJBLocalRemoteObject ejbo, Method removeMethod,
boolean local)
throws RemoveException, EJBException {
@@ -1273,12 +1291,14 @@
* Note: EJB2.0 section 18.3.1 says that discarding an EJB
* means that no methods other than finalize() should be invoked on it.
*/
+ @Override
protected void forceDestroyBean(EJBContextImpl ctx) {
SessionContextImpl sc = (SessionContextImpl) ctx;
synchronized (sc) {
- if (sc.getState() == EJBContextImpl.BeanState.DESTROYED)
+ if (sc.getState() == EJBContextImpl.BeanState.DESTROYED) {
return;
+ }
// mark context as destroyed so no more invocations happen on it
sc.setState(BeanState.DESTROYED);
@@ -1349,7 +1369,7 @@
// disconnect the EJBLocalObject from the context
// and vice versa
EJBLocalObjectImpl localObjImpl =
- (EJBLocalObjectImpl) sc.getEJBLocalObjectImpl();
+ sc.getEJBLocalObjectImpl();
localObjImpl.clearContext();
localObjImpl.setRemoved(true);
sc.setEJBLocalObjectImpl(null);
@@ -1358,14 +1378,14 @@
// disconnect the EJBLocalObject from the context
// and vice versa
EJBLocalObjectImpl localBusinessObjImpl =
- (EJBLocalObjectImpl) sc.getEJBLocalBusinessObjectImpl();
+ sc.getEJBLocalBusinessObjectImpl();
localBusinessObjImpl.clearContext();
localBusinessObjImpl.setRemoved(true);
sc.setEJBLocalBusinessObjectImpl(null);
}
if (hasOptionalLocalBusinessView) {
EJBLocalObjectImpl optionalLocalBusinessObjImpl =
- (EJBLocalObjectImpl) sc.getOptionalEJBLocalBusinessObjectImpl();
+ sc.getOptionalEJBLocalBusinessObjectImpl();
optionalLocalBusinessObjImpl.clearContext();
optionalLocalBusinessObjImpl.setRemoved(true);
sc.setOptionalEJBLocalBusinessObjectImpl(null);
@@ -1411,6 +1431,7 @@
}
}
+ @Override
public boolean userTransactionMethodsAllowed(ComponentInvocation inv) {
boolean utMethodsAllowed = false;
@@ -1494,11 +1515,13 @@
}
+ @Override
protected EJBObjectImpl getEJBObjectImpl(byte[] instanceKey) {
SessionContextImpl sc = _getContextForInstance(instanceKey);
return sc.getEJBObjectImpl();
}
+ @Override
EJBObjectImpl getEJBRemoteBusinessObjectImpl(byte[] instanceKey) {
SessionContextImpl sc = _getContextForInstance(instanceKey);
return sc.getEJBRemoteBusinessObjectImpl();
@@ -1508,6 +1531,7 @@
* Called from EJBLocalObjectImpl.getLocalObject() while deserializing
* a local object reference.
*/
+ @Override
protected EJBLocalObjectImpl getEJBLocalObjectImpl(Object sessionKey) {
// Create an EJBLocalObject reference which
@@ -1532,6 +1556,7 @@
return localObjImpl;
}
+ @Override
EJBLocalObjectImpl getEJBLocalBusinessObjectImpl(Object sessionKey) {
// Create an EJBLocalObject reference which
@@ -1559,6 +1584,7 @@
return localBusinessObjImpl;
}
+ @Override
EJBLocalObjectImpl getOptionalEJBLocalBusinessObjectImpl(Object sessionKey) {
// Create an EJBLocalObject reference which
@@ -1591,17 +1617,19 @@
*
* @throws NoSuchObjectLocalException if the object has been removed.
*/
+ @Override
protected void checkExists(EJBLocalRemoteObject ejbObj) {
- if (ejbObj.isRemoved())
+ if (ejbObj.isRemoved()) {
throw new NoSuchObjectLocalException("Bean has been removed");
+ }
}
- private final void logTraceInfo(EjbInvocation inv, Object key, String message) {
+ private void logTraceInfo(EjbInvocation inv, Object key, String message) {
_logger.log(TRACE_LEVEL, traceInfoPrefix + message
+ " for " + inv.method.getName() + "; key: " + key);
}
- private final void logTraceInfo(SessionContextImpl sc, String message) {
+ private void logTraceInfo(SessionContextImpl sc, String message) {
_logger.log(TRACE_LEVEL, traceInfoPrefix + message
+ " for key: " + sc.getInstanceKey()
+ "; " + System.identityHashCode(sc));
@@ -1611,6 +1639,7 @@
* Called from preInvoke which is called from the EJBObject
* for local and remote invocations.
*/
+ @Override
public ComponentContext _getContext(EjbInvocation inv) {
EJBLocalRemoteObject ejbo = inv.ejbObject;
SessionContextImpl sc = ejbo.getContext();
@@ -1756,6 +1785,7 @@
return context;
}
+ @Override
public boolean isHAEnabled() {
return isHAEnabled;
}
@@ -1772,7 +1802,7 @@
if (ejbLRO != null) {
if (clientVersion ==
- sfsbVersionManager.NO_VERSION) {
+ SFSBVersionManager.NO_VERSION) {
clientVersion = ejbLRO.getSfsbClientVersion();
}
@@ -1825,6 +1855,7 @@
}
}
+ @Override
protected void postInvokeTx(EjbInvocation inv) throws Exception {
// Intercept postInvokeTx call to perform any @Remove logic
@@ -1884,6 +1915,7 @@
* Called from preInvoke which is called from the EJBObject for local and
* remote invocations.
*/
+ @Override
public void releaseContext(EjbInvocation inv) {
SessionContextImpl sc = (SessionContextImpl) inv.context;
@@ -1891,8 +1923,9 @@
// any instance lock is released in the finally block.
try {
// check if the bean was destroyed
- if (sc.getState() == BeanState.DESTROYED)
+ if (sc.getState() == BeanState.DESTROYED) {
return;
+ }
// we're sure that no concurrent thread can be using this
// context, so no need to synchronize.
@@ -1984,6 +2017,7 @@
}
+ @Override
protected void afterBegin(EJBContextImpl context) {
// TX_BEAN_MANAGED EJBs cannot implement SessionSynchronization
// Do not call afterBegin if it is a transactional lifecycle callback
@@ -2025,6 +2059,7 @@
}
+ @Override
protected void beforeCompletion(EJBContextImpl context) {
// SessionSync calls on TX_BEAN_MANAGED SessionBeans
// are not allowed
@@ -2067,6 +2102,7 @@
// Called from SyncImpl.afterCompletion
// May be called asynchronously during tx timeout
// or on the same thread as tx.commit
+ @Override
protected void afterCompletion(EJBContextImpl context, int status) {
if (context.getState() == BeanState.DESTROYED) {
return;
@@ -2237,13 +2273,14 @@
}
}
- public final boolean canPassivateEJB(ComponentContext context) {
+ public boolean canPassivateEJB(ComponentContext context) {
SessionContextImpl sc = (SessionContextImpl) context;
return (sc.getState() == BeanState.READY);
}
// called asynchronously from the Recycler
- public final boolean passivateEJB(ComponentContext context) {
+ @Override
+ public boolean passivateEJB(ComponentContext context) {
SessionContextImpl sc = (SessionContextImpl) context;
@@ -2258,8 +2295,9 @@
}
}
- if (sc.getState() == BeanState.DESTROYED)
+ if (sc.getState() == BeanState.DESTROYED) {
return false;
+ }
if (_logger.isLoggable(TRACE_LEVEL)) {
_logger.log(TRACE_LEVEL, traceInfoPrefix + "Passivating context "
@@ -2440,16 +2478,18 @@
}
- public final int getPassivationBatchCount() {
+ @Override
+ public int getPassivationBatchCount() {
return this.passivationBatchCount;
}
- public final void setPassivationBatchCount(int count) {
+ public void setPassivationBatchCount(int count) {
this.passivationBatchCount = count;
}
// called asynchronously from the Recycler
- public final boolean passivateEJB(StatefulEJBContext sfsbCtx) {
+ @Override
+ public boolean passivateEJB(StatefulEJBContext sfsbCtx) {
return passivateEJB((ComponentContext) sfsbCtx.getSessionContext());
}
@@ -2463,6 +2503,7 @@
}
// called from StatefulSessionStore
+ @Override
public void activateEJB(Object sessionKey, StatefulEJBContext sfsbCtx, Object cookie) {
SessionContextImpl context = (SessionContextImpl) sfsbCtx.getSessionContext();
@@ -2640,10 +2681,12 @@
}
}
+ @Override
public byte[] serializeContext(StatefulEJBContext ctx) throws IOException {
return serializeContext((SessionContextImpl)ctx.getSessionContext());
}
+ @Override
public Object deserializeData(byte[] data) throws Exception {
Object o = ejbContainerUtilImpl.getJavaEEIOUtils().deserializeObject(data, true, getClassLoader());
if (o instanceof SessionContextImpl) {
@@ -2658,7 +2701,7 @@
try (ByteArrayInputStream bis = new ByteArrayInputStream(sejb.serializedFields);
ObjectInputStream ois = ejbContainerUtilImpl.getJavaEEIOUtils().createObjectInputStream(bis, true, getClassLoader());) {
- ejb = ejbClass.newInstance();
+ ejb = ejbClass.getDeclaredConstructor().newInstance();
EJBUtils.deserializeObjectFields(ejb, ois, o, false);
ctx.setEJB(ejb);
}
@@ -2837,6 +2880,7 @@
}
}
+ @Override
public void invokePeriodically(long delay, long periodicity, Runnable target) {
java.util.Timer timer = ejbContainerUtilImpl.getTimer();
@@ -2851,14 +2895,14 @@
undeploy((SessionContextImpl) sfsbCtx.getSessionContext());
}
+ @Override
protected String[] getPre30LifecycleMethodNames() {
return new String[]{
null, null, "ejbRemove", "ejbPassivate", "ejbActivate"
};
}
- ;
-
+ @Override
protected void doConcreteContainerShutdown(boolean appBeingUndeployed) {
cancelAllTimerTasks();
@@ -3105,6 +3149,7 @@
}
// CacheListener interface
+ @Override
public void trimEvent(Object primaryKey, Object context) {
boolean addTask = false;
synchronized (asyncTaskSemaphore) {
@@ -3144,6 +3189,7 @@
private class ASyncPassivator implements Runnable {
+ @Override
public void run() {
final Thread currentThread = Thread.currentThread();
final ClassLoader previousClassLoader =
@@ -3159,6 +3205,7 @@
} else {
java.security.AccessController.doPrivileged
(new java.security.PrivilegedAction() {
+ @Override
public java.lang.Object run() {
currentThread.setContextClassLoader(myClassLoader);
return null;
@@ -3194,6 +3241,7 @@
} else {
java.security.AccessController.doPrivileged
(new java.security.PrivilegedAction() {
+ @Override
public java.lang.Object run() {
currentThread.setContextClassLoader
(previousClassLoader);
@@ -3444,13 +3492,13 @@
static class EEMRefInfoKey
implements Serializable {
- private String emRefName;
+ private final String emRefName;
- private long containerID;
+ private final long containerID;
- private Object instanceKey;
+ private final Object instanceKey;
- private int hc;
+ private final int hc;
EEMRefInfoKey(String en, long cid, Object ikey) {
this.emRefName = en;
@@ -3460,10 +3508,12 @@
this.hc = instanceKey.hashCode();
}
+ @Override
public int hashCode() {
return hc;
}
+ @Override
public boolean equals(Object obj) {
boolean result = false;
if (obj instanceof EEMRefInfoKey) {
@@ -3477,6 +3527,7 @@
return result;
}
+ @Override
public String toString() {
return "<" + instanceKey + ":" + emRefName + ":" + containerID + ">";
}
@@ -3487,11 +3538,11 @@
private transient int refCount = 0;
- private String unitName;
+ private final String unitName;
- private SynchronizationType synchronizationType;
+ private final SynchronizationType synchronizationType;
- private EEMRefInfoKey eemRefInfoKey;
+ private final EEMRefInfoKey eemRefInfoKey;
private byte[] serializedEEM;
@@ -3538,6 +3589,7 @@
}
//Method of IndirectlySerializable
+ @Override
public SerializableObjectFactory getSerializableObjectFactory()
throws IOException {
@@ -3560,6 +3612,7 @@
}
//Method of SerializableObjectFactory
+ @Override
public Object createObject()
throws IOException {
@@ -3596,6 +3649,7 @@
}
//Method of IndirectlySerializable
+ @Override
public SerializableObjectFactory getSerializableObjectFactory()
throws IOException {
@@ -3603,6 +3657,7 @@
}
//Method of SerializableObjectFactory
+ @Override
public Object createObject() throws IOException {
return this;
}
@@ -3619,12 +3674,14 @@
this.ejbContainerUtil = ejbContainerUtil;
}
+ @Override
public void run() {
if (!task.isExecuting()) {
ejbContainerUtil.addWork(task);
}
}
+ @Override
public boolean cancel() {
boolean cancelled = super.cancel();
@@ -3651,6 +3708,7 @@
}
//This will be called with the correct ClassLoader
+ @Override
public void run() {
ClassLoader prevCL = Thread.currentThread().getContextClassLoader();
try {
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/StatelessSessionContainer.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/StatelessSessionContainer.java
index 9df09b4..42612ed 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/StatelessSessionContainer.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/StatelessSessionContainer.java
@@ -19,8 +19,6 @@
import java.lang.reflect.Method;
import java.rmi.RemoteException;
-import java.util.HashMap;
-import java.util.Map;
import java.util.logging.Level;
import jakarta.ejb.CreateException;
@@ -153,11 +151,13 @@
return true;
}
+ @Override
protected EjbMonitoringStatsProvider getMonitoringStatsProvider(
String appName, String modName, String ejbName) {
return new StatelessSessionBeanStatsProvider(this, getContainerId(), appName, modName, ejbName);
}
+ @Override
protected void initializeHome()
throws Exception
{
@@ -234,6 +234,7 @@
poolProp.poolIdleTimeoutInSeconds, loader, Boolean.parseBoolean(val));
}
+ @Override
protected void registerMonitorableComponents() {
super.registerMonitorableComponents();
@@ -245,9 +246,11 @@
_logger.log(Level.FINE, "[SLSB Container] registered monitorable");
}
+ @Override
public void onReady() {
}
+ @Override
public EJBObjectImpl createRemoteBusinessObjectImpl()
throws CreateException, RemoteException
{
@@ -266,6 +269,7 @@
/**
*
*/
+ @Override
public EJBObjectImpl createEJBObjectImpl()
throws CreateException, RemoteException
{
@@ -289,6 +293,7 @@
/**
* Called during client creation request through EJB LocalHome view.
*/
+ @Override
public EJBLocalObjectImpl createEJBLocalObjectImpl()
throws CreateException
{
@@ -312,6 +317,7 @@
/**
* Called during internal creation of session bean
*/
+ @Override
public EJBLocalObjectImpl createEJBLocalBusinessObjectImpl(boolean localBeanView)
throws CreateException
{
@@ -327,6 +333,7 @@
// Called from EJBObjectImpl.remove, EJBLocalObjectImpl.remove,
// EJBHomeImpl.remove(Handle).
+ @Override
protected void removeBean(EJBLocalRemoteObject ejbo, Method removeMethod,
boolean local)
throws RemoveException, EJBException, RemoteException
@@ -346,9 +353,11 @@
* Note: EJB2.0 section 18.3.1 says that discarding an EJB
* means that no methods other than finalize() should be invoked on it.
*/
+ @Override
protected void forceDestroyBean(EJBContextImpl sc) {
- if ( sc.getState() == EJBContextImpl.BeanState.DESTROYED )
- return;
+ if ( sc.getState() == EJBContextImpl.BeanState.DESTROYED ) {
+ return;
+ }
// mark context as destroyed
sc.setState(EJBContextImpl.BeanState.DESTROYED);
@@ -361,10 +370,12 @@
/**
* Called when a remote invocation arrives for an EJB.
*/
+ @Override
protected EJBObjectImpl getEJBObjectImpl(byte[] instanceKey) {
return theEJBObjectImpl;
}
+ @Override
EJBObjectImpl getEJBRemoteBusinessObjectImpl(byte[] instanceKey) {
return theRemoteBusinessObjectImpl;
}
@@ -373,6 +384,7 @@
* Called from EJBLocalObjectImpl.getLocalObject() while deserializing
* a local object reference.
*/
+ @Override
protected EJBLocalObjectImpl getEJBLocalObjectImpl(Object key) {
return theEJBLocalObjectImpl;
}
@@ -381,6 +393,7 @@
* Called from EJBLocalObjectImpl.getLocalObject() while deserializing
* a local business object reference.
*/
+ @Override
EJBLocalObjectImpl getEJBLocalBusinessObjectImpl(Object key) {
return theEJBLocalBusinessObjectImpl;
}
@@ -389,6 +402,7 @@
* Called from EJBLocalObjectImpl.getLocalObject() while deserializing
* a local business object reference.
*/
+ @Override
EJBLocalObjectImpl getOptionalEJBLocalBusinessObjectImpl(Object key) {
return theOptionalEJBLocalBusinessObjectImpl;
}
@@ -398,6 +412,7 @@
* Called from preInvoke which is called from the EJBObject
* for local and remote invocations.
*/
+ @Override
protected ComponentContext _getContext(EjbInvocation inv) {
try {
SessionContextImpl sessionCtx =
@@ -409,6 +424,7 @@
}
}
+ @Override
protected EJBContextImpl _constructEJBContextImpl(Object instance) {
return new SessionContextImpl(instance, this);
}
@@ -483,7 +499,7 @@
// EJBContext methods not allowed will throw exceptions
context.setState(EJBContextImpl.BeanState.POOLED);
} catch ( Throwable th ) {
- _logger.log(Level.SEVERE, "ejb.stateless_ejbcreate_exception", logParams);
+ _logger.log(Level.SEVERE, "ejb.stateless_ejbcreate_exception", containerInfo);
CreateException creEx = new CreateException("Could not create stateless EJB");
creEx.initCause(th);
throw creEx;
@@ -503,6 +519,7 @@
}
}
+ @Override
protected void doTimerInvocationInit(EjbInvocation inv, Object primaryKey)
throws Exception {
// TODO I don't understand this check. What is ejbObject used for?
@@ -515,6 +532,7 @@
}
}
+ @Override
public boolean userTransactionMethodsAllowed(ComponentInvocation inv) {
boolean utMethodsAllowed = false;
if( isBeanManagedTran ) {
@@ -535,12 +553,14 @@
* Called from preInvoke which is called from the EJBObject
* for local and remote invocations.
*/
+ @Override
public void releaseContext(EjbInvocation inv) {
SessionContextImpl sc = (SessionContextImpl)inv.context;
// check if the bean was destroyed
- if ( sc.getState() == EJBContextImpl.BeanState.DESTROYED )
+ if ( sc.getState() == EJBContextImpl.BeanState.DESTROYED ) {
return;
+ }
sc.setState(EJBContextImpl.BeanState.POOLED);
@@ -552,38 +572,34 @@
}
+ @Override
protected boolean isIdentical(EJBObjectImpl ejbo, EJBObject other)
throws RemoteException
{
if ( other == ejbo.getStub() ) {
return true;
- }else {
- try {
- // other may be a stub for a remote object.
- // Although all stateless sessionbeans for a bean type
- // are identical, we dont know whether other is of the
- // same bean type as ejbo.
- if ( getProtocolManager().isIdentical(ejbo.getStub(), other) )
- return true;
- else
- return false;
- } catch ( Exception ex ) {
- if(_logger.isLoggable(Level.SEVERE)) {
- _logger.log(Level.SEVERE,"ejb.ejb_getstub_exception",
- logParams);
- _logger.log(Level.SEVERE,"",ex);
- }
- throw new RemoteException("Error during isIdentical.", ex);
- }
}
-
+ try {
+ // other may be a stub for a remote object.
+ // Although all stateless sessionbeans for a bean type
+ // are identical, we dont know whether other is of the
+ // same bean type as ejbo.
+ return getProtocolManager().isIdentical(ejbo.getStub(), other);
+ } catch ( Exception ex ) {
+ if(_logger.isLoggable(Level.SEVERE)) {
+ _logger.log(Level.SEVERE,"ejb.ejb_getstub_exception", containerInfo);
+ _logger.log(Level.SEVERE,"",ex);
+ }
+ throw new RemoteException("Error during isIdentical.", ex);
+ }
}
/**
* Check if the given EJBObject/LocalObject has been removed.
* @exception NoSuchObjectLocalException if the object has been removed.
*/
+ @Override
protected void checkExists(EJBLocalRemoteObject ejbObj)
{
// For stateless session beans, EJBObject/EJBLocalObj are never removed.
@@ -591,16 +607,19 @@
}
+ @Override
protected void afterBegin(EJBContextImpl context) {
// Stateless SessionBeans cannot implement SessionSynchronization!!
// EJB2.0 Spec 7.8.
}
+ @Override
protected void beforeCompletion(EJBContextImpl context) {
// Stateless SessionBeans cannot implement SessionSynchronization!!
// EJB2.0 Spec 7.8.
}
+ @Override
protected void afterCompletion(EJBContextImpl ctx, int status) {
// Stateless SessionBeans cannot implement SessionSynchronization!!
// EJB2.0 Spec 7.8.
@@ -609,6 +628,7 @@
}
// default
+ @Override
public boolean passivateEJB(ComponentContext context) {
return false;
}
@@ -616,15 +636,8 @@
// default
public void activateEJB(Object ctx, Object instanceKey) {}
-/** TODO ???
- public void appendStats(StringBuffer sbuf) {
- sbuf.append("\nStatelessContainer: ")
- .append("CreateCount=").append(statCreateCount).append("; ")
- .append("RemoveCount=").append(statRemoveCount).append("; ")
- .append("]");
- }
-**/
+ @Override
protected void doConcreteContainerShutdown(boolean appBeingUndeployed) {
try {
@@ -666,6 +679,7 @@
implements ObjectFactory
{
+ @Override
public Object create(Object param) {
try {
return createStatelessEJB();
@@ -674,6 +688,7 @@
}
}
+ @Override
public void destroy(Object obj) {
SessionContextImpl sessionCtx = (SessionContextImpl) obj;
// Note: stateless SessionBeans cannot have incomplete transactions
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/interceptors/InterceptorManager.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/interceptors/InterceptorManager.java
index 4ab646c..23b20b3 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/interceptors/InterceptorManager.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/interceptors/InterceptorManager.java
@@ -62,20 +62,20 @@
// Set when initializing interceptors for a non-ejb
private InterceptorInfo interceptorInfo;
- private ClassLoader loader;
+ private final ClassLoader loader;
- private Class beanClass;
+ private final Class beanClass;
- private String beanClassName;
+ private final String beanClassName;
- private Logger _logger;
+ private final Logger _logger;
private Class[] interceptorClasses;
private Class[] serializableInterceptorClasses;
- private Map<String, Integer> instanceIndexMap
- = new HashMap<String, Integer>();
+ private final Map<String, Integer> instanceIndexMap
+ = new HashMap<>();
private boolean interceptorsExists;
@@ -88,7 +88,7 @@
// Optionally specified delegate to be set on SystemInterceptorProxy
private Object runtimeInterceptor;
- List<InterceptorDescriptor> frameworkInterceptors = new LinkedList<InterceptorDescriptor>();
+ List<InterceptorDescriptor> frameworkInterceptors = new LinkedList<>();
public InterceptorManager(Logger _logger, BaseContainer container,
@@ -191,7 +191,7 @@
MethodDescriptor mDesc, Method beanMethod) {
ArrayList<AroundInvokeInterceptor> interceptors =
- new ArrayList<AroundInvokeInterceptor>();
+ new ArrayList<>();
for(InterceptorDescriptor interceptor : frameworkInterceptors) {
Set<LifecycleCallbackDescriptor> aroundInvokeDescs =
@@ -252,7 +252,7 @@
ArrayList<AroundInvokeInterceptor> interceptors =
- new ArrayList<AroundInvokeInterceptor>();
+ new ArrayList<>();
for(InterceptorDescriptor interceptor : frameworkInterceptors) {
@@ -279,7 +279,7 @@
List<EjbInterceptor> list = (ejbDesc != null) ?
ejbDesc.getAroundTimeoutInterceptors(mDesc) :
- new LinkedList<EjbInterceptor>();
+ new LinkedList<>();
for (EjbInterceptor interceptor : list) {
String className = interceptor.getInterceptorClassName();
@@ -475,16 +475,12 @@
serializableInterceptorClasses = new Class[size];
int index = 0;
for (Class<?> interClass : classes) {
-
interceptorClasses[index] = interClass;
serializableInterceptorClasses[index] = interClass;
instanceIndexMap.put(interClass.getName(), index);
if (!Serializable.class.isAssignableFrom(interClass)) {
-
- serializableInterceptorClasses[index] =
- EJBUtils.loadGeneratedSerializableClass(interClass.getClassLoader(),
- interClass.getName());
-
+ serializableInterceptorClasses[index] = EJBUtils
+ .loadGeneratedSerializableClass(interClass.getClassLoader(), interClass);
}
index++;
}
@@ -576,7 +572,7 @@
private void initCallbackIndices(List<InterceptorDescriptor> callbackList,
CallbackType callbackType) throws Exception {
- ArrayList<CallbackInterceptor> callbacks = new ArrayList<CallbackInterceptor>();
+ ArrayList<CallbackInterceptor> callbacks = new ArrayList<>();
int index = callbackType.ordinal();
@@ -617,7 +613,7 @@
private List<CallbackInterceptor> createCallbackInterceptors(CallbackType eventType,
InterceptorDescriptor inter,
ClassLoader classLoaderToUse) throws Exception {
- List<CallbackInterceptor> callbackList = new ArrayList<CallbackInterceptor>();
+ List<CallbackInterceptor> callbackList = new ArrayList<>();
List<LifecycleCallbackDescriptor> orderedCallbackMethods =
inter.getOrderedCallbackDescriptors(eventType, classLoaderToUse);
@@ -761,7 +757,7 @@
public interface AroundInvokeContext extends InvocationContext {
- public Object[] getInterceptorInstances();
+ Object[] getInterceptorInstances();
/**
* Called from Interceptor Chain to invoke the actual bean method.
@@ -771,13 +767,13 @@
* interceptor code, so it must not be changed in order for any exception
* handling logic in that code to function properly.
*/
- public Object invokeBeanMethod()
+ Object invokeBeanMethod()
throws Throwable;
}
public interface InterceptorChain {
- public Object invokeNext(int index, AroundInvokeContext invCtx)
+ Object invokeNext(int index, AroundInvokeContext invCtx)
throws Throwable;
}
diff --git a/appserver/ejb/ejb-container/src/test/java/com/sun/ejb/EJBUtilsTest.java b/appserver/ejb/ejb-container/src/test/java/com/sun/ejb/EJBUtilsTest.java
index 7aa18e0..4c38299 100644
--- a/appserver/ejb/ejb-container/src/test/java/com/sun/ejb/EJBUtilsTest.java
+++ b/appserver/ejb/ejb-container/src/test/java/com/sun/ejb/EJBUtilsTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 Eclipse Foundation and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021-2022 Eclipse Foundation and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -16,32 +16,15 @@
package com.sun.ejb;
-import com.sun.ejb.codegen.ClassGeneratorFactory;
-import com.sun.ejb.codegen.Generator;
-import com.sun.ejb.codegen.Remote30WrapperGenerator;
-import com.sun.ejb.codegen.ServiceInterfaceGenerator;
-
-import java.util.Collection;
-import java.util.concurrent.TimeUnit;
-
+import com.sun.ejb.codegen.EjbClassGeneratorFactory;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
-import org.openjdk.jmh.annotations.Benchmark;
-import org.openjdk.jmh.annotations.Mode;
-import org.openjdk.jmh.results.Result;
-import org.openjdk.jmh.results.RunResult;
-import org.openjdk.jmh.runner.Runner;
-import org.openjdk.jmh.runner.options.Options;
-import org.openjdk.jmh.runner.options.OptionsBuilder;
-import org.openjdk.jmh.runner.options.TimeValue;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.hasSize;
-import static org.hamcrest.Matchers.lessThan;
-import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -52,100 +35,51 @@
@TestMethodOrder(OrderAnnotation.class)
public class EJBUtilsTest {
- /**
- * The value shall be high enough to pass on all standard environments,
- * but lower than when we are generating classes. See warmup results in logs.
- */
- private static final double MAX_TIME_PER_OPERATION = 2_000_000d;
private static final ClassLoader loader = EJBUtilsTest.class.getClassLoader();
- private static double firstRunScore;
- @Test
- @Order(1)
- public void generateAndLoad_firstRun() throws Exception {
- Options options = new OptionsBuilder()
- .include(getClass().getName() + ".*")
- .warmupIterations(0)
- .measurementIterations(1).forks(1).measurementTime(TimeValue.milliseconds(50L))
- // should be able to detect deadlocks and race conditions when generating classes
- .threads(100).timeout(TimeValue.seconds(5L))
- .timeUnit(TimeUnit.MICROSECONDS)
- .mode(Mode.SingleShotTime).shouldFailOnError(true)
- .build();
+ private EjbClassGeneratorFactory factory;
- Collection<RunResult> results = new Runner(options).run();
- assertThat(results, hasSize(1));
- Result<?> primaryResult = results.iterator().next().getPrimaryResult();
- firstRunScore = primaryResult.getScore();
- assertThat(primaryResult.getScore(), lessThan(MAX_TIME_PER_OPERATION));
+ @BeforeEach
+ public void createFactory() {
+ factory = new EjbClassGeneratorFactory(loader);
}
-
- @Test
- @Order(2)
- public void generateAndLoad_Benchmark() throws Exception {
- Options options = new OptionsBuilder()
- .include(getClass().getName() + ".*")
- .warmupBatchSize(1).warmupForks(0).warmupIterations(1).warmupTime(TimeValue.milliseconds(50L))
- .measurementIterations(1).forks(1).measurementTime(TimeValue.milliseconds(200L))
- // should be able to detect race conditions when loading classes generated in previous test
- .threads(100).timeout(TimeValue.seconds(5L))
- .timeUnit(TimeUnit.MICROSECONDS)
- .mode(Mode.AverageTime).shouldFailOnError(true)
- .build();
-
- Collection<RunResult> results = new Runner(options).run();
- assertThat(results, hasSize(1));
- Result<?> primaryResult = results.iterator().next().getPrimaryResult();
- assertThat(primaryResult.getScore(), lessThan(firstRunScore / 4));
- }
-
-
- @Benchmark
- public void generateAndLoad() throws Exception {
- // random interface for the test
- String interfaceName = ClassGeneratorFactory.class.getName();
- Generator generator = new Remote30WrapperGenerator(loader, interfaceName, interfaceName);
- Class<?> newClass = EJBUtils.generateAndLoad(generator, loader);
- assertNotNull(newClass);
- assertEquals(generator.getGeneratedClassName(), newClass.getName());
+ @AfterEach
+ public void closeFactory() {
+ factory.close();
}
@Test
@Order(10)
public void loadGeneratedRemoteBusinessClasses() throws Exception {
- EJBUtils.loadGeneratedRemoteBusinessClasses(EjbUtilsTestInterface.class.getName());
- Class<?> ifaceRemote = loader.loadClass("com.sun.ejb._EJBUtilsTest$EjbUtilsTestInterface_Remote");
+ Class<?> remoteIface = factory.ensureRemote(GeneratorTestExperiment.class.getName());
+ assertEquals("com.sun.ejb._GeneratorTestExperiment_Remote", remoteIface.getName());
+ Class<?> ifaceRemote = loader.loadClass("com.sun.ejb._GeneratorTestExperiment_Remote");
assertTrue(ifaceRemote.isInterface());
- Class<?> iface30 = loader.loadClass("com.sun.ejb.EJBUtilsTest$EjbUtilsTestInterface");
- assertTrue(iface30.isInterface());
- assertDoesNotThrow(() -> EJBUtils.loadGeneratedRemoteBusinessClasses(EjbUtilsTestInterface.class.getName()));
+ Class<?> iface30 = loader.loadClass("com.sun.ejb._GeneratorTestExperiment_Wrapper");
+ assertFalse(iface30.isInterface());
+ assertEquals(remoteIface, factory.ensureRemote(GeneratorTestExperiment.class.getName()));
}
@Test
@Order(20)
public void loadGeneratedGenericEJBHomeClass() throws Exception {
- Class<?> newClass = EJBUtils.loadGeneratedGenericEJBHomeClass(loader);
+ Class<?> newClass = EJBUtils.loadGeneratedGenericEJBHomeClass(loader, GeneratorTestExperiment.class);
assertNotNull(newClass);
assertTrue(newClass.isInterface());
assertEquals("com.sun.ejb.codegen.GenericEJBHome_Generated", newClass.getName());
- assertSame(newClass, EJBUtils.loadGeneratedGenericEJBHomeClass(loader));
+ assertSame(newClass, factory.ensureGenericHome(GeneratorTestExperiment.class));
}
@Test
@Order(30)
public void generateSEI() throws Exception {
- Generator generator = new ServiceInterfaceGenerator(ClassGeneratorFactory.class);
- Class<?> newClass = EJBUtils.generateSEI(generator, loader);
+ Class<?> newClass = factory.ensureServiceInterface(GeneratorTestExperiment.class);
assertNotNull(newClass);
- assertEquals(generator.getGeneratedClassName(), newClass.getName());
- }
-
-
- interface EjbUtilsTestInterface {
- void doSomething();
+ assertEquals("com.sun.ejb.GeneratorTestExperiment_GeneratedSEI", newClass.getName());
+ assertSame(newClass, factory.ensureServiceInterface(GeneratorTestExperiment.class));
}
}
diff --git a/appserver/ejb/ejb-container/src/test/java/com/sun/ejb/EjbClassGeneratorFactoryBenchmarkTest.java b/appserver/ejb/ejb-container/src/test/java/com/sun/ejb/EjbClassGeneratorFactoryBenchmarkTest.java
new file mode 100644
index 0000000..d14582f
--- /dev/null
+++ b/appserver/ejb/ejb-container/src/test/java/com/sun/ejb/EjbClassGeneratorFactoryBenchmarkTest.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2021-2022 Eclipse Foundation and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package com.sun.ejb;
+
+import com.sun.ejb.codegen.EjbClassGeneratorFactory;
+import java.util.Collection;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestMethodOrder;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.results.Result;
+import org.openjdk.jmh.results.RunResult;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+import org.openjdk.jmh.runner.options.TimeValue;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.hasSize;
+import static org.hamcrest.Matchers.lessThan;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+/**
+ * @author David Matejcek
+ */
+@TestMethodOrder(OrderAnnotation.class)
+public class EjbClassGeneratorFactoryBenchmarkTest {
+
+ /**
+ * The value shall be high enough to pass on all standard environments,
+ * but lower than when we are generating classes. See warmup results in logs.
+ */
+ private static final double MAX_TIME_PER_OPERATION = 2_000_000d;
+ private static final ClassLoader loader = EjbClassGeneratorFactoryBenchmarkTest.class.getClassLoader();
+ private static double firstRunScore;
+
+
+ @Test
+ @Order(1)
+ public void generate_firstRun() throws Exception {
+ Options options = new OptionsBuilder()
+ .include(getClass().getName() + ".*")
+ .warmupIterations(0)
+ .measurementIterations(1).forks(1).measurementTime(TimeValue.milliseconds(50L))
+ // should be able to detect deadlocks and race conditions when generating classes
+ .threads(100).timeout(TimeValue.seconds(5L))
+ .timeUnit(TimeUnit.MICROSECONDS)
+ .mode(Mode.SingleShotTime).shouldFailOnError(true)
+ .build();
+
+ Collection<RunResult> results = new Runner(options).run();
+ assertThat(results, hasSize(1));
+ Result<?> primaryResult = results.iterator().next().getPrimaryResult();
+ firstRunScore = primaryResult.getScore();
+ assertThat(primaryResult.getScore(), lessThan(MAX_TIME_PER_OPERATION));
+ }
+
+
+ @Test
+ @Order(2)
+ public void generate_benchmark() throws Exception {
+ Options options = new OptionsBuilder()
+ .include(getClass().getName() + ".*")
+ .warmupBatchSize(1).warmupForks(0).warmupIterations(1).warmupTime(TimeValue.milliseconds(50L))
+ .measurementIterations(1).forks(1).measurementTime(TimeValue.milliseconds(200L))
+ // should be able to detect race conditions when loading classes generated in previous test
+ .threads(100).timeout(TimeValue.seconds(5L))
+ .timeUnit(TimeUnit.MICROSECONDS)
+ .mode(Mode.AverageTime).shouldFailOnError(true)
+ .build();
+
+ Collection<RunResult> results = new Runner(options).run();
+ assertThat(results, hasSize(1));
+ Result<?> primaryResult = results.iterator().next().getPrimaryResult();
+ assertThat(primaryResult.getScore(), lessThan(firstRunScore / 4));
+ }
+
+
+ @Benchmark
+ public void ensureRemoteBenchmark() throws Exception {
+ final Class<?> newClass;
+ try (EjbClassGeneratorFactory factory = new EjbClassGeneratorFactory(loader)) {
+ newClass = factory.ensureRemote(TestInterface.class.getName());
+ }
+ assertNotNull(newClass);
+ assertEquals("com.sun.ejb._EjbClassGeneratorFactoryBenchmarkTest$TestInterface_Remote", newClass.getName());
+ }
+
+ interface TestInterface {
+ void doSomething();
+ }
+}
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/InvalidHome.java b/appserver/ejb/ejb-container/src/test/java/com/sun/ejb/GeneratorTestExperiment.java
similarity index 66%
rename from appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/InvalidHome.java
rename to appserver/ejb/ejb-container/src/test/java/com/sun/ejb/GeneratorTestExperiment.java
index 665c754..8405475 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/InvalidHome.java
+++ b/appserver/ejb/ejb-container/src/test/java/com/sun/ejb/GeneratorTestExperiment.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022 Eclipse Foundation and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -14,14 +14,13 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
-package com.sun.ejb.codegen;
+package com.sun.ejb;
-public class InvalidHome extends GeneratorException {
- /**
- * Constructs the InvalidHome exception with the specified string.
- */
- public InvalidHome(String s) {
- super(s);
- }
+/**
+ * @author David Matejcek
+ */
+public interface GeneratorTestExperiment {
+
+ String sayHello();
}
diff --git a/appserver/ejb/ejb-full-container/src/main/java/org/glassfish/ejb/persistent/timer/PersistentEJBTimerService.java b/appserver/ejb/ejb-full-container/src/main/java/org/glassfish/ejb/persistent/timer/PersistentEJBTimerService.java
index da973f0..33f1dd0 100755
--- a/appserver/ejb/ejb-full-container/src/main/java/org/glassfish/ejb/persistent/timer/PersistentEJBTimerService.java
+++ b/appserver/ejb/ejb-full-container/src/main/java/org/glassfish/ejb/persistent/timer/PersistentEJBTimerService.java
@@ -26,7 +26,6 @@
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -76,7 +75,7 @@
*/
public class PersistentEJBTimerService extends EJBTimerService {
- private TimerLocal timerLocal_;
+ private final TimerLocal timerLocal_;
private static final Logger logger =
LogDomains.getLogger(PersistentEJBTimerService.class, LogDomains.EJB_LOGGER);
@@ -160,6 +159,7 @@
/**
* Provide a count of timers owned by each server
*/
+ @Override
public String[] listTimers( String[] serverIds ) {
String[] totalTimers = null;
try {
@@ -177,6 +177,7 @@
/**
* Take ownership of another server's timers.
*/
+ @Override
public int migrateTimers(String fromOwnerId) {
String ownerIdOfThisServer = getOwnerIdOfThisServer();
@@ -276,6 +277,7 @@
} //migrateTimers()
+ @Override
public boolean isPersistent() {
return true;
}
@@ -419,7 +421,7 @@
Map timersToRestore = new HashMap();
Set timerIdsToRemove = new HashSet();
- Set<TimerState> result = new HashSet<TimerState>();
+ Set<TimerState> result = new HashSet<>();
for(TimerState timer: timersEligibleForRestoration) {
@@ -452,7 +454,7 @@
// an entity bean. That allows us to lazily load the underlying
// blob for stateless session and message-driven bean timers.
Object timedObjectPrimaryKey = null;
- if( container.getContainerType() == BaseContainer.ContainerType.ENTITY) {
+ if (container.getContainerInfo().type == BaseContainer.ContainerType.ENTITY) {
timedObjectPrimaryKey = timer.getTimedObjectPrimaryKey();
}
@@ -570,16 +572,13 @@
timerLocal_.remove(timerIdsToRemove);
}
- for(Iterator entries = timersToRestore.entrySet().iterator();
- entries.hasNext(); ) {
- Map.Entry next = (Map.Entry) entries.next();
+ for (Object element : timersToRestore.entrySet()) {
+ Map.Entry next = (Map.Entry) element;
RuntimeTimerState nextTimer = (RuntimeTimerState) next.getKey();
- TimerPrimaryKey timerId = nextTimer.getTimerId();
+ TimerPrimaryKey timerId = nextTimer.getTimerId();
Date expiration = (Date) next.getValue();
scheduleTask(timerId, expiration);
- logger.log(Level.FINE,
- "EJBTimerService.restoreTimers(), scheduling timer " +
- nextTimer);
+ logger.log(Level.FINE, "EJBTimerService.restoreTimers(), scheduling timer " + nextTimer);
}
logger.log(Level.FINE, "DONE EJBTimerService.restoreTimers()");
@@ -708,14 +707,14 @@
Map<Method, List<ScheduledTimerDescriptor>> schedules,
boolean deploy) {
- Map<TimerPrimaryKey, Method> result = new HashMap<TimerPrimaryKey, Method>();
+ Map<TimerPrimaryKey, Method> result = new HashMap<>();
TransactionManager tm = ejbContainerUtil.getTransactionManager();
try {
tm.begin();
Set<TimerState> timers = _restoreTimers(
- (Set<TimerState>)timerLocal_.findActiveTimersOwnedByThisServerByContainer(containerId));
+ timerLocal_.findActiveTimersOwnedByThisServerByContainer(containerId));
if (timers.size() > 0) {
logger.log(Level.FINE, "Found " + timers.size() +
@@ -756,9 +755,10 @@
* Called in a clustered environment to eagerly create automatic persistent timers
* on the specific server instance.
*/
+ @Override
public void createSchedulesOnServer(EjbDescriptor ejbDescriptor, String server_name) {
Map<MethodDescriptor, List<ScheduledTimerDescriptor>> schedules =
- new HashMap<MethodDescriptor, List<ScheduledTimerDescriptor>>();
+ new HashMap<>();
for (ScheduledTimerDescriptor schd : ejbDescriptor.getScheduledTimerDescriptors()) {
MethodDescriptor method = schd.getTimeoutMethod();
if (method != null && schd.getPersistent()) {
@@ -768,7 +768,7 @@
List<ScheduledTimerDescriptor> list = schedules.get(method);
if (list == null) {
- list = new ArrayList<ScheduledTimerDescriptor>();
+ list = new ArrayList<>();
schedules.put(method, list);
}
list.add(schd);
@@ -794,6 +794,7 @@
* Only persistent schedule based timers for the containerId that has no timers associated
* with it, will be created. And no timers will be scheduled.
*/
+ @Override
public void createSchedules(long containerId, long applicationId,
Map<MethodDescriptor, List<ScheduledTimerDescriptor>> methodDescriptorSchedules, String server_name) {
TransactionManager tm = ejbContainerUtil.getTransactionManager();
@@ -894,7 +895,7 @@
// timer cache to avoid some database access in PE/SE, or
// even in EE with the appropriate consistency tradeoff.
- Collection<TimerPrimaryKey> timerIdsForTimedObject = new HashSet<TimerPrimaryKey>();
+ Collection<TimerPrimaryKey> timerIdsForTimedObject = new HashSet<>();
if (timedObjectPrimaryKey == null) {
timerIdsForTimedObject = timerLocal_.findActiveTimerIdsByContainer(containerId);
@@ -921,7 +922,7 @@
*/
@Override
protected Collection<TimerPrimaryKey> getTimerIds(Collection<Long> containerIds) {
- Collection<TimerPrimaryKey> timerIds = new HashSet<TimerPrimaryKey>(super.getTimerIds(containerIds));
+ Collection<TimerPrimaryKey> timerIds = new HashSet<>(super.getTimerIds(containerIds));
timerIds.addAll(timerLocal_.findActiveTimerIdsByContainers(containerIds));
return timerIds;
}
@@ -1486,6 +1487,7 @@
success = h.executeDDLStatement(
dir.getCanonicalPath() + "/ejbtimer_upgrade_", resource);
ConfigSupport.apply(new SingleConfigCode<Property>() {
+ @Override
public Object run(Property p) throws PropertyVetoException, TransactionFailure {
p.setValue("true");
return null;
diff --git a/appserver/extras/javaee/manifest-jar/pom.xml b/appserver/extras/javaee/manifest-jar/pom.xml
index 395fe97..fb0e2c3 100644
--- a/appserver/extras/javaee/manifest-jar/pom.xml
+++ b/appserver/extras/javaee/manifest-jar/pom.xml
@@ -37,7 +37,7 @@
<configuration>
<archive>
<manifestEntries>
- <Class-Path>../modules/jakarta.servlet-api.jar ../modules/jakarta.annotation-api.jar ../modules/jakarta.ejb-api.jar ../modules/jakarta.transaction-api.jar ../modules/jakarta.management.j2ee-api.jar ../modules/jakarta.resource-api.jar ../modules/jakarta.authentication-api.jar ../modules/jakarta.authorization-api.jar ../modules/jakarta.xml.bind-api.jar ../modules/webservices-api-osgi.jar ../modules/jakarta.mail-api.jar ../modules/jakarta.activation-api.jar ../modules/jakarta.faces.jar ../modules/jakarta.servlet.jsp-api.jar ../modules/jakarta.el.jar ../modules/jakarta.el-api.jar ../modules/jakarta.servlet.jsp.jstl-api.jar ../modules/jakarta.persistence-api.jar ../modules/jakarta.jms-api.jar ../modules/hibernate-validator.jar ../modules/jakarta.validation-api.jar ../modules/cdi-api.jar ../modules/jakarta.ws.rs-api.jar ../modules/jakarta.json.jar ../modules/jakarta.json.bind-api.jar ../modules/jakarta.websocket-api.jar ../modules/jakarta.enterprise.concurrent-api.jar ../modules/jakarta.batch-api.jar ../modules/jakarta.inject-api.jar</Class-Path>
+ <Class-Path>../modules/jakarta.servlet-api.jar ../modules/jakarta.annotation-api.jar ../modules/jakarta.ejb-api.jar ../modules/jakarta.transaction-api.jar ../modules/jakarta.resource-api.jar ../modules/jakarta.authentication-api.jar ../modules/jakarta.authorization-api.jar ../modules/jakarta.xml.bind-api.jar ../modules/webservices-api-osgi.jar ../modules/jakarta.mail-api.jar ../modules/jakarta.activation-api.jar ../modules/jakarta.faces.jar ../modules/jakarta.servlet.jsp-api.jar ../modules/jakarta.el.jar ../modules/jakarta.el-api.jar ../modules/jakarta.servlet.jsp.jstl-api.jar ../modules/jakarta.persistence-api.jar ../modules/jakarta.jms-api.jar ../modules/hibernate-validator.jar ../modules/jakarta.validation-api.jar ../modules/cdi-api.jar ../modules/jakarta.ws.rs-api.jar ../modules/jakarta.json.jar ../modules/jakarta.json.bind-api.jar ../modules/jakarta.websocket-api.jar ../modules/jakarta.enterprise.concurrent-api.jar ../modules/jakarta.batch-api.jar ../modules/jakarta.inject-api.jar</Class-Path>
<GlassFish-ServerExcluded>true</GlassFish-ServerExcluded>
</manifestEntries>
</archive>
diff --git a/appserver/persistence/entitybean-container/src/main/java/org/glassfish/persistence/ejb/entitybean/container/EntityContainer.java b/appserver/persistence/entitybean-container/src/main/java/org/glassfish/persistence/ejb/entitybean/container/EntityContainer.java
index 7d84301..cef20a5 100644
--- a/appserver/persistence/entitybean-container/src/main/java/org/glassfish/persistence/ejb/entitybean/container/EntityContainer.java
+++ b/appserver/persistence/entitybean-container/src/main/java/org/glassfish/persistence/ejb/entitybean/container/EntityContainer.java
@@ -169,7 +169,8 @@
implements CacheListener
{
- private ThreadLocal ejbServant = new ThreadLocal() {
+ private final ThreadLocal ejbServant = new ThreadLocal() {
+ @Override
protected Object initialValue() {
return null;
}
@@ -276,10 +277,10 @@
super.createCallFlowAgent(
isContainerManagedPers ? ComponentType.CMP : ComponentType.BMP);
- _logger.log(Level.FINE,"[EntityContainer] Created EntityContainer: "
- + logParams[0]);
+ _logger.log(Level.FINE,"[EntityContainer] Created EntityContainer: {0}", containerInfo);
}
+ @Override
protected void preInitialize(EjbDescriptor desc, ClassLoader loader) {
EjbEntityDescriptor ed = (EjbEntityDescriptor)desc;
isReentrant = ed.isReentrant();
@@ -402,6 +403,7 @@
this.idleBeansPassivator = null;
}
+ @Override
protected InvocationInfo postProcessInvocationInfo(
InvocationInfo invInfo) {
Method method = invInfo.method;
@@ -431,6 +433,7 @@
/**
* Called from the ContainerFactory during initialization.
*/
+ @Override
protected void initializeHome()
throws Exception
{
@@ -452,6 +455,7 @@
registerMonitorableComponents();
}
+ @Override
protected void registerMonitorableComponents() {
super.registerMonitorableComponents();
if (readyStore != null) {
@@ -490,11 +494,13 @@
_logger.log(Level.FINE, "[Entity Container] registered monitorable");
}
+ @Override
protected EjbMonitoringStatsProvider getMonitoringStatsProvider(
String appName, String modName, String ejbName) {
return new EntityBeanStatsProvider(this, getContainerId(), appName, modName, ejbName);
}
+ @Override
public void onReady() {
}
@@ -557,6 +563,7 @@
/**
* Implementation of BaseContainer method. This is never called.
*/
+ @Override
protected EJBObjectImpl createEJBObjectImpl()
throws CreateException, RemoteException
{
@@ -564,6 +571,7 @@
"INTERNAL ERROR: EntityContainer.createEJBObject() called");
}
+ @Override
protected EJBLocalObjectImpl createEJBLocalObjectImpl()
throws CreateException
{
@@ -575,6 +583,7 @@
/**
* Called when a remote EjbInvocation arrives for an EJB.
*/
+ @Override
protected EJBObjectImpl getEJBObjectImpl(byte[] streamKey) {
// First get the primary key of the EJB
Object primaryKey;
@@ -592,6 +601,7 @@
* Called from EJBLocalObjectImpl.getLocalObject() while deserializing
* a local object reference.
*/
+ @Override
protected EJBLocalObjectImpl getEJBLocalObjectImpl(Object key) {
return internalGetEJBLocalObjectImpl(key);
}
@@ -600,6 +610,7 @@
* Called from BaseContainer.preInvoke which is called from the EJBObject
* for local and remote invocations, and from the EJBHome for create/find.
*/
+ @Override
protected ComponentContext _getContext(EjbInvocation inv) {
if ( inv.invocationInfo.isCreateHomeFinder ) {
// create*, find*, home methods
@@ -614,10 +625,11 @@
// context, so no need to synchronize.
context.setState(BeanState.INVOKING);
- if ( inv.invocationInfo.startsWithCreate )
+ if ( inv.invocationInfo.startsWithCreate ) {
preCreate(inv, context);
- else if ( inv.invocationInfo.startsWithFind )
+ } else if ( inv.invocationInfo.startsWithFind ) {
preFind(inv, context);
+ }
context.setLastTransactionStatus(-1);
@@ -632,15 +644,18 @@
// If we would invoke the EJB with the client's Tx,
// try to get an EJB with that incomplete Tx.
EntityContextImpl context = null;
- if ( willInvokeWithClientTx(inv) )
+ if ( willInvokeWithClientTx(inv) ) {
context = getEJBWithIncompleteTx(inv);
- if ( context == null )
+ }
+ if ( context == null ) {
context = getReadyEJB(inv);
+ }
synchronized ( context ) {
- if ( context.isInState(BeanState.INVOKING) && !isReentrant )
+ if ( context.isInState(BeanState.INVOKING) && !isReentrant ) {
throw new EJBException(
"EJB is already executing another request");
+ }
if (context.isInState(BeanState.POOLED) ||
context.isInState(BeanState.DESTROYED)) {
// somehow a concurrent thread must have changed state.
@@ -686,12 +701,14 @@
* This is called from BaseContainer.postInvoke after
* EntityContainer.preInvokeTx has been called.
*/
+ @Override
public void releaseContext(EjbInvocation inv) {
EntityContextImpl context = (EntityContextImpl)inv.context;
boolean decrementedCalls = false; // End of IAS 4661771
- if ( context.isInState(BeanState.DESTROYED) )
+ if ( context.isInState(BeanState.DESTROYED) ) {
return;
+ }
try {
if ( context.hasReentrantCall() ) {
@@ -766,10 +783,11 @@
context.decrementCalls();
context.setLastTransactionStatus(-1);
if ( status == -1 || status == Status.STATUS_COMMITTED
- || status == Status.STATUS_NO_TRANSACTION )
+ || status == Status.STATUS_NO_TRANSACTION ) {
addReadyEJB(context);
- else
+ } else {
passivateAndPoolEJB(context);
+ }
} else {
// biz methods and ejbCreate
// The EJB is still associated with a Tx.
@@ -779,8 +797,7 @@
doFlush( inv );
}
} catch ( Exception ex ) {
- _logger.log(Level.FINE, "entitybean.container.release_context_exception",
- logParams);
+ _logger.log(Level.FINE, "entitybean.container.release_context_exception", containerInfo);
_logger.log(Level.FINE, "",ex);
throw new EJBException(ex);
} finally {
@@ -808,12 +825,14 @@
* is called.
* Note: postCreate will not be called if ejbCreate throws an exception
*/
+ @Override
public void postCreate(EjbInvocation inv, Object primaryKey)
throws CreateException
{
- if ( primaryKey == null )
+ if ( primaryKey == null ) {
throw new EJBException(
"Null primary key returned by ejbCreate method");
+ }
if ( (isRemote) && (!inv.isLocal) ) {
// remote EjbInvocation: create EJBObject
@@ -845,6 +864,7 @@
//Called from EJB(Local)HomeInvocationHandler
//Note: preFind is already called from getContext
+ @Override
protected Object invokeFindByPrimaryKey(Method method,
EjbInvocation inv, Object[] args)
throws Throwable
@@ -854,12 +874,14 @@
return postFind(inv, pKeys, null);
}
+ @Override
protected void authorizeLocalGetPrimaryKey(EJBLocalRemoteObject ejbObj)
throws EJBException {
authorizeLocalMethod(BaseContainer.EJBLocalObject_getPrimaryKey);
checkExists(ejbObj);
}
+ @Override
protected void authorizeRemoteGetPrimaryKey(EJBLocalRemoteObject ejbObj)
throws RemoteException {
authorizeRemoteMethod(BaseContainer.EJBObject_getPrimaryKey);
@@ -890,6 +912,7 @@
/**
* Called from CMP PersistentManager
*/
+ @Override
public void preSelect()
throws jakarta.ejb.EJBException {
// if the ejbSelect is being invoked with the client's transaction,
@@ -919,6 +942,7 @@
* after ejb.ejbFind**() has been called.
* Note: postFind will not be called if ejbFindXXX throws an exception
*/
+ @Override
public Object postFind(EjbInvocation inv, Object primaryKeys,
Object[] findParams)
throws FinderException
@@ -933,10 +957,11 @@
Object primaryKey = e.nextElement();
Object ref;
if( primaryKey != null ) {
- if ( inv.isLocal )
+ if ( inv.isLocal ) {
ref = getEJBLocalObjectForPrimaryKey(primaryKey);
- else
+ } else {
ref = getEJBObjectStub(primaryKey, null);
+ }
objrefs.add(ref);
} else {
objrefs.add(null);
@@ -952,10 +977,11 @@
Object primaryKey = it.next();
Object ref;
if( primaryKey != null ) {
- if ( inv.isLocal )
+ if ( inv.isLocal ) {
ref = getEJBLocalObjectForPrimaryKey(primaryKey);
- else
+ } else {
ref = getEJBObjectStub(primaryKey, null);
+ }
objrefs.add(ref);
} else {
objrefs.add(null);
@@ -964,10 +990,11 @@
return objrefs;
} else {
if( primaryKeys != null ) {
- if ( inv.isLocal )
+ if ( inv.isLocal ) {
return getEJBLocalObjectForPrimaryKey(primaryKeys);
- else
+ } else {
return getEJBObjectStub(primaryKeys, null);
+ }
} else {
return null;
}
@@ -981,6 +1008,7 @@
* for a primary key (home.findByPrimaryKey cant be used because it may
* not run in the same tx).
*/
+ @Override
public EJBObject getEJBObjectForPrimaryKey(Object pkey) {
// create stub without creating EJBObject
return getEJBObjectStub(pkey, null);
@@ -1027,6 +1055,7 @@
* @return The EJBLocalObject associated with the PK or null if it is cascade deleted.
*
*/
+ @Override
public EJBLocalObject getEJBLocalObjectForPrimaryKey
(Object pkey, EJBContext ctx) {
// EntityContextImpl should always be used in conjunction with EntityContainer so we can always cast
@@ -1045,8 +1074,7 @@
ActiveTxCache activeTxCache = (current == null) ? null :
(ActiveTxCache) (ejbContainerUtilImpl.getActiveTxCache(current));
if (activeTxCache != null) {
- EntityContextImpl ctx2 = (EntityContextImpl)
- activeTxCache.get(this, pkey);
+ EntityContextImpl ctx2 = activeTxCache.get(this, pkey);
if ((ctx2 != null) &&
(ctx2.isCascadeDeleteAfterSuperEJBRemove())) {
return null;
@@ -1065,6 +1093,7 @@
* for a primary key (findByPrimaryKey cant be used because it may
* not run in the same tx).
*/
+ @Override
public EJBLocalObject getEJBLocalObjectForPrimaryKey(Object pkey) {
EJBLocalObjectImpl localObjectImpl =
internalGetEJBLocalObjectImpl(pkey);
@@ -1074,6 +1103,7 @@
// Called from EJBHomeImpl.remove(primaryKey),
// EJBLocalHomeImpl.remove(primaryKey)
+ @Override
protected void doEJBHomeRemove(Object primaryKey, Method removeMethod,
boolean local)
throws RemoveException, EJBException, RemoteException
@@ -1090,6 +1120,7 @@
// Called from EJBObjectImpl.remove, EJBLocalObjectImpl.remove,
// and removeBean above.
+ @Override
protected void removeBean(EJBLocalRemoteObject ejbo, Method removeMethod,
boolean local)
throws RemoveException, EJBException, RemoteException
@@ -1111,7 +1142,7 @@
preInvoke(i);
removeBean(i);
} catch(Exception e) {
- _logger.log(Level.SEVERE,"entitybean.container.preinvoke_exception",logParams);
+ _logger.log(Level.SEVERE,"entitybean.container.preinvoke_exception", containerInfo);
_logger.log(Level.SEVERE,"",e);
i.exception = e;
} finally {
@@ -1177,14 +1208,14 @@
cancelTimers(primaryKey);
} catch ( RemoveException ex ) {
if(_logger.isLoggable(Level.FINE)) {
- _logger.log(Level.FINE,"entitybean.container.local_remove_exception",logParams);
+ _logger.log(Level.FINE,"entitybean.container.local_remove_exception", containerInfo);
_logger.log(Level.FINE,"",ex);
}
throw ex;
}
catch ( Exception ex ) {
if(_logger.isLoggable(Level.FINE)) {
- _logger.log(Level.FINE,"entitybean.container.remove_bean_exception",logParams);
+ _logger.log(Level.FINE,"entitybean.container.remove_bean_exception", containerInfo);
_logger.log(Level.FINE,"",ex);
}
throw new EJBException(ex);
@@ -1219,6 +1250,7 @@
* Remove a bean. Used by the PersistenceManager.
* This is needed because the PM's remove must bypass tx/security checks.
*/
+ @Override
public void removeBeanUnchecked(EJBLocalObject localObj) {
// First convert client EJBLocalObject to EJBLocalObjectImpl
EJBLocalObjectImpl localObjectImpl =
@@ -1231,6 +1263,7 @@
* Remove a bean. Used by the PersistenceManager.
* This is needed because the PM's remove must bypass tx/security checks.
*/
+ @Override
public void removeBeanUnchecked(Object primaryKey) {
EJBLocalRemoteObject ejbo;
if ( isLocal ) {
@@ -1336,6 +1369,7 @@
* from BaseContainer.postInvokeTx, getReadyEJB,
* afterBegin, beforeCompletion, passivateEJB.
*/
+ @Override
protected void forceDestroyBean(EJBContextImpl ctx) {
// Something bad happened (such as a RuntimeException),
// so kill the bean and let it be GC'ed
@@ -1394,6 +1428,7 @@
// Called before invoking a bean with no Tx or with a new Tx.
// Check if the bean is associated with an unfinished tx.
+ @Override
protected void checkUnfinishedTx(Transaction prevTx, EjbInvocation inv) {
try {
@@ -1415,6 +1450,7 @@
* Called before executing non-business methods of EJBLocalObject.
* @exception NoSuchObjectLocalException if the object has been removed.
*/
+ @Override
protected void checkExists(EJBLocalRemoteObject ejbObj) {
// Need to call ejbLoad to see if persistent state is removed.
// However, the non-business methods dont have a transaction attribute.
@@ -1422,12 +1458,14 @@
}
// Called from BaseContainer.SyncImpl
+ @Override
protected void afterBegin(EJBContextImpl ctx) {
EntityContextImpl context = (EntityContextImpl)ctx;
// Note: EntityBeans are not allowed to be TX_BEAN_MANAGED
- if ( context.isInState(BeanState.DESTROYED) )
+ if ( context.isInState(BeanState.DESTROYED) ) {
return;
+ }
if ( !containerStateManager.isNullEJBObject(context)
|| !containerStateManager.isNullEJBLocalObject(context) ) {
@@ -1463,6 +1501,7 @@
}
// Called from BaseContainer.SyncImpl.beforeCompletion, postInvokeNoTx
+ @Override
protected void beforeCompletion(EJBContextImpl ctx) {
EntityContextImpl context = (EntityContextImpl)ctx;
if ( context.isInState(BeanState.DESTROYED) ) {
@@ -1523,6 +1562,7 @@
// getting reply from bean). So whatever is done here *MUST* be
// consistent with releaseContext, and the bean should end up in
// the correct state.
+ @Override
protected void afterCompletion(EJBContextImpl ctx, int status) {
EntityContextImpl context = (EntityContextImpl)ctx;
if ( context.isInState(BeanState.DESTROYED) ) {
@@ -1670,6 +1710,7 @@
}
// CacheListener interface
+ @Override
public void trimEvent(Object primaryKey, Object context) {
synchronized (asyncTaskSemaphore) {
passivationCandidates.add(context);
@@ -1692,6 +1733,7 @@
implements Runnable
{
+ @Override
public void run() {
final Thread currentThread = Thread.currentThread();
final ClassLoader previousClassLoader =
@@ -1706,6 +1748,7 @@
} else {
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() {
+ @Override
public java.lang.Object run() {
currentThread.setContextClassLoader(myClassLoader);
return null;
@@ -1743,6 +1786,7 @@
} else {
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() {
+ @Override
public java.lang.Object run() {
currentThread.setContextClassLoader(previousClassLoader);
return null;
@@ -1755,6 +1799,7 @@
}
// Called from AbstractCache
+ @Override
protected boolean passivateEJB(ComponentContext ctx) {
if (containerState != CONTAINER_STARTED) {
return false;
@@ -1779,8 +1824,9 @@
boolean wasPassivated = false;
// check state after locking ctx
- if ( !context.isInState(BeanState.READY) )
+ if ( !context.isInState(BeanState.READY) ) {
return false;
+ }
try {
invocationManager.preInvoke(inv);
@@ -1861,8 +1907,7 @@
}
return localObjImpl;
} catch ( Exception ex ) {
- _logger.log(Level.SEVERE,"entitybean.container.get_ejb_local_object_exception",
- logParams);
+ _logger.log(Level.SEVERE,"entitybean.container.get_ejb_local_object_exception", containerInfo);
_logger.log(Level.SEVERE,"",ex);
throw new EJBException(ex);
}
@@ -1968,7 +2013,7 @@
return ejbObjImpl;
}
catch ( Exception ex ) {
- _logger.log(Level.FINE, "entitybean.container.get_ejb_context_exception", logParams);
+ _logger.log(Level.FINE, "entitybean.container.get_ejb_context_exception", containerInfo);
_logger.log(Level.FINE,"",ex);
throw new EJBException(ex);
}
@@ -2004,8 +2049,9 @@
// called from addReadyEJB and afterCompletion
protected void passivateAndPoolEJB(EntityContextImpl context) {
- if ( context.isInState(BeanState.DESTROYED) || context.isInState(BeanState.POOLED) )
+ if ( context.isInState(BeanState.DESTROYED) || context.isInState(BeanState.POOLED) ) {
return;
+ }
// if ( context.isPooled() ) {
// context.isPooled(false);
@@ -2214,12 +2260,14 @@
this.cache = cache;
}
+ @Override
public void run() {
if (timerValid) {
cache.trimExpiredEntries(Integer.MAX_VALUE);
}
}
+ @Override
public boolean cancel() {
cache = null;
return super.cancel();
@@ -2240,6 +2288,7 @@
this.pkHashCode = primaryKey.hashCode();
}
+ @Override
public final int hashCode() {
// Note: this hashcode need not be persistent across
// activations of this process.
@@ -2251,6 +2300,7 @@
return pkHashCode;
}
+ @Override
public final boolean equals(Object obj) {
if ( !(obj instanceof EJBTxKey) ) {
return false;
@@ -2345,38 +2395,34 @@
} //PoolProperties
+ @Override
protected boolean isIdentical(EJBObjectImpl ejbObjImpl, EJBObject other)
throws RemoteException {
- if ( other == ejbObjImpl.getStub() ) {
+ if (other == ejbObjImpl.getStub()) {
return true;
- } else {
- try {
- // EJBObject may be a remote object.
- // Compare homes. See EJB2.0 spec section 9.8.
- if ( !getProtocolManager().isIdentical(ejbHomeStub,
- other.getEJBHome()))
- return false;
-
- // Compare primary keys.
- if (!ejbObjImpl.getPrimaryKey().equals(other.getPrimaryKey())) {
- return false;
- }
-
- return true;
- } catch ( Exception ex ) {
- _logger.log(Level.INFO, "entitybean.container.ejb_comparison_exception",
- logParams);
- _logger.log(Level.INFO, "", ex);
- throw new RemoteException("Exception in isIdentical()", ex);
+ }
+ try {
+ // EJBObject may be a remote object.
+ // Compare homes. See EJB2.0 spec section 9.8.
+ if (!getProtocolManager().isIdentical(ejbHomeStub, other.getEJBHome())) {
+ return false;
}
+
+ // Compare primary keys.
+ if (!ejbObjImpl.getPrimaryKey().equals(other.getPrimaryKey())) {
+ return false;
+ }
+
+ return true;
+ } catch (Exception ex) {
+ _logger.log(Level.INFO, "entitybean.container.ejb_comparison_exception", containerInfo);
+ _logger.log(Level.INFO, "", ex);
+ throw new RemoteException("Exception in isIdentical()", ex);
}
}
- protected void callEJBLoad(EntityBean ejb, EntityContextImpl context,
- boolean activeTx)
- throws Exception
- {
+ protected void callEJBLoad(EntityBean ejb, EntityContextImpl context, boolean activeTx) throws Exception {
try {
context.setInEjbLoad(true);
ejb.ejbLoad();
@@ -2389,9 +2435,8 @@
}
}
- protected void callEJBStore(EntityBean ejb, EntityContextImpl context)
- throws Exception
- {
+
+ protected void callEJBStore(EntityBean ejb, EntityContextImpl context) throws Exception {
try {
context.setInEjbStore(true);
ejb.ejbStore();
@@ -2401,8 +2446,8 @@
}
}
- protected void callEJBRemove(EntityBean ejb, EntityContextImpl context)
- throws Exception {
+
+ protected void callEJBRemove(EntityBean ejb, EntityContextImpl context) throws Exception {
Exception exc = null;
try {
// TODO - check if it is needed: context.setInEjbRemove(true);
@@ -2422,6 +2467,7 @@
}
}
+ @Override
protected void doTimerInvocationInit(EjbInvocation inv, Object primaryKey)
throws Exception {
if( isRemote ) {
@@ -2437,6 +2483,7 @@
}
}
+ @Override
protected void doConcreteContainerShutdown(boolean appBeingUndeployed) {
String ejbName = ejbDescriptor.getName();
@@ -2529,12 +2576,13 @@
private class EntityContextFactory
implements ObjectFactory
{
- private EntityContainer entityContainer;
+ private final EntityContainer entityContainer;
public EntityContextFactory(EntityContainer entityContainer) {
this.entityContainer = entityContainer;
}
+ @Override
public Object create(Object param) {
EntityContextImpl entityCtx = null;
EjbInvocation ejbInv = null;
@@ -2570,6 +2618,7 @@
}
+ @Override
public void destroy(Object object) {
if (object == null) {
//means that this is called through forceDestroyBean
@@ -2752,6 +2801,7 @@
readyStore.remove(primaryKey, context);
}
+ @Override
protected void addProxyInterfacesSetClass(Set proxyInterfacesSet, boolean local) {
if( ejbDescriptor.getIASEjbExtraDescriptors().isIsReadOnlyBean() ) {
if (local) {
@@ -2763,6 +2813,7 @@
}
+ @Override
protected void doFlush( EjbInvocation inv ) {
if( !inv.invocationInfo.flushEnabled ||
inv.exception != null ) {
@@ -2863,10 +2914,12 @@
}
//EJBObjectCacheListener interface
+ @Override
public void handleOverflow(Object key) {
doCleanup(key);
}
+ @Override
public void handleBatchOverflow(ArrayList paramKeys) {
int size = paramKeys.size();
synchronized (lock) {
@@ -2889,6 +2942,7 @@
}
}
+ @Override
public void run() {
final Thread currentThread = Thread.currentThread();
final ClassLoader previousClassLoader =
@@ -2902,6 +2956,7 @@
} else {
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() {
+ @Override
public java.lang.Object run() {
currentThread.setContextClassLoader(myClassLoader);
return null;
@@ -2939,6 +2994,7 @@
} else {
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() {
+ @Override
public java.lang.Object run() {
currentThread.setContextClassLoader(previousClassLoader);
return null;
@@ -2961,6 +3017,7 @@
protected EJBObjectCacheVictimHandler() {
}
+ @Override
protected void doCleanup(Object key) {
removeEJBObjectFromStore(key, false);
}
@@ -2971,48 +3028,57 @@
class EntityCacheStatsProvider
implements EjbCacheStatsProviderDelegate
{
- private BaseCache cache;
- private int confMaxCacheSize;
+ private final BaseCache cache;
+ private final int confMaxCacheSize;
EntityCacheStatsProvider(BaseCache cache, int maxCacheSize) {
this.cache = cache;
this.confMaxCacheSize = maxCacheSize;
}
+ @Override
public int getCacheHits() {
return ((Integer) cache.getStatByName(
Constants.STAT_BASECACHE_HIT_COUNT)).intValue();
}
+ @Override
public int getCacheMisses() {
return ((Integer) cache.getStatByName(
Constants.STAT_BASECACHE_MISS_COUNT)).intValue();
}
+ @Override
public int getNumBeansInCache() {
return cache.getEntryCount();
}
+ @Override
public int getNumExpiredSessionsRemoved() {
return 0;
}
+ @Override
public int getNumPassivationErrors() {
return totalPassivationErrors;
}
+ @Override
public int getNumPassivations() {
return totalPassivations;
}
+ @Override
public int getNumPassivationSuccess() {
return totalPassivations - totalPassivationErrors;
}
+ @Override
public int getMaxCacheSize() {
return this.confMaxCacheSize;
}
+ @Override
public void appendStats(StringBuffer sbuf) {
sbuf.append("[Cache: ")
.append("Size=").append(getNumBeansInCache()).append("; ")
@@ -3029,7 +3095,7 @@
class ActiveTxCache {
private EntityContextImpl[] buckets;
- private int bucketMask;
+ private final int bucketMask;
ActiveTxCache(int numBuckets) {
this.bucketMask = numBuckets - 1;
diff --git a/appserver/pom.xml b/appserver/pom.xml
index 635a8c5..dbc8fc0 100644
--- a/appserver/pom.xml
+++ b/appserver/pom.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 2021, 2022 Contributors to Eclipse Foundation.
+ Copyright (c) 2021, 2022 Contributors to Eclipse Foundation.
Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
diff --git a/appserver/tests/amx/pom.xml b/appserver/tests/amx/pom.xml
index e0ac48e..128529b 100755
--- a/appserver/tests/amx/pom.xml
+++ b/appserver/tests/amx/pom.xml
@@ -72,14 +72,6 @@
<dependencies>
-
- <dependency>
- <groupId>javax.management.j2ee</groupId>
- <artifactId>management-api</artifactId>
- <version>${management-api.version}</version>
- <scope>compile</scope>
- </dependency>
-
<dependency>
<groupId>org.glassfish.common</groupId>
<artifactId>amx-core</artifactId>
diff --git a/appserver/tests/amx/src/org/glassfish/admin/amxtest/AMXTestBase.java b/appserver/tests/amx/src/org/glassfish/admin/amxtest/AMXTestBase.java
index 4f9e72f..62cb034 100644
--- a/appserver/tests/amx/src/org/glassfish/admin/amxtest/AMXTestBase.java
+++ b/appserver/tests/amx/src/org/glassfish/admin/amxtest/AMXTestBase.java
@@ -16,17 +16,12 @@
package org.glassfish.admin.amxtest;
-import com.sun.appserv.management.DomainRoot;
-import com.sun.appserv.management.base.AMX;
-import com.sun.appserv.management.base.BulkAccess;
+import com.sun.appserv.management.base.AMXDebugSupportMBean;
import com.sun.appserv.management.base.NotificationServiceMgr;
import com.sun.appserv.management.base.QueryMgr;
-import com.sun.appserv.management.base.SystemInfo;
-import com.sun.appserv.management.base.Util;
import com.sun.appserv.management.base.XTypes;
import com.sun.appserv.management.client.AppserverConnectionSource;
import com.sun.appserv.management.client.ConnectionSource;
-import com.sun.appserv.management.client.ProxyFactory;
import com.sun.appserv.management.config.AMXConfig;
import com.sun.appserv.management.config.ConfigConfig;
import com.sun.appserv.management.config.DomainConfig;
@@ -35,26 +30,36 @@
import com.sun.appserv.management.config.NodeAgentConfig;
import com.sun.appserv.management.config.ServerConfig;
import com.sun.appserv.management.config.ServersConfig;
-import com.sun.appserv.management.j2ee.J2EEDomain;
-import com.sun.appserv.management.util.jmx.JMXUtil;
import com.sun.appserv.management.util.jmx.MBeanServerConnectionConnectionSource;
-import com.sun.appserv.management.util.misc.ClassUtil;
-import com.sun.appserv.management.util.misc.ExceptionUtil;
import com.sun.appserv.management.util.misc.GSetUtil;
-import com.sun.appserv.management.util.misc.TypeCast;
-import com.sun.appserv.management.base.AMXDebugSupportMBean;
-import javax.management.MBeanServerConnection;
-import javax.management.ObjectName;
-import javax.management.Attribute;
-import javax.management.AttributeList;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.Collection;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-import java.util.HashMap;
+
+import javax.management.Attribute;
+import javax.management.AttributeList;
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+
+import org.glassfish.admin.amx.base.BulkAccess;
+import org.glassfish.admin.amx.base.DomainRoot;
+import org.glassfish.admin.amx.base.SystemInfo;
+import org.glassfish.admin.amx.core.proxy.ProxyFactory;
+import org.glassfish.admin.amx.j2ee.J2EEDomain;
+import org.glassfish.admin.amx.util.ClassUtil;
+import org.glassfish.admin.amx.util.ExceptionUtil;
+import org.glassfish.admin.amx.util.TypeCast;
+import org.glassfish.admin.amx.util.jmx.JMXUtil;
+import org.glassfish.external.amx.AMX;
+
+import javassist.bytecode.analysis.Util;
+
+import static org.junit.jupiter.api.Assertions.fail;
/**
Base class for testing the AMX API
diff --git a/appserver/tests/appserv-tests/devtests/cdi/scopes/request-and-application-scope-ejb-mdb/build.xml b/appserver/tests/appserv-tests/devtests/cdi/scopes/request-and-application-scope-ejb-mdb/build.xml
index ef650bb..19d2a6c 100644
--- a/appserver/tests/appserv-tests/devtests/cdi/scopes/request-and-application-scope-ejb-mdb/build.xml
+++ b/appserver/tests/appserv-tests/devtests/cdi/scopes/request-and-application-scope-ejb-mdb/build.xml
@@ -31,68 +31,70 @@
<target name="all" depends="clean,build,create-resources,deploy,run,undeploy,delete-resources"/>
- <target name="clean" depends="init-common">
- <antcall target="clean-common"/>
- </target>
+ <target name="clean" depends="init-common">
+ <antcall target="clean-common"/>
+ </target>
- <target name="compile" depends="clean">
- <antcall target="compile-common">
- <param name="src" value="src"/>
- </antcall>
- <antcall target="compile-common">
- <param name="src" value="client"/>
- </antcall>
- </target>
+ <target name="compile" depends="clean">
+ <antcall target="compile-common">
+ <param name="src" value="src"/>
+ </antcall>
+ <antcall target="compile-common">
+ <param name="src" value="client"/>
+ </antcall>
+ </target>
- <target name="build" depends="compile">
- <antcall target="build-ear-common">
- <param name="ejbjar.classes"
+ <target name="build" depends="compile">
+ <antcall target="build-ear-common">
+ <param name="ejbjar.classes"
value="**/*Bean*.class,**/*Hello*" />
- <param name="appclientjar.classes"
+ <param name="appclientjar.classes"
value="**/*Client*.class, test/ejb/session/HelloSless*.class" />
- </antcall>
- </target>
+ </antcall>
+ </target>
- <target name="deploy"
+ <target name="deploy"
depends="init-common">
- <antcall target="deploy-common"/>
- </target>
+ <antcall target="deploy-common"/>
+ </target>
- <target name="create-resources" depends="init-common">
- <antcall target="asadmin-batch-common">
- <param name="asadmin.file" value="create_resources.asadmin"/>
- </antcall>
- </target>
+ <target name="create-resources" depends="init-common">
+ <antcall target="asadmin-batch-common">
+ <param name="asadmin.file" value="create_resources.asadmin"/>
+ </antcall>
+ </target>
- <target name="delete-resources" depends="init-common">
- <antcall target="asadmin-batch-common">
- <param name="asadmin.file" value="delete_resources.asadmin"/>
- </antcall>
- </target>
+ <target name="delete-resources" depends="init-common">
+ <antcall target="asadmin-batch-common">
+ <param name="asadmin.file" value="delete_resources.asadmin"/>
+ </antcall>
+ </target>
- <target name="run" depends="init-common">
- <antcall target="runclient-common">
- <param name="appclient.application.args" value="1"/>
- </antcall>
- </target>
+ <target name="run" depends="init-common">
+ <antcall target="runclient-common">
+ <param name="appclient.application.args" value="1"/>
+ </antcall>
+ </target>
- <target name="run_standaloneclient" depends="init-common">
- <java fork="on"
- failonerror="true"
- classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/modules/jakarta.jms-api.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
- classname="${simple.client}">
- </java>
- </target>
+ <target name="run_standaloneclient" depends="init-common">
+ <java fork="on"
+ failonerror="true"
+ classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/modules/jakarta.jms-api.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
+ classname="${simple.client}"
+ >
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ </java>
+ </target>
- <target name="undeploy" depends="init-common">
- <antcall target="undeploy-common"/>
- </target>
+ <target name="undeploy" depends="init-common">
+ <antcall target="undeploy-common" />
+ </target>
- <target name="usage">
- <antcall target="usage-common"/>
- <echo>
+ <target name="usage">
+ <antcall target="usage-common" />
+ <echo>
ant create-resources Create all destinations and connection factories
ant delete-resources Delete all destinations and connection factories
- </echo>
- </target>
+ </echo>
+ </target>
</project>
diff --git a/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/build.xml b/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/build.xml
index d307603..00ec721 100644
--- a/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/build.xml
+++ b/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-cdi/build.xml
@@ -68,6 +68,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${simple.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}" />
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
</java>
</target>
@@ -78,7 +79,7 @@
<jvmarg value="-Djava.naming.factory.initial=org.glassfish.jndi.cosnaming.CNCtxFactory" />
<jvmarg value="-Djava.naming.provider.url=iiop://localhost:${orb.port}" />
<jvmarg value="-Dorg.omg.CORBA.ORBInitialPort=${orb.port}" />
-
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-singleton/hello/build.xml b/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-singleton/hello/build.xml
index 641b3e8..6ff321b 100644
--- a/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-singleton/hello/build.xml
+++ b/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-ejb-singleton/hello/build.xml
@@ -31,50 +31,52 @@
<target name="all" depends="build,deploy,run,undeploy"/>
- <target name="clean" depends="init-common">
- <antcall target="clean-common"/>
- </target>
+ <target name="clean" depends="init-common">
+ <antcall target="clean-common"/>
+ </target>
- <target name="compile" depends="clean">
- <antcall target="compile-common">
- <param name="src" value="ejb"/>
- </antcall>
- <antcall target="compile-common">
- <param name="src" value="client"/>
- </antcall>
- </target>
+ <target name="compile" depends="clean">
+ <antcall target="compile-common">
+ <param name="src" value="ejb"/>
+ </antcall>
+ <antcall target="compile-common">
+ <param name="src" value="client"/>
+ </antcall>
+ </target>
- <target name="build" depends="compile">
- <antcall target="ejb-jar-common">
- <param name="ejbjar.classes"
+ <target name="build" depends="compile">
+ <antcall target="ejb-jar-common">
+ <param name="ejbjar.classes"
value="**/Foo*.class,**/Test*.class,**/Singleton*.class,**/Hello*.class"/>
- </antcall>
- </target>
+ </antcall>
+ </target>
- <target name="deploy"
+ <target name="deploy"
depends="init-common">
- <antcall target="deploy-jar-common"/>
- </target>
+ <antcall target="deploy-jar-common"/>
+ </target>
- <target name="run" depends="init-common">
- <antcall target="run_se"/>
- </target>
+ <target name="run" depends="init-common">
+ <antcall target="run_se"/>
+ </target>
- <target name="run_se" depends="init-common">
- <java fork="on"
- failonerror="true"
- classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/appserv-rt.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
- classname="${se.client}">
- <sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
- <arg line="${jndiroot}"/>
- </java>
- </target>
+ <target name="run_se" depends="init-common">
+ <java fork="on"
+ failonerror="true"
+ classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/appserv-rt.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
+ classname="${se.client}"
+ >
+ <sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}" />
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ <arg line="${jndiroot}" />
+ </java>
+ </target>
- <target name="undeploy" depends="init-common">
- <antcall target="undeploy-jar-common"/>
- </target>
+ <target name="undeploy" depends="init-common">
+ <antcall target="undeploy-jar-common" />
+ </target>
- <target name="usage">
- <antcall target="usage-common"/>
- </target>
+ <target name="usage">
+ <antcall target="usage-common"/>
+ </target>
</project>
diff --git a/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-mdb/build.xml b/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-mdb/build.xml
index 088a503..8c58d32 100644
--- a/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-mdb/build.xml
+++ b/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/simple-mdb/build.xml
@@ -81,7 +81,8 @@
failonerror="true"
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/modules/jakarta.jms-api.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${simple.client}">
- </java>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ </java>
</target>
<target name="undeploy" depends="init-common">
diff --git a/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/singleton-startup/hello/build.xml b/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/singleton-startup/hello/build.xml
index 85beda9..d1fcc73 100644
--- a/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/singleton-startup/hello/build.xml
+++ b/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/singleton-startup/hello/build.xml
@@ -66,6 +66,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/appserv-rt.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/singleton-startup/hello/client/Client.java b/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/singleton-startup/hello/client/Client.java
index 0f24296..72b8161 100644
--- a/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/singleton-startup/hello/client/Client.java
+++ b/appserver/tests/appserv-tests/devtests/cdi/smoke-tests/singleton-startup/hello/client/Client.java
@@ -22,8 +22,6 @@
import javax.naming.InitialContext;
-import javax.management.j2ee.ManagementHome;
-import javax.management.j2ee.Management;
import javax.rmi.PortableRemoteObject;
import com.acme.Hello;
@@ -50,16 +48,6 @@
public void doTest() {
try {
-
- // Ensure that MEJB is registered under all three of its JNDI names
- System.out.println("Looking up MEJB Homes");
- ManagementHome mh1Obj = (ManagementHome) new InitialContext().lookup("ejb/mgmt/MEJB");
- ManagementHome mh2Obj = (ManagementHome) new InitialContext().lookup("java:global/mejb/MEJBBean");
- ManagementHome mh3Obj = (ManagementHome) new InitialContext().lookup("java:global/mejb/MEJBBean!javax.management.j2ee.ManagementHome");
- addStatus("mejb relative lookup", (mh1Obj != null));
- addStatus("mejb global lookup", (mh2Obj != null));
- addStatus("mejb global lookup with explicit ManagedHome interface", (mh3Obj != null));
-
Hello hello = (Hello) new InitialContext().lookup("java:global/" + appName + "/SingletonBean");
String response = hello.hello();
addStatus("Singleton bean response", response.equals("hello, world!\n"));
diff --git a/appserver/tests/appserv-tests/devtests/connector/v3/ejb32-mdb/build.xml b/appserver/tests/appserv-tests/devtests/connector/v3/ejb32-mdb/build.xml
index 817c04f..de03e24 100644
--- a/appserver/tests/appserv-tests/devtests/connector/v3/ejb32-mdb/build.xml
+++ b/appserver/tests/appserv-tests/devtests/connector/v3/ejb32-mdb/build.xml
@@ -88,6 +88,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/connector/v3/jpa-tx-propagation-gf-resources-xml/build.xml b/appserver/tests/appserv-tests/devtests/connector/v3/jpa-tx-propagation-gf-resources-xml/build.xml
index d77e681..d95b284 100644
--- a/appserver/tests/appserv-tests/devtests/connector/v3/jpa-tx-propagation-gf-resources-xml/build.xml
+++ b/appserver/tests/appserv-tests/devtests/connector/v3/jpa-tx-propagation-gf-resources-xml/build.xml
@@ -129,6 +129,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${simple.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/build.xml b/appserver/tests/appserv-tests/devtests/ejb/build.xml
index 6146e11..f172749 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/build.xml
@@ -41,7 +41,6 @@
</patternset>
<target name="all">
-
<antcall target="setup"/>
<antcall target="test-all"/>
<antcall target="unsetup"/>
@@ -49,7 +48,6 @@
</target>
<target name="lite">
-
<antcall target="setup"/>
<antcall target="test-lite"/>
<antcall target="unsetup"/>
@@ -57,21 +55,20 @@
</target>
<target name="ejb_group_1">
-
<antcall target="setup"/>
<antcall target="test-group-1"/>
<antcall target="unsetup"/>
<antcall target="report"/>
</target>
- <target name="ejb_group_2">
+ <target name="ejb_group_2">
<antcall target="setup"/>
<antcall target="test-group-2"/>
<antcall target="unsetup"/>
<antcall target="report"/>
</target>
- <target name="ejb_group_3">
+ <target name="ejb_group_3">
<antcall target="setup"/>
<antcall target="test-group-3"/>
<antcall target="unsetup"/>
@@ -79,12 +76,16 @@
</target>
- <target name="setup">
+ <target name="ejb_group_embedded">
+ <ant dir="ejb32/embedded" target="all"/>
+ <ant dir="ejb31/embedded" target="all"/>
+ <antcall target="report"/>
+ </target>
+ <target name="setup">
<antcall target="start-database"/>
<ant target="startDomain"/>
<ant target="clean-result"/>
-
</target>
<target name="clean-result">
@@ -105,26 +106,26 @@
</target>
<target name="test-all">
-
<ant dir="stubs" target="all"/>
<ant dir="txprop" target="all"/>
<ant dir="ejbc" target="all"/>
<ant dir="ejb30" target="all"/>
+
<ant dir="mdb" target="all"/>
<ant dir="cli" target="all"/>
<ant dir="timer" target="all"/>
<ant dir="bmp" target="all"/>
+
<ant dir="cmp" target="all"/>
<ant dir="sfsb" target="all"/>
<ant dir="allowedmethods" target="all"/>
<ant dir="jms" target="all"/>
<ant dir="ejb32" target="all"/>
-<!-- disable as it fails on hudson ...
--->
-
-<!-- ejb31 must be the last set of tests because embedded test might stop database -->
<ant dir="ejb31" target="all"/>
+ <!-- ejb31 must be the last set of tests because embedded test might stop database -->
+ <ant dir="ejb32/embedded" target="all"/>
+ <ant dir="ejb31/embedded" target="all"/>
</target>
<target name="test-group-1">
@@ -141,7 +142,7 @@
<ant dir="bmp" target="all"/>
</target>
- <target name="test-group-3">
+ <target name="test-group-3">
<ant dir="cmp" target="all"/>
<ant dir="sfsb" target="all"/>
<ant dir="allowedmethods" target="all"/>
@@ -152,15 +153,10 @@
-
-
<target name="unsetup">
<echo message="Stopping app server instance"/>
<ant target="stopDomain"/>
-
<antcall target="stop-database"/>
-
-
<record name="ejb.output" action="stop" />
</target>
@@ -299,8 +295,7 @@
<echo>
Usage:
ant all (Executes all the ejb tests)
- ant orb_integration (Executes all ejb-related orb integration tests
-
+ ant orb_integration (Executes all ejb-related orb integration tests)
ant allowedmethods (Executes the ejb allowedmethods tests)
ant bmp (Executes the ejb bmp tests)
ant ejbc (Executes the ejb ejbc tests)
diff --git a/appserver/tests/appserv-tests/devtests/ejb/cli/negative/build.xml b/appserver/tests/appserv-tests/devtests/ejb/cli/negative/build.xml
index a478e1f..7100ea5 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/cli/negative/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/cli/negative/build.xml
@@ -41,6 +41,7 @@
failonerror="true"
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${env.APS_HOME}/lib/reportbuilder.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="deploy"/>
<arg line="${assemble.dir}/${appname}App.ear"/>
</java>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ee/timer/autotimer/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ee/timer/autotimer/build.xml
index ccf3d08..0a31604 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ee/timer/autotimer/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ee/timer/autotimer/build.xml
@@ -62,6 +62,7 @@
failonerror="true"
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${env.APS_HOME}/lib/reportbuilder.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="deploy"/>
<arg line="${assemble.dir}/${appname}-web.war"/>
</java>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ee/timer/domaindeployment/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ee/timer/domaindeployment/build.xml
index 3ef73ba..4377a60 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ee/timer/domaindeployment/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ee/timer/domaindeployment/build.xml
@@ -102,6 +102,7 @@
failonerror="true"
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${env.APS_HOME}/lib/reportbuilder.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="deploy"/>
<arg line="${dtarget}"/>
<arg line="${assemble.dir}/${appname}-web.war"/>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ee/timer/failover/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ee/timer/failover/build.xml
index de57dc7..d9584ea 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ee/timer/failover/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ee/timer/failover/build.xml
@@ -68,6 +68,7 @@
failonerror="true"
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${env.APS_HOME}/lib/reportbuilder.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="deploy"/>
<arg line="${assemble.dir}/${appname}-web.war"/>
</java>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ee/timer/getalltimers/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ee/timer/getalltimers/build.xml
index 63f9cd4..fce2db6 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ee/timer/getalltimers/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ee/timer/getalltimers/build.xml
@@ -67,6 +67,7 @@
failonerror="true"
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${env.APS_HOME}/lib/reportbuilder.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="deploy"/>
<arg line="${assemble.dir}/${appname}-web.war"/>
</java>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb30/clientview/adapted/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb30/clientview/adapted/build.xml
index 43ffc4d..818d5a4 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb30/clientview/adapted/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb30/clientview/adapted/build.xml
@@ -68,6 +68,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb30/clientview/core/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb30/clientview/core/build.xml
index 32ef0a9..520df82 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb30/clientview/core/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb30/clientview/core/build.xml
@@ -68,6 +68,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb30/clientview/exceptions/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb30/clientview/exceptions/build.xml
index 5bbad02..4bf0c0b 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb30/clientview/exceptions/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb30/clientview/exceptions/build.xml
@@ -68,6 +68,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb30/hello/mdb/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb30/hello/mdb/build.xml
index 08ad617..9cde5cb 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb30/hello/mdb/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb30/hello/mdb/build.xml
@@ -81,7 +81,8 @@
failonerror="true"
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/modules/jakarta.jms-api.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${simple.client}">
- </java>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ </java>
</target>
<target name="undeploy" depends="init-common">
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb30/hello/session/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb30/hello/session/build.xml
index e53901e..6b74d15 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb30/hello/session/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb30/hello/session/build.xml
@@ -31,74 +31,73 @@
<target name="all" depends="build,deploy,run,undeploy"/>
- <target name="clean" depends="init-common">
- <antcall target="clean-common"/>
- <delete file="client/Client.java"/>
- </target>
+ <target name="clean" depends="init-common">
+ <antcall target="clean-common"/>
+ <delete file="client/Client.java"/>
+ </target>
- <target name="compile" depends="clean">
- <copy file="client/Client.java.token" tofile="client/Client.java"/>
- <replace file="client/Client.java"
+ <target name="compile" depends="clean">
+ <copy file="client/Client.java.token" tofile="client/Client.java"/>
+ <replace file="client/Client.java"
token="@ORB_PORT@" value="${orb.port}"/>
- <antcall target="compile-common">
- <param name="src" value="ejb"/>
- </antcall>
- <antcall target="compile-common">
- <param name="src" value="client"/>
- </antcall>
- </target>
+ <antcall target="compile-common">
+ <param name="src" value="ejb"/>
+ </antcall>
+ <antcall target="compile-common">
+ <param name="src" value="client"/>
+ </antcall>
+ </target>
- <target name="build" depends="compile">
- <antcall target="build-ear-common">
- <param name="ejbjar.classes"
+ <target name="build" depends="compile">
+ <antcall target="build-ear-common">
+ <param name="ejbjar.classes"
value="**/Sful*.class,**/Sless*.class"/>
- <param name="appclientjar.classes"
+ <param name="appclientjar.classes"
value="**/Client.class,**/Sful.class,**/Sless.class"/>
- </antcall>
- </target>
+ </antcall>
+ </target>
- <target name="deploy"
+ <target name="deploy"
depends="init-common">
- <antcall target="deploy-common"/>
- </target>
+ <antcall target="deploy-common"/>
+ </target>
- <target name="run" depends="init-common">
- <antcall target="runclient-common"/>
- <antcall target="run_standaloneclient"/>
- <antcall target="run_standaloneclient2"/>
- </target>
+ <target name="run" depends="init-common">
+ <antcall target="runclient-common"/>
+ <antcall target="run_standaloneclient"/>
+ <antcall target="run_standaloneclient2"/>
+ </target>
- <target name="run_standaloneclient" depends="init-common">
- <java fork="on"
+ <target name="run_standaloneclient" depends="init-common">
+ <java fork="on"
failonerror="true"
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${simple.client}">
- <sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
- </java>
- </target>
+ <sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ </java>
+ </target>
- <target name="run_standaloneclient2" depends="init-common">
- <java fork="on"
- failonerror="true"
- classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
- classname="${simple.client2}">
- <jvmarg
- value="-Djava.naming.factory.initial=org.glassfish.jndi.cosnaming.CNCtxFactory"/>
- <jvmarg
- value="-Djava.naming.provider.url=iiop://localhost:${orb.port}"/>
- <jvmarg
- value="-Dorg.omg.CORBA.ORBInitialPort=${orb.port}"/>
+ <target name="run_standaloneclient2" depends="init-common">
+ <java fork="on"
+ failonerror="true"
+ classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
+ classname="${simple.client2}"
+ >
+ <jvmarg value="-Djava.naming.factory.initial=org.glassfish.jndi.cosnaming.CNCtxFactory" />
+ <jvmarg value="-Djava.naming.provider.url=iiop://localhost:${orb.port}" />
+ <jvmarg value="-Dorg.omg.CORBA.ORBInitialPort=${orb.port}" />
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ </java>
+ </target>
- </java>
- </target>
+ <target name="undeploy" depends="init-common">
+ <antcall target="undeploy-common" />
+ </target>
- <target name="undeploy" depends="init-common">
- <antcall target="undeploy-common"/>
- </target>
-
- <target name="usage">
- <antcall target="usage-common"/>
- </target>
+ <target name="usage">
+ <antcall target="usage-common" />
+ </target>
</project>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb30/persistence/tx_propagation/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb30/persistence/tx_propagation/build.xml
index df6dd8a..e10a86e 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb30/persistence/tx_propagation/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb30/persistence/tx_propagation/build.xml
@@ -125,6 +125,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${simple.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/asynchronous/localandremote/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/asynchronous/localandremote/build.xml
index 011ba54..8991d0f 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/asynchronous/localandremote/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/asynchronous/localandremote/build.xml
@@ -66,6 +66,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
<arg line="10"/>
</java>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/asynchronous/remote/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/asynchronous/remote/build.xml
index e9eefca..aa5badc 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/asynchronous/remote/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/asynchronous/remote/build.xml
@@ -66,6 +66,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
<arg line="10"/>
</java>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/asynchronous/threadpoolconfig/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/asynchronous/threadpoolconfig/build.xml
index 92bb8bf..91774b3 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/asynchronous/threadpoolconfig/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/asynchronous/threadpoolconfig/build.xml
@@ -69,6 +69,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${jndiroot} ${numOfInvocations} ${maxPoolSize}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/build.xml
index ffcc9ef..c7456fc 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/build.xml
@@ -40,7 +40,7 @@
<antcall target="asynchronous"/>
<antcall target="timer31"/>
<antcall target="security"/>
- <antcall target="embedded"/>
+<!-- <antcall target="embedded"/>-->
</target>
<target name="ejblite">
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/ejblite/generics/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/ejblite/generics/build.xml
index 8c83ed4..e46cffd 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/ejblite/generics/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/ejblite/generics/build.xml
@@ -64,6 +64,7 @@
failonerror="true"
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${contextroot}"/>
<arg line="${http.host}"/>
<arg line="${http.port}"/>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/ejblite/javamodule/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/ejblite/javamodule/build.xml
index 5887b41..1c6682a 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/ejblite/javamodule/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/ejblite/javamodule/build.xml
@@ -64,6 +64,7 @@
failonerror="true"
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${contextroot}"/>
<arg line="${http.host}"/>
<arg line="${http.port}"/>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/ejblite/jaxrs/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/ejblite/jaxrs/build.xml
index f9b83e4..e49f5bf 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/ejblite/jaxrs/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/ejblite/jaxrs/build.xml
@@ -65,6 +65,7 @@
failonerror="true"
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${contextroot}"/>
<arg line="${http.host}"/>
<arg line="${http.port}"/>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/ejblite/managedbean/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/ejblite/managedbean/build.xml
index 9f325ab..3ca7995 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/ejblite/managedbean/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/ejblite/managedbean/build.xml
@@ -64,6 +64,7 @@
failonerror="true"
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${contextroot}"/>
<arg line="${http.host}"/>
<arg line="${http.port}"/>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/ejblite/sinitcallejb/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/ejblite/sinitcallejb/build.xml
index f9ff039..a5fdeed 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/ejblite/sinitcallejb/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/ejblite/sinitcallejb/build.xml
@@ -64,6 +64,7 @@
failonerror="true"
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${contextroot}"/>
<arg line="${http.host}"/>
<arg line="${http.port}"/>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/basic/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/basic/build.xml
index 1cff99d..58c8454 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/basic/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/basic/build.xml
@@ -70,6 +70,8 @@
failonerror="true"
classpath="${assemble.dir}/${appname}-ejb.jar:${embedded.classpath}:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ <jvmarg value="--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/datasourcedef/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/datasourcedef/build.xml
index 7d3bbbb..68ed376 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/datasourcedef/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/datasourcedef/build.xml
@@ -70,6 +70,8 @@
failonerror="true"
classpath="${assemble.dir}/${appname}-ejb.jar:${embedded.classpath}:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ <jvmarg value="--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/ejbandwar/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/ejbandwar/build.xml
index 668a04f..cac7f47 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/ejbandwar/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/ejbandwar/build.xml
@@ -96,6 +96,8 @@
failonerror="true"
classpath="${assemble.dir}/${appname}-other.jar:${assemble.dir}/${appname}-web.war:${assemble.dir}/${appname}-pu.jar:${embedded.classpath}:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ <jvmarg value="--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
</java>
</target>
@@ -107,10 +109,12 @@
failonerror="true"
classpath="${assemble.dir}/tmp:${assemble.dir}/other:${embedded.classpath}:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
- <arg line="${jndiroot}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ <jvmarg value="--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED" />
<!--
<jvmarg value="-Dorg.glassfish.ejb.embedded.keep-temporary-files=true"/>
-->
+ <arg line="${jndiroot}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/ejbinwar/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/ejbinwar/build.xml
index 8883578..8c51b5f 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/ejbinwar/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/ejbinwar/build.xml
@@ -87,6 +87,8 @@
failonerror="true"
classpath="${assemble.dir}/${appname}-web.war:${assemble.dir}/${appname}-pu.jar:${embedded.classpath}:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ <jvmarg value="--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED" />
<arg line="${appname}"/>
</java>
</target>
@@ -97,6 +99,8 @@
failonerror="true"
classpath="${assemble.dir}/${appname}-web.war:${assemble.dir}/${appname}-pu.jar:${embedded.classpath}:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ <jvmarg value="--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
<arg line="installed_instance"/>
</java>
@@ -108,6 +112,8 @@
failonerror="true"
classpath="${assemble.dir}/${appname}-web.war:${assemble.dir}/${appname}-pu.jar:${embedded.classpath}:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ <jvmarg value="--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED" />
<arg line="${appname}"/>
<arg line="servlet"/>
</java>
@@ -118,6 +124,8 @@
failonerror="true"
classpath="${assemble.dir}/tmp:${assemble.dir}/${appname}-pu.jar:${embedded.classpath}:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ <jvmarg value="--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/embedasync/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/embedasync/build.xml
index 75fc89b..459b343 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/embedasync/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/embedasync/build.xml
@@ -69,6 +69,8 @@
failonerror="true"
classpath="${embedded.classpath}:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ <jvmarg value="--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/jaxrs/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/jaxrs/build.xml
index 832aefd..28b6d56 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/jaxrs/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/jaxrs/build.xml
@@ -132,6 +132,8 @@
classpath="${test-path}:${assemble.dir}/${appname}-pu.jar:${embedded.classpath}:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<jvmarg value="-Dorg.glassfish.ejb.embedded.keep-temporary-files=true"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ <jvmarg value="--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED" />
<arg line="${appname}"/>
<arg line="${test}"/>
<arg line="${packaging}"/>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/manifestonly/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/manifestonly/build.xml
index 3a76dc0..6a7179b 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/manifestonly/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/manifestonly/build.xml
@@ -87,6 +87,7 @@
failonerror="true"
classpath="${assemble.dir}/${appname}-all.jar:${assemble.dir}/${appname}-pu.jar:${embedded.classpath}"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${appname}-all"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/mdb/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/mdb/build.xml
index b39635e..5f311a1 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/mdb/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/mdb/build.xml
@@ -132,6 +132,8 @@
failonerror="true"
classpath="${assemble.dir}/${appname}-ejb.jar:${embedded.classpath}:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ <jvmarg value="--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
<!--
<jvmarg value="-Dorg.glassfish.ejb.embedded.keep-temporary-files=true"/>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/modulewithappname/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/modulewithappname/build.xml
index e448e66..6dfc3a2 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/modulewithappname/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/modulewithappname/build.xml
@@ -79,6 +79,8 @@
classpath="${assemble.dir}/${appname}-ejb.jar:${assemble.dir}/${appname}-pu.jar:${embedded.classpath}:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<jvmarg value="-Dorg.glassfish.ejb.embedded.keep-temporary-files=true"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ <jvmarg value="--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED" />
<arg line="${module}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/modulewithinheritance/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/modulewithinheritance/build.xml
index d0aa5a1..84d3fe7 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/modulewithinheritance/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/modulewithinheritance/build.xml
@@ -82,6 +82,8 @@
failonerror="true"
classpath="${assemble.dir}/${appname}-ejb.jar:${assemble.dir}/${appname}-pu.jar:${assemble.dir}/${appname}-base.jar:${embedded.classpath}:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ <jvmarg value="--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/modulewithlibs/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/modulewithlibs/build.xml
index c12664e..4e0e07c 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/modulewithlibs/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/modulewithlibs/build.xml
@@ -82,6 +82,8 @@
failonerror="true"
classpath="${assemble.dir}/${appname}-ejb.jar:${assemble.dir}/${appname}-pu.jar:${assemble.dir}/${appname}-base.jar:${embedded.classpath}:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ <jvmarg value="--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/modulewithmanifest/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/modulewithmanifest/build.xml
index e3b6a76..a3b80e1 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/modulewithmanifest/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/modulewithmanifest/build.xml
@@ -80,6 +80,8 @@
failonerror="true"
classpath="${assemble.dir}/${appname}-ejb.jar:${embedded.classpath}:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ <jvmarg value="--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/profile/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/profile/build.xml
index 464b3fc..8cda53f 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/profile/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/profile/build.xml
@@ -68,7 +68,8 @@
classpath="${assemble.dir}/${appname}-ejb.jar:${embedded.classpath}:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<arg line="${jndiroot}"/>
-<jvmarg value="-Dxuse.hash.for.appid=true"/>
+ <jvmarg value="-Dxuse.hash.for.appid=true"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/remote/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/remote/build.xml
index 01cedc3..17bf957 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/remote/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/remote/build.xml
@@ -76,6 +76,8 @@
failonerror="true"
classpath="${assemble.dir}/${appname}-ejb.jar:${embedded.classpath}:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ <jvmarg value="--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/skipjar/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/skipjar/build.xml
index ab711be..53682b6 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/skipjar/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/skipjar/build.xml
@@ -83,6 +83,8 @@
failonerror="true"
classpath="${assemble.dir}/${appname}-client.jar:${assemble.dir}/${appname}-ejb.jar:${assemble.dir}/${appname}-pu.jar:${embedded.classpath}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ <jvmarg value="--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
</java>
</target>
@@ -95,6 +97,8 @@
failonerror="true"
classpath="${assemble.dir}/${appname}-clientdir:${assemble.dir}/${appname}-ejb.jar:${assemble.dir}/${appname}-pu.jar:${embedded.classpath}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ <jvmarg value="--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/testclose/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/testclose/build.xml
index 9b44bef..e7fc0fa 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/testclose/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/testclose/build.xml
@@ -70,6 +70,8 @@
failonerror="true"
classpath="${assemble.dir}/${appname}-ejb.jar:${embedded.classpath}:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ <jvmarg value="--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/timertest/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/timertest/build.xml
index 1cacfa6..24cccc9 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/timertest/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/timertest/build.xml
@@ -76,6 +76,8 @@
failonerror="true"
classpath="${assemble.dir}/${appname}-ejb.jar:${embedded.classpath}:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ <jvmarg value="--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
<arg line="${persistent}"/>
</java>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/twocontainers/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/twocontainers/build.xml
index a9fb513..e26225f 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/twocontainers/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/twocontainers/build.xml
@@ -70,6 +70,8 @@
failonerror="true"
classpath="${assemble.dir}/${appname}-ejb.jar:${embedded.classpath}:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ <jvmarg value="--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED" />
<!--
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8085"/>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/twomodules/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/twomodules/build.xml
index 429f4b4..5f1cf86 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/twomodules/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/twomodules/build.xml
@@ -76,6 +76,8 @@
failonerror="true"
classpath="${assemble.dir}/${appname}-ejb1.jar:${assemble.dir}/${appname}-ejb2.jar:${embedded.classpath}:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ <jvmarg value="--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED" />
<arg line="${appname}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/twomoduleswithlibs/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/twomoduleswithlibs/build.xml
index 16e7952..6bb1a04 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/twomoduleswithlibs/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/embedded/twomoduleswithlibs/build.xml
@@ -110,11 +110,11 @@
failonerror="true"
classpath="${assemble.dir}/${appname}-ejb1.jar:${assemble.dir}/${appname}-ejb2.jar:${assemble.dir}/${appname}-base.jar:${assemble.dir}/${appname}-pu1.jar:${embedded.classpath}:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
-
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ <jvmarg value="--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED" />
<!--
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8085"/>
-
-->
<arg line="${appname}"/>
</java>
@@ -126,6 +126,8 @@
failonerror="true"
classpath="${assemble.dir}/${appname}-ejb2/classes:${assemble.dir}/${appname}-ejb1/classes:${assemble.dir}/${appname}-base/classes:${assemble.dir}/${appname}-pu1:${embedded.classpath}:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ <jvmarg value="--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED" />
<arg line="${appname}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/disable_nonportable_jndi/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/disable_nonportable_jndi/build.xml
index e14d29a..17c2dfb 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/disable_nonportable_jndi/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/disable_nonportable_jndi/build.xml
@@ -69,6 +69,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/ear/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/ear/build.xml
index 121d688..4411c33 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/ear/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/ear/build.xml
@@ -74,6 +74,7 @@
failonerror="true"
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${contextroot}"/>
<arg line="${http.host}"/>
<arg line="${http.port}"/>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/jcdifull/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/jcdifull/build.xml
index 6d17e0a..0fea1ed 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/jcdifull/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/jcdifull/build.xml
@@ -74,6 +74,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
<arg line="ejb-ejb31-full-jcdifull-ejb"/>
</java>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/jcdifull/descriptor/beans.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/jcdifull/descriptor/beans.xml
index b2b07ac..6a0c02b 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/jcdifull/descriptor/beans.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/jcdifull/descriptor/beans.xml
@@ -17,11 +17,13 @@
-->
<beans
- xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="
- http://java.sun.com/xml/ns/javaee
- http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+ xmlns="https://jakarta.ee/xml/ns/jakartaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ https://jakarta.ee/xml/ns/jakartaee
+ https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd"
+ bean-discovery-mode="all" version="3.0"
+>
<interceptors>
<class>test.beans.interceptors.AnotherInterceptor</class>
</interceptors>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/passact/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/passact/build.xml
index 181bb06..f01b575 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/passact/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/passact/build.xml
@@ -69,6 +69,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/remote1/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/remote1/build.xml
index 7e9215c..16f8fcd 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/remote1/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/remote1/build.xml
@@ -69,6 +69,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/remote2/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/remote2/build.xml
index e21fda8..790c368 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/remote2/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/remote2/build.xml
@@ -66,6 +66,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
<arg line="ejb-ejb31-full-remote1-ejb"/>
</java>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/schema/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/schema/build.xml
index 3605d50..12244c6 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/schema/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/schema/build.xml
@@ -66,6 +66,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/sfsbscnc/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/sfsbscnc/build.xml
index 61ad649..234987a 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/sfsbscnc/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/sfsbscnc/build.xml
@@ -66,6 +66,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
<arg line="7"/>
</java>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/webandejb/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/webandejb/build.xml
index 39bc144..d158b9f 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/webandejb/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/full/webandejb/build.xml
@@ -64,6 +64,7 @@
failonerror="true"
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${contextroot}"/>
<arg line="${http.host}"/>
<arg line="${http.port}"/>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/security/simple/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/security/simple/build.xml
index 72955c5..eb6073a 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/security/simple/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/security/simple/build.xml
@@ -119,6 +119,8 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ <jvmarg value="--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
<arg line="anonymous"/>
</java>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/singleton/cache/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/singleton/cache/build.xml
index 29a3c19..86fdb57 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/singleton/cache/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/singleton/cache/build.xml
@@ -66,6 +66,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/singleton/hello/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/singleton/hello/build.xml
index 1a8433e..d4add8d 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/singleton/hello/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/singleton/hello/build.xml
@@ -68,6 +68,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/appserv-rt.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/singleton/hello/client/Client.java b/appserver/tests/appserv-tests/devtests/ejb/ejb31/singleton/hello/client/Client.java
index f64c869..d420ef5 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/singleton/hello/client/Client.java
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/singleton/hello/client/Client.java
@@ -21,8 +21,6 @@
import javax.naming.InitialContext;
-import javax.management.j2ee.ManagementHome;
-import javax.management.j2ee.Management;
import javax.rmi.PortableRemoteObject;
import com.sun.ejte.ccl.reporter.SimpleReporterAdapter;
@@ -48,20 +46,8 @@
public void doTest() {
try {
-
- // Ensure that MEJB is registered under all three of its JNDI names
- System.out.println("Looking up MEJB Homes");
- ManagementHome mh1Obj = (ManagementHome) new InitialContext().lookup("ejb/mgmt/MEJB");
- ManagementHome mh2Obj = (ManagementHome) new InitialContext().lookup("java:global/mejb/MEJBBean");
- ManagementHome mh3Obj = (ManagementHome) new InitialContext().lookup("java:global/mejb/MEJBBean!javax.management.j2ee.ManagementHome");
-
- System.out.println("mejb home obj 1 = " + mh1Obj);
- System.out.println("mejb home obj 2 = " + mh2Obj);
- System.out.println("mejb home obj 3 = " + mh3Obj);
-
Hello hello = (Hello) new InitialContext().lookup("java:global/" + appName + "/SingletonBean");
-
System.out.println("Singleton says : " + hello.hello());
hello.async();
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/singleton/hello/ejb/SingletonBean.java b/appserver/tests/appserv-tests/devtests/ejb/ejb31/singleton/hello/ejb/SingletonBean.java
index c52f2db..a3923bd 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/singleton/hello/ejb/SingletonBean.java
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/singleton/hello/ejb/SingletonBean.java
@@ -23,11 +23,9 @@
import javax.naming.InitialContext;
-import javax.management.j2ee.ManagementHome;
-
@Singleton
@Remote(Hello.class)
- @EJB(name="mejb", beanInterface=javax.management.j2ee.ManagementHome.class, mappedName="ejb/mgmt/MEJB")
+@EJB(name="mejb", mappedName="ejb/mgmt/MEJB")
@Startup
public class SingletonBean {
@@ -37,28 +35,6 @@
@PersistenceContext
private EntityManager em;
- /*Object returned from IIOP_OBJECT_FACTORY is still ior
- @EJB(mappedName="ejb/mgmt/MEJB")
- ManagementHome mHome1;
- */
-
- /* Object returned from IIOP_OBJECT_FACTORY is still ior
- @EJB(lookup="java:global/mejb/MEJBBean")
- ManagementHome mHome2;
- */
-
- /* Doesn't work b/c actual MEJB app Home interface is new glassfish
- * type, so actual type derived from field declaration is tacked
- * onto mappedName and results in NameNotFound
- @EJB(mappedName="java:global/mejb/MEJBBean")
- ManagementHome mHome2;
- */
-
-
-
-
- //MEJBHome mHome2;
-
@PostConstruct
public void init() {
System.out.println("In SingletonBean::init()");
@@ -66,18 +42,6 @@
if( orb == null ) {
throw new EJBException("null ORB");
}
- try {
- // same problem ManagementHome mHomeL = (ManagementHome) new InitialContext().lookup("java:comp/env/mejb");
- // same problem ManagementHome mHomeL2 = (ManagementHome) new InitialContext().lookup("java:global/mejb/MEJBBean");
- // System.out.println("mHomeL = " + mHomeL);
- // System.out.println("mHomeL2 = " + mHomeL2);
- } catch(Exception e) {
- throw new EJBException(e);
- }
-
- // System.out.println("mHome1 = " + mHome1);
- // System.out.println("mHome2 = " + mHome2);
-
}
public String hello() {
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/singleton/multi-module/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/singleton/multi-module/build.xml
index 1d8b44f..1431949 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/singleton/multi-module/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/singleton/multi-module/build.xml
@@ -121,10 +121,10 @@
<echo message="se.client: ${se.client}"/>
<java fork="on"
failonerror="true"
-
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${assemble.dir}/${appname}-ejb.jar:${assemble.dir}/${appname}-client.jar:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${module}-ejb"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/singleton/threemodules/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/singleton/threemodules/build.xml
index e9956b2..b703777 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/singleton/threemodules/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/singleton/threemodules/build.xml
@@ -121,10 +121,10 @@
<echo message="se.client: ${se.client}"/>
<java fork="on"
failonerror="true"
-
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${assemble.dir}/${appname}-ejb.jar:${assemble.dir}/${appname}-client.jar:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${module}-ejb"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/timer31/mdb/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/timer31/mdb/build.xml
index b6413bc..99598cd 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/timer31/mdb/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/timer31/mdb/build.xml
@@ -79,6 +79,8 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ <jvmarg value="--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb31/timer31/methodintf/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb31/timer31/methodintf/build.xml
index 2f1b034..622d2c8 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb31/timer31/methodintf/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb31/timer31/methodintf/build.xml
@@ -62,6 +62,8 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ <jvmarg value="--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb32/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb32/build.xml
index a0ae448..f7d4505 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb32/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb32/build.xml
@@ -36,7 +36,7 @@
<antcall target="intfces"/>
<antcall target="persistence"/>
<antcall target="interceptors"/>
- <antcall target="embedded"/>
+<!-- <antcall target="embedded"/>-->
</target>
<target name="lite">
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb32/ejblite/async/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb32/ejblite/async/build.xml
index 80265b1..773b04d 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb32/ejblite/async/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb32/ejblite/async/build.xml
@@ -64,6 +64,7 @@
failonerror="true"
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${contextroot}"/>
<arg line="${http.host}"/>
<arg line="${http.port}"/>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb32/ejblite/nonpersistenttimer/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb32/ejblite/nonpersistenttimer/build.xml
index 88c76d5..b741cfb 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb32/ejblite/nonpersistenttimer/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb32/ejblite/nonpersistenttimer/build.xml
@@ -64,6 +64,7 @@
failonerror="true"
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${contextroot}"/>
<arg line="${http.host}"/>
<arg line="${http.port}"/>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb32/embedded/autoclose/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb32/embedded/autoclose/build.xml
index 659af97..80e66d3 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb32/embedded/autoclose/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb32/embedded/autoclose/build.xml
@@ -67,8 +67,10 @@
failonerror="true"
classpath="${assemble.dir}/${appname}-ejb.jar:${embedded.classpath}:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="-Dxuse.hash.for.appid=true"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ <jvmarg value="--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
-<jvmarg value="-Dxuse.hash.for.appid=true"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/aroundconstruct/annotation/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/aroundconstruct/annotation/build.xml
index c4e4d7a..f0d9231 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/aroundconstruct/annotation/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/aroundconstruct/annotation/build.xml
@@ -62,6 +62,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/appserv-rt.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${appname}-ejb"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/aroundconstruct/descriptor/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/aroundconstruct/descriptor/build.xml
index 4f08666..44f5224 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/aroundconstruct/descriptor/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/aroundconstruct/descriptor/build.xml
@@ -63,6 +63,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/appserv-rt.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${appname}-ejb"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/constructor-level/annotation/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/constructor-level/annotation/build.xml
index a73fbc5..85853d4 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/constructor-level/annotation/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/constructor-level/annotation/build.xml
@@ -62,6 +62,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/appserv-rt.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${appname}-ejb"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/constructor-level/descriptor/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/constructor-level/descriptor/build.xml
index 2820fba..d8b06a2 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/constructor-level/descriptor/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/constructor-level/descriptor/build.xml
@@ -63,6 +63,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/appserv-rt.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${appname}-ejb"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/get_method_lc/annotation/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/get_method_lc/annotation/build.xml
index c3e7912..5f8b2d7 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/get_method_lc/annotation/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/get_method_lc/annotation/build.xml
@@ -62,6 +62,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/appserv-rt.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${appname}-ejb"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/get_method_lc/descriptor/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/get_method_lc/descriptor/build.xml
index 240e381..7d7c099 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/get_method_lc/descriptor/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/get_method_lc/descriptor/build.xml
@@ -63,6 +63,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/appserv-rt.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${appname}-ejb"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/interceptors-inheritance/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/interceptors-inheritance/build.xml
index f363302..ed31fa3 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/interceptors-inheritance/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/interceptors-inheritance/build.xml
@@ -62,6 +62,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/appserv-rt.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${appname}-ejb"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/lc-method-constructor-level/annotation/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/lc-method-constructor-level/annotation/build.xml
index 3568d17..1a189c4 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/lc-method-constructor-level/annotation/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/lc-method-constructor-level/annotation/build.xml
@@ -62,6 +62,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/appserv-rt.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${appname}-ejb"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/lc-method-constructor-level/descriptor/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/lc-method-constructor-level/descriptor/build.xml
index 6cf2855..862699e 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/lc-method-constructor-level/descriptor/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb32/interceptors/lc-method-constructor-level/descriptor/build.xml
@@ -63,6 +63,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/appserv-rt.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${appname}-ejb"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb32/intfces/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb32/intfces/build.xml
index 758e6c9..250794c 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb32/intfces/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb32/intfces/build.xml
@@ -107,6 +107,7 @@
<arg line="${client.type}"/>
<arg line="${ejb.jar}"/>
<arg line="${index}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb32/mdb/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb32/mdb/build.xml
index 817c04f..de03e24 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb32/mdb/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb32/mdb/build.xml
@@ -88,6 +88,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb32/mdb/ra/CommandResourceAdapter.java b/appserver/tests/appserv-tests/devtests/ejb/ejb32/mdb/ra/CommandResourceAdapter.java
index 2cd2254..0ed9298 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb32/mdb/ra/CommandResourceAdapter.java
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb32/mdb/ra/CommandResourceAdapter.java
@@ -23,7 +23,7 @@
import jakarta.resource.spi.ResourceAdapterInternalException;
import jakarta.resource.spi.endpoint.MessageEndpoint;
import jakarta.resource.spi.endpoint.MessageEndpointFactory;
-import jakarta.transaction.xa.XAResource;
+import javax.transaction.xa.XAResource;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb32/methodintf/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb32/methodintf/build.xml
index dc898ed..39bf1c7 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb32/methodintf/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb32/methodintf/build.xml
@@ -62,6 +62,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/basic/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/basic/build.xml
index 4e4e6e6..651d1d8 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/basic/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/basic/build.xml
@@ -66,6 +66,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/appserv-rt.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/basic/client/Client.java b/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/basic/client/Client.java
index 800f0b3..4f16875 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/basic/client/Client.java
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/basic/client/Client.java
@@ -21,8 +21,6 @@
import javax.naming.InitialContext;
-import javax.management.j2ee.ManagementHome;
-import javax.management.j2ee.Management;
import javax.rmi.PortableRemoteObject;
import com.sun.ejte.ccl.reporter.SimpleReporterAdapter;
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/basic/ejb/SFSB.java b/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/basic/ejb/SFSB.java
index 46fc80f..6bca0ac 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/basic/ejb/SFSB.java
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/basic/ejb/SFSB.java
@@ -22,7 +22,6 @@
import javax.naming.InitialContext;
-import javax.management.j2ee.ManagementHome;
@Stateful
@LocalBean
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/descriptor/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/descriptor/build.xml
index 97e57bb..fc88fd8 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/descriptor/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/descriptor/build.xml
@@ -66,6 +66,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/appserv-rt.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/descriptor/client/Client.java b/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/descriptor/client/Client.java
index 6e75724..fbc607d 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/descriptor/client/Client.java
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/descriptor/client/Client.java
@@ -21,8 +21,6 @@
import javax.naming.InitialContext;
-import javax.management.j2ee.ManagementHome;
-import javax.management.j2ee.Management;
import javax.rmi.PortableRemoteObject;
import com.sun.ejte.ccl.reporter.SimpleReporterAdapter;
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/descriptor/ejb/SFSB.java b/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/descriptor/ejb/SFSB.java
index 12e1717..a797b05 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/descriptor/ejb/SFSB.java
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/descriptor/ejb/SFSB.java
@@ -22,8 +22,6 @@
import javax.naming.InitialContext;
-import javax.management.j2ee.ManagementHome;
-
public class SFSB implements Hello {
private EntityManager em;
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/lifecycle_cb_txattr/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/lifecycle_cb_txattr/build.xml
index 6c87af9..ac27766 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/lifecycle_cb_txattr/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/lifecycle_cb_txattr/build.xml
@@ -66,6 +66,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/appserv-rt.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/lifecycle_cb_txattr/client/Client.java b/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/lifecycle_cb_txattr/client/Client.java
index 18b14ab..0a33261 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/lifecycle_cb_txattr/client/Client.java
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/lifecycle_cb_txattr/client/Client.java
@@ -21,8 +21,6 @@
import javax.naming.InitialContext;
-import javax.management.j2ee.ManagementHome;
-import javax.management.j2ee.Management;
import javax.rmi.PortableRemoteObject;
import com.sun.ejte.ccl.reporter.SimpleReporterAdapter;
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/lifecycle_cb_txattr/ejb/SFSB.java b/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/lifecycle_cb_txattr/ejb/SFSB.java
index dd6d00a..d15a8c5 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/lifecycle_cb_txattr/ejb/SFSB.java
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/lifecycle_cb_txattr/ejb/SFSB.java
@@ -22,8 +22,6 @@
import javax.naming.InitialContext;
-import javax.management.j2ee.ManagementHome;
-
@Stateful
@LocalBean
public class SFSB implements Hello {
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/lifecycle_cb_txattr/ejb/SFSB1.java b/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/lifecycle_cb_txattr/ejb/SFSB1.java
index 2f0dc24..d689f39 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/lifecycle_cb_txattr/ejb/SFSB1.java
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/lifecycle_cb_txattr/ejb/SFSB1.java
@@ -22,8 +22,6 @@
import javax.naming.InitialContext;
-import javax.management.j2ee.ManagementHome;
-
@Stateful
@LocalBean
public class SFSB1 implements Hello1 {
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/lifecycle_cb_txattr/ejb/SFSB2.java b/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/lifecycle_cb_txattr/ejb/SFSB2.java
index 759bd84..a39af15 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/lifecycle_cb_txattr/ejb/SFSB2.java
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb32/sfsb/lifecycle_cb_txattr/ejb/SFSB2.java
@@ -22,8 +22,6 @@
import javax.naming.InitialContext;
-import javax.management.j2ee.ManagementHome;
-
@Stateful
@LocalBean
public class SFSB2 implements Hello2 {
diff --git a/appserver/tests/appserv-tests/devtests/ejb/ejb32/timer/opallowed/build.xml b/appserver/tests/appserv-tests/devtests/ejb/ejb32/timer/opallowed/build.xml
index 314d8a4..fe95f0f 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/ejb32/timer/opallowed/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/ejb32/timer/opallowed/build.xml
@@ -31,98 +31,99 @@
<target name="all" depends="clean,build,deploy,run,undeploy"/>
- <target name="clean" depends="init-common">
- <antcall target="clean-common"/>
- </target>
+ <target name="clean" depends="init-common">
+ <antcall target="clean-common"/>
+ </target>
- <target name="compile" depends="clean">
- <!--this is tricky since webclient-war-common simply package all classes under ${war.classes}
+ <target name="compile" depends="clean">
+ <!--this is tricky since webclient-war-common simply package all classes under ${war.classes}
and we need remote/local interface in the war-->
- <copy todir="war">
- <fileset dir="ejb" includes="**/*Timeout.java,**/*TimeoutLocal.java"/>
- </copy>
- <antcall target="compile-common">
- <param name="src" value="war"/>
- </antcall>
- <delete>
- <fileset dir="war" includes="**/*Timeout.java,**/*TimeoutLocal.java"/>
- </delete>
- <antcall target="webclient-war-common">
- <param name="hasWebclient" value="true"/>
- </antcall>
- <antcall target="compile-common">
- <param name="src" value="ejb"/>
- </antcall>
- <antcall target="compile-common">
- <param name="src" value="client"/>
- </antcall>
- </target>
+ <copy todir="war">
+ <fileset dir="ejb" includes="**/*Timeout.java,**/*TimeoutLocal.java"/>
+ </copy>
+ <antcall target="compile-common">
+ <param name="src" value="war"/>
+ </antcall>
+ <delete>
+ <fileset dir="war" includes="**/*Timeout.java,**/*TimeoutLocal.java"/>
+ </delete>
+ <antcall target="webclient-war-common">
+ <param name="hasWebclient" value="true"/>
+ </antcall>
+ <antcall target="compile-common">
+ <param name="src" value="ejb"/>
+ </antcall>
+ <antcall target="compile-common">
+ <param name="src" value="client"/>
+ </antcall>
+ </target>
- <target name="build" depends="compile">
- <mkdir dir="${assemble.dir}"/>
- <antcall target="package-ejbjar-common">
- <param name="ejbjar.files" value="${build.classes.dir}"/>
- <param name="ejb.jar" value="${assemble.dir}/${appname}-ejb.jar"/>
- <param name="ejbjar.classes" value="**/*Timeout*.class" />
- </antcall>
- <antcall target="appclient-jar-common">
- <param name="appclientjar.classes" value="**/Client.class,**/*Timeout.class" />
- </antcall>
- <antcall target="ear-common"/>
- </target>
+ <target name="build" depends="compile">
+ <mkdir dir="${assemble.dir}"/>
+ <antcall target="package-ejbjar-common">
+ <param name="ejbjar.files" value="${build.classes.dir}"/>
+ <param name="ejb.jar" value="${assemble.dir}/${appname}-ejb.jar"/>
+ <param name="ejbjar.classes" value="**/*Timeout*.class" />
+ </antcall>
+ <antcall target="appclient-jar-common">
+ <param name="appclientjar.classes" value="**/Client.class,**/*Timeout.class" />
+ </antcall>
+ <antcall target="ear-common"/>
+ </target>
- <target name="deploy"
+ <target name="deploy"
depends="init-common">
- <antcall target="deploy-common"/>
- </target>
+ <antcall target="deploy-common"/>
+ </target>
- <!--run-appclient & run-jseclient are blocked by JIRA19546-->
- <target name="run" depends="run-pojo, run-webapp, run-managedbean"/>
+ <!--run-appclient & run-jseclient are blocked by JIRA19546-->
+ <target name="run" depends="run-pojo, run-webapp, run-managedbean"/>
- <target name="run-appclient" depends="init-common">
- <antcall target="runclient-common"/>
- </target>
+ <target name="run-appclient" depends="init-common">
+ <antcall target="runclient-common"/>
+ </target>
- <target name="run-jseclient" depends="init-common">
- <antcall target="run-client">
- <param name="client.type" value="jseClient" />
- </antcall>
- </target>
+ <target name="run-jseclient" depends="init-common">
+ <antcall target="run-client">
+ <param name="client.type" value="jseClient" />
+ </antcall>
+ </target>
- <target name="run-client">
- <java fork="on"
+ <target name="run-client">
+ <java fork="on"
failonerror="true"
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${test.client}">
- <sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
- <arg line="${client.type}"/>
- <arg line="${http.port}"/>
- </java>
- </target>
+ <sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}" />
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
+ <arg line="${client.type}"/>
+ <arg line="${http.port}"/>
+ </java>
+ </target>
- <target name="run-pojo" depends="init-common">
- <antcall target="run-client">
- <param name="client.type" value="pojo" />
- </antcall>
- </target>
+ <target name="run-pojo" depends="init-common">
+ <antcall target="run-client">
+ <param name="client.type" value="pojo" />
+ </antcall>
+ </target>
- <target name="run-webapp" depends="init-common">
- <antcall target="run-client">
- <param name="client.type" value="webapp" />
- </antcall>
- </target>
+ <target name="run-webapp" depends="init-common">
+ <antcall target="run-client">
+ <param name="client.type" value="webapp" />
+ </antcall>
+ </target>
- <target name="run-managedbean" depends="init-common">
- <antcall target="run-client">
- <param name="client.type" value="managedbean" />
- </antcall>
- </target>
+ <target name="run-managedbean" depends="init-common">
+ <antcall target="run-client">
+ <param name="client.type" value="managedbean" />
+ </antcall>
+ </target>
- <target name="undeploy" depends="init-common">
- <antcall target="undeploy-common"/>
- </target>
+ <target name="undeploy" depends="init-common">
+ <antcall target="undeploy-common"/>
+ </target>
- <target name="usage">
- <antcall target="usage-common"/>
- </target>
+ <target name="usage">
+ <antcall target="usage-common"/>
+ </target>
</project>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/run_test.sh b/appserver/tests/appserv-tests/devtests/ejb/run_test.sh
index 6660896..1487e39 100755
--- a/appserver/tests/appserv-tests/devtests/ejb/run_test.sh
+++ b/appserver/tests/appserv-tests/devtests/ejb/run_test.sh
@@ -294,7 +294,7 @@
}
list_test_ids(){
- echo ejb_all ejb_timer_cluster_all ejb_web_all ejb_group_1 ejb_group_2 ejb_group_3
+ echo ejb_all ejb_timer_cluster_all ejb_web_all ejb_group_1 ejb_group_2 ejb_group_3 ejb_group_embedded
}
OPT=${1}
diff --git a/appserver/tests/appserv-tests/devtests/ejb/stubs/ejbapp/descriptor/ejb-jar.xml b/appserver/tests/appserv-tests/devtests/ejb/stubs/ejbapp/descriptor/ejb-jar.xml
index 4b2a197..35ebd04 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/stubs/ejbapp/descriptor/ejb-jar.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/stubs/ejbapp/descriptor/ejb-jar.xml
@@ -33,20 +33,6 @@
<use-caller-identity/>
</security-identity>
</session>
-<!-- no javax.management.jar in workspace yet
- <session>
- <display-name>DummyMEJBBean</display-name>
- <ejb-name>DummyMEJBBean</ejb-name>
- <home>javax.management.j2ee.ManagementHome</home>
- <remote>javax.management.j2ee.Management</remote>
- <ejb-class>com.sun.s1asdev.ejb.stubs.ejbapp.DummyMEJBBean</ejb-class>
- <session-type>Stateless</session-type>
- <transaction-type>Bean</transaction-type>
- <security-identity>
- <use-caller-identity/>
- </security-identity>
- </session>
--->
</enterprise-beans>
<assembly-descriptor>
</assembly-descriptor>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/stubs/ejbapp/ejb/DummyMEJBBean.java b/appserver/tests/appserv-tests/devtests/ejb/stubs/ejbapp/ejb/DummyMEJBBean.java
index 0030181..bb8ff4c 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/stubs/ejbapp/ejb/DummyMEJBBean.java
+++ b/appserver/tests/appserv-tests/devtests/ejb/stubs/ejbapp/ejb/DummyMEJBBean.java
@@ -16,118 +16,6 @@
package com.sun.s1asdev.ejb.stubs.ejbapp;
-import java.io.Serializable;
-import java.rmi.RemoteException;
-import jakarta.ejb.SessionBean;
-import jakarta.ejb.SessionContext;
-import jakarta.ejb.EJBException;
-
-import java.util.*;
-//import javax.management.*;
-//import javax.management.j2ee.*;
-
-public class DummyMEJBBean {} /**
-implements SessionBean {
-
- private SessionContext sc;
-
- public DummyMEJBBean() {}
-
- public void ejbCreate() throws RemoteException {
- System.out.println("In DummyMEJBBean::ejbCreate !!");
- }
-
- public void setSessionContext(SessionContext sc) {
- this.sc = sc;
- }
-
- public Set queryNames(ObjectName name, QueryExp query) {
- return new HashSet();
- }
-
- public boolean isRegistered(ObjectName name) {
- return false;
- }
-
- public Integer getMBeanCount() {
-
- // Invoking this method from another app will verify that
- // the context class loader for this app is set appropriately during
- // the invocation. The javax.management.j2ee apis are packaged
- // as part of the server's classpath. That matches the behavior of
- // Bug 6342495, which showed that the context class loader was still
- // set to the calling application when the Home/Remote interfaces were
- // loaded from above the application classloader level.
- //
- // Calling getClassLoader tests that the context classloader is set
- // appropriately because of the security requirements that J2SE
- // imposes on requesting a class loader. By default application code
- // in the appserver does not have the RuntimePermission
- // "getClassLoader". In that case, requesting a class loader is only
- // allowed if the returned class loader matches the requesting
- // class' class loader(or is a child of it). So, if the context
- // class loader is still incorrectly set to the calling app's
- // class loader, the call to getContextClassLoader() should throw
- // a security exception.
-
- // The advantage to writing the test using
- // javax.management APIs and this behavior is it will work on an
- // out-of-the-box installation of the appserver. No additions to the
- // server's classpath or the default server.policy file are needed.
-
-
- System.out.println("In DummyEJBBean::getMBeanCount()");
-
- System.out.println("My classloader = " +
- DummyMEJBBean.class.getClassLoader());
-
- // This should fail with a security exception if the caller is in
- // a separate app within the same server and the context class
- // loader is still incorrectly set to the caller app's classloader.
- System.out.println("context class loader = " +
- Thread.currentThread().getContextClassLoader());
-
-
- return new Integer(0);
- }
-
-
- public MBeanInfo getMBeanInfo(ObjectName name) throws IntrospectionException, InstanceNotFoundException, ReflectionException {
- return null;
- }
-
- public Object getAttribute(ObjectName name, String attribute) throws MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException {
- return null;
- }
-
- public AttributeList getAttributes(ObjectName name, String[] attributes) throws InstanceNotFoundException, ReflectionException {
- return null;
- }
-
- public void setAttribute(ObjectName name, Attribute attribute) throws InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException {
- return;
- }
-
- public AttributeList setAttributes(ObjectName name, AttributeList attributes) throws InstanceNotFoundException, ReflectionException {
- return null;
- }
-
- public Object invoke(ObjectName name, String operationName, Object[] params, String[] signature) throws InstanceNotFoundException, MBeanException, ReflectionException {
- return null;
- }
-
- public String getDefaultDomain() {
- return null;
- }
-
- public ListenerRegistration getListenerRegistry() {
- return null;
- }
-
- public void ejbRemove() throws RemoteException {}
-
- public void ejbActivate() {}
-
- public void ejbPassivate() {}
+public class DummyMEJBBean {
+
}
- */
diff --git a/appserver/tests/appserv-tests/devtests/ejb/stubs/standaloneclient/build.xml b/appserver/tests/appserv-tests/devtests/ejb/stubs/standaloneclient/build.xml
index b13140d..0da9b7b 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/stubs/standaloneclient/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/stubs/standaloneclient/build.xml
@@ -50,8 +50,8 @@
failonerror="true"
classpath="${env.S1AS_HOME}/lib/j2ee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${assemble.dir}/ejb-stubs-ejbappAppClient/ejb-stubs-ejbapp-clientClient.jar:${env.APS_HOME}/lib/reporter.jar"
classname="${simple.client}">
- <jvmarg
- value="-Dorg.omg.CORBA.ORBInitialPort=${orb.port}"/>
+ <jvmarg value="-Dorg.omg.CORBA.ORBInitialPort=${orb.port}"/>
+ <jvmarg value="-Dorg.glassfish.gmbal.no.multipleUpperBoundsException=true" />
<arg value="ejb/ejb_stubs_ejbapp_HelloBean"/>
<arg value="${ic.props}"/>
</java>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/stubs/stubser/build.xml b/appserver/tests/appserv-tests/devtests/ejb/stubs/stubser/build.xml
index f45d11f..217a6a4 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/stubs/stubser/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/stubs/stubser/build.xml
@@ -84,6 +84,7 @@
failonerror="true"
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
</java>
</target>
@@ -92,6 +93,7 @@
failonerror="true"
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="handle"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/stubs/webclient/descriptor/web.xml b/appserver/tests/appserv-tests/devtests/ejb/stubs/webclient/descriptor/web.xml
index b28878f..479e9d8 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/stubs/webclient/descriptor/web.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/stubs/webclient/descriptor/web.xml
@@ -36,13 +36,5 @@
<home>com.sun.s1asdev.ejb.stubs.ejbapp.HelloHome</home>
<remote>com.sun.s1asdev.ejb.stubs.ejbapp.Hello</remote>
</ejb-ref>
-<!--
- <ejb-ref>
- <ejb-ref-name>ejb/dummymejb</ejb-ref-name>
- <ejb-ref-type>Session</ejb-ref-type>
- <home>javax.management.j2ee.ManagementHome</home>
- <remote>javax.management.j2ee.Management</remote>
- </ejb-ref>
--->
</web-app>
diff --git a/appserver/tests/appserv-tests/devtests/ejb/stubs/webclient/servlet/Servlet.java b/appserver/tests/appserv-tests/devtests/ejb/stubs/webclient/servlet/Servlet.java
index cf43e50..ce6e779 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/stubs/webclient/servlet/Servlet.java
+++ b/appserver/tests/appserv-tests/devtests/ejb/stubs/webclient/servlet/Servlet.java
@@ -25,9 +25,6 @@
import com.sun.s1asdev.ejb.stubs.ejbapp.Hello;
import com.sun.s1asdev.ejb.stubs.ejbapp.HelloHome;
-//import javax.management.j2ee.ManagementHome;
-//import javax.management.j2ee.Management;
-
public class Servlet extends HttpServlet {
diff --git a/appserver/tests/appserv-tests/devtests/ejb/timer/sessiontimer/ejb/TimerSessionEJB.java b/appserver/tests/appserv-tests/devtests/ejb/timer/sessiontimer/ejb/TimerSessionEJB.java
index 23448dc..9b17dfe 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/timer/sessiontimer/ejb/TimerSessionEJB.java
+++ b/appserver/tests/appserv-tests/devtests/ejb/timer/sessiontimer/ejb/TimerSessionEJB.java
@@ -49,7 +49,7 @@
try {
System.out.println("Calling getMessageContext");
- context.getMessageContext();
+ context.getEJBObject();
} catch(IllegalStateException ise) {
System.out.println("getMessageContext() successfully threw illegalStateException");
}
@@ -63,7 +63,7 @@
public void ejbTimeout(Timer timer) {
try {
System.out.println("Calling getMessageContext");
- context.getMessageContext();
+ context.getEJBObject();
} catch(IllegalStateException ise) {
System.out.println("getMessageContext() successfully threw illegalStateException");
}
diff --git a/appserver/tests/appserv-tests/devtests/ejb/util/methodmap/build.xml b/appserver/tests/appserv-tests/devtests/ejb/util/methodmap/build.xml
index c2bc0d5..c426b9f 100644
--- a/appserver/tests/appserv-tests/devtests/ejb/util/methodmap/build.xml
+++ b/appserver/tests/appserv-tests/devtests/ejb/util/methodmap/build.xml
@@ -31,40 +31,40 @@
<target name="all" depends="build, runclient"/>
- <target name="clean" depends="init-common">
- <antcall target="clean-common"/>
- </target>
+ <target name="clean" depends="init-common">
+ <antcall target="clean-common"/>
+ </target>
- <target name="build" depends="init-common">
- <mkdir dir="${build.classes.dir}"/>
- <echo message="common.xml: Compiling test source files" level="verbose"/>
- <javac srcdir="client"
- destdir="${build.classes.dir}"
- classpath="${s1astest.classpath}:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
- debug="on"
- failonerror="true"/>
- </target>
+ <target name="build" depends="init-common">
+ <mkdir dir="${build.classes.dir}"/>
+ <echo message="common.xml: Compiling test source files" level="verbose"/>
+ <javac srcdir="client"
+ destdir="${build.classes.dir}"
+ classpath="${s1astest.classpath}:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
+ debug="on"
+ failonerror="true"/>
+ </target>
- <target name="runclient" depends="init-common">
- <java fork="on"
- failonerror="true"
- classpath="${env.S1AS_HOME}/lib/j2ee.jar:${env.S1AS_HOME}/lib/appserv-rt.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
- classname="${simple.client}">
- </java>
- </target>
+ <target name="runclient" depends="init-common">
+ <java fork="on"
+ failonerror="true"
+ classpath="${env.S1AS_HOME}/lib/j2ee.jar:${env.S1AS_HOME}/lib/appserv-rt.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
+ classname="${simple.client}">
+ </java>
+ </target>
- <target name="perf" depends="init-common">
- <java fork="on"
- failonerror="true"
- classpath="${env.S1AS_HOME}/lib/j2ee.jar:${env.S1AS_HOME}/lib/appserv-rt.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
- classname="${perf.client}">
- <arg value="javax.xml.rpc.Service"/>
- <arg value="100000"/>
- </java>
- </target>
+ <target name="perf" depends="init-common">
+ <java fork="on"
+ failonerror="true"
+ classpath="${env.S1AS_HOME}/lib/j2ee.jar:${env.S1AS_HOME}/lib/appserv-rt.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
+ classname="${perf.client}">
+ <arg value="javax.xml.rpc.Service"/>
+ <arg value="100000"/>
+ </java>
+ </target>
- <target name="usage">
- <antcall target="usage-common"/>
- </target>
+ <target name="usage">
+ <antcall target="usage-common"/>
+ </target>
</project>
diff --git a/appserver/tests/appserv-tests/devtests/jdbc/jpa-dsd/build.xml b/appserver/tests/appserv-tests/devtests/jdbc/jpa-dsd/build.xml
index 406c42b..f34a457 100644
--- a/appserver/tests/appserv-tests/devtests/jdbc/jpa-dsd/build.xml
+++ b/appserver/tests/appserv-tests/devtests/jdbc/jpa-dsd/build.xml
@@ -136,6 +136,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${simple.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/naming/injection/build.xml b/appserver/tests/appserv-tests/devtests/naming/injection/build.xml
index 7e46363..d9f9b75 100644
--- a/appserver/tests/appserv-tests/devtests/naming/injection/build.xml
+++ b/appserver/tests/appserv-tests/devtests/naming/injection/build.xml
@@ -78,6 +78,7 @@
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
<sysproperty key="org.omg.CORBA.ORBInitialPort" value="${orb.port}"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="${jndiroot}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/transaction/ee/autorecovery/build.xml b/appserver/tests/appserv-tests/devtests/transaction/ee/autorecovery/build.xml
index 25375a0..7506b12 100644
--- a/appserver/tests/appserv-tests/devtests/transaction/ee/autorecovery/build.xml
+++ b/appserver/tests/appserv-tests/devtests/transaction/ee/autorecovery/build.xml
@@ -129,6 +129,7 @@
failonerror="true"
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${env.APS_HOME}/lib/reportbuilder.jar:${build.classes.dir}"
classname="${se.client}">
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<arg line="verify_xa"/>
<arg line="${appname}-web"/>
<arg line="in2"/>
diff --git a/appserver/tests/appserv-tests/devtests/transaction/ee/cli/build.xml b/appserver/tests/appserv-tests/devtests/transaction/ee/cli/build.xml
index 04c2b69..ad640ba 100644
--- a/appserver/tests/appserv-tests/devtests/transaction/ee/cli/build.xml
+++ b/appserver/tests/appserv-tests/devtests/transaction/ee/cli/build.xml
@@ -115,9 +115,9 @@
failonerror="true"
classpath="${env.S1AS_HOME}/lib/javaee.jar:${env.S1AS_HOME}/lib/gf-client.jar:${env.APS_HOME}/lib/reportbuilder.jar:${build.classes.dir}:${env.APS_HOME}/lib/reporter.jar"
classname="${se.client}">
+ <sysproperty key="enableShoalLogger" value="${enableShoalLogger}"/>
<arg line="prepare"/>
<arg line="${assemble.dir}/${appname}-web.war"/>
- <sysproperty key="enableShoalLogger" value="${enableShoalLogger}"/>
</java>
</target>
diff --git a/appserver/tests/appserv-tests/devtests/webservice/annotations/soaptcp/build.xml b/appserver/tests/appserv-tests/devtests/webservice/annotations/soaptcp/build.xml
index db63bb5..01c9fca 100644
--- a/appserver/tests/appserv-tests/devtests/webservice/annotations/soaptcp/build.xml
+++ b/appserver/tests/appserv-tests/devtests/webservice/annotations/soaptcp/build.xml
@@ -121,6 +121,7 @@
<echo message="running client: client.Client dir: ${build.classes.dir}/client"/>
<java fork="true" classname="client.Client" dir="${build.classes.dir}/client">
<jvmarg value="-Djava.util.logging.config.file=logging.properties"/>
+ <jvmarg value="--add-opens=java.base/java.lang=ALL-UNNAMED" />
<classpath>
<path refid="client-classpath"/>
<pathelement path="${build.classes.dir}/client"/>
diff --git a/appserver/tests/appserv-tests/devtests/webservice/google/mejbclient/MANIFEST.MF b/appserver/tests/appserv-tests/devtests/webservice/google/mejbclient/MANIFEST.MF
deleted file mode 100644
index 73cd735..0000000
--- a/appserver/tests/appserv-tests/devtests/webservice/google/mejbclient/MANIFEST.MF
+++ /dev/null
@@ -1,2 +0,0 @@
-Manifest-Version: 1.0
-Main-Class: google.MEJBClient
diff --git a/appserver/tests/appserv-tests/devtests/webservice/google/mejbclient/MEJBClient.java b/appserver/tests/appserv-tests/devtests/webservice/google/mejbclient/MEJBClient.java
deleted file mode 100644
index 4be7e3e..0000000
--- a/appserver/tests/appserv-tests/devtests/webservice/google/mejbclient/MEJBClient.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright (c) 2001, 2018 Oracle and/or its affiliates. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-package google;
-
-//import com.sun.ejte.ccl.reporter.SimpleReporterAdapter;
-import java.io.*;
-import java.util.*;
-import java.net.*;
-import javax.management.j2ee.ManagementHome;
-import javax.management.j2ee.Management;
-import javax.management.*;
-import javax.naming.*;
-import javax.rmi.PortableRemoteObject;
-
-public class MEJBClient {
-
-// private SimpleReporterAdapter stat =
-// new SimpleReporterAdapter("appserv-tests");
-
- public static void main(String[] args) {
- MEJBClient client = new MEJBClient();
-
- // run the tests
- client.runTestClient();
- }
-
- public void runTestClient() {
- try{
-// stat.addDescription("Testing webservices mejb client app.");
- test01();
-// stat.printSummary("webservicesMejbAppID");
- } catch (Exception ex) {
- System.out.println("Exception in runTestClient: " + ex.toString());
- ex.printStackTrace();
- }
- }
-
- public void test01() {
-
- // instanciate the mejb
- try {
-
- Context ic = new InitialContext();
- System.out.println("***Created initial context");
-
- java.lang.Object objref = ic.lookup("ejb/mgmt/MEJB");
- System.out.println("***Looked up ManagementHome!!");
-
- ManagementHome home = (ManagementHome)PortableRemoteObject.narrow(
- objref, ManagementHome.class);
- System.out.println("***Narrowed ManagementHome!!");
-
- Management mejb = home.create();
- System.out.println("***Got the MEJB!!");
-
- String domain = mejb.getDefaultDomain();
- System.out.println("***MEJB default domain = "+domain);
- int mbeanCount = mejb.getMBeanCount().intValue();
- System.out.println("***MBeanCount = "+mbeanCount);
-
- // Print attributes of all MBeans
- ObjectName query = new ObjectName("*:j2eeType=J2EEApplication,name=googleApp,*");
- Set mbeanNames = mejb.queryNames(query, null);
- if ( mbeanNames.size() != 1 ) {
- System.out.println("***ERROR: mbeans returned by query is "
- +mbeanNames.size() + " it should be 1");
- }
-
- Iterator it = mbeanNames.iterator();
- ObjectName name = (ObjectName)it.next();
- System.out.println("Obtained jsr77 mbean for googleApp = "+name);
-
- // Get attr values from MEJB and print them
- try{
- Object attr = mejb.getAttribute(name, "hasWebServices");
- boolean hasWebServices=false;
- if (attr instanceof Boolean) {
- hasWebServices = ((Boolean) attr).booleanValue();
- }
-
- System.out.println("For HasWebServices "+hasWebServices);
-
- attr = mejb.getAttribute(name, "endpointAddresses");
- if (attr instanceof String[]) {
- String[] addresses = (String[]) attr;
- for (int i=0;i<addresses.length;i++) {
- System.out.println("Registered addresses " + addresses[i]);
-
- // retrieve the wsdl file
- URL url = new URL("http://localhost:8080/"+addresses[i]+"?wsdl");
- HttpURLConnection connection = (HttpURLConnection) url.openConnection();
- connection.setRequestMethod("GET");
- connection.connect();
- int responseCode = connection.getResponseCode();
- if (responseCode!=HttpURLConnection.HTTP_OK) {
- System.out.println("Cannot retrieve wsdl for " + addresses[i] + " error is " + connection.getResponseMessage());
- } else {
- InputStream is = new BufferedInputStream(connection.getInputStream());
- byte[] buffer = new byte[100];
- int read;
- do {
- read = is.read(buffer,0, 100);
- System.out.println(new String(buffer,0, read));
- } while(read==100 && read!=-1);
- }
- }
- }
-
- }
- catch(Exception exp){
- //exp.printStackTrace();
- System.out.println("***Exception occured while "+
- "accessing mbean details: Keep continuing\n");
- }
-
- mejb.remove();
-
- } catch(NamingException ne){
- System.out.println("***Exception while initializing context.\n");
- ne.printStackTrace();
- } catch(Exception re) {
- re.printStackTrace();
- }
- }
-
-}
diff --git a/appserver/tests/appserv-tests/devtests/webservice/google/mejbclient/application-client.xml b/appserver/tests/appserv-tests/devtests/webservice/google/mejbclient/application-client.xml
deleted file mode 100644
index 75db3a9..0000000
--- a/appserver/tests/appserv-tests/devtests/webservice/google/mejbclient/application-client.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v. 2.0, which is available at
- http://www.eclipse.org/legal/epl-2.0.
-
- This Source Code may also be made available under the following Secondary
- Licenses when the conditions for such availability set forth in the
- Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- version 2 with the GNU Classpath Exception, which is available at
- https://www.gnu.org/software/classpath/license.html.
-
- SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-
--->
-
-<application-client version="1.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application-client_1_4.xsd">
- <description>This is my mejb client</description>
- <display-name>MEJBClient</display-name>
- <ejb-ref>
- <ejb-ref-name>ejbs/mejb</ejb-ref-name>
- <ejb-ref-type>Session</ejb-ref-type>
- <home>javax.management.j2ee.ManagementHome</home>
- <remote>javax.management.j2ee.Management</remote>
- <ejb-link>MEjbBean</ejb-link>
- </ejb-ref>
-</application-client>
diff --git a/appserver/tests/appserv-tests/devtests/webservice/google/mejbclient/sun-application-client.xml b/appserver/tests/appserv-tests/devtests/webservice/google/mejbclient/sun-application-client.xml
deleted file mode 100644
index 5357b1b..0000000
--- a/appserver/tests/appserv-tests/devtests/webservice/google/mejbclient/sun-application-client.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE sun-application-client PUBLIC "-//Sun Microsystems, Inc.//DTD Sun ONE Application Server 8.0 Application Client 1.4//EN" "http://www.sun.com/software/sunone/appserver/dtds/sun-application-client_1_4-0.dtd">
-<!--
-
- Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v. 2.0, which is available at
- http://www.eclipse.org/legal/epl-2.0.
-
- This Source Code may also be made available under the following Secondary
- Licenses when the conditions for such availability set forth in the
- Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- version 2 with the GNU Classpath Exception, which is available at
- https://www.gnu.org/software/classpath/license.html.
-
- SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-
--->
-
-<sun-application-client>
- <ejb-ref>
- <ejb-ref-name>ejbs/mejb</ejb-ref-name>
- <jndi-name>ejb/mgmt/MEJB</jndi-name>
- </ejb-ref>
-</sun-application-client>
diff --git a/appserver/tests/gftest.sh b/appserver/tests/gftest.sh
index cd64be0..0256cc9 100755
--- a/appserver/tests/gftest.sh
+++ b/appserver/tests/gftest.sh
@@ -49,7 +49,10 @@
# setup the local repository
# with the archived chunk from the pipeline build stage
- cat ${WORKSPACE}/bundles/_maven-repo* | tar -xvz -f - --overwrite -m -p -C ${HOME}/.m2/repository
+ tar -xzf ${WORKSPACE}/bundles/maven-repo.tar.gz --overwrite -m -p -C ${HOME}/.m2/repository
+ echo "Removing old glassfish directory: ${S1AS_HOME}";
+ rm -rf "${S1AS_HOME}";
fi
-"$@"
\ No newline at end of file
+"$@"
+
diff --git a/appserver/tests/quicklook/amx/src/test/amx/AMXConfigProxyTests.java b/appserver/tests/quicklook/amx/src/test/amx/AMXConfigProxyTests.java
index 3090a5a..36167d2 100644
--- a/appserver/tests/quicklook/amx/src/test/amx/AMXConfigProxyTests.java
+++ b/appserver/tests/quicklook/amx/src/test/amx/AMXConfigProxyTests.java
@@ -34,7 +34,6 @@
import org.glassfish.admin.amx.core.*;
import org.glassfish.admin.amx.base.*;
import org.glassfish.admin.amx.config.*;
-//import org.glassfish.admin.amx.j2ee.*;
import org.glassfish.admin.amx.monitoring.*;
import org.glassfish.admin.amx.util.CollectionUtil;
import org.glassfish.admin.amx.util.ExceptionUtil;
diff --git a/appserver/tests/quicklook/run_test.sh b/appserver/tests/quicklook/run_test.sh
index 7275159..782b8ad 100755
--- a/appserver/tests/quicklook/run_test.sh
+++ b/appserver/tests/quicklook/run_test.sh
@@ -26,7 +26,7 @@
cp ${WORKSPACE}/nucleus/domains/domain1/logs/server.log* ${WORKSPACE}/results
fi
cp ${TEST_RUN_LOG} ${WORKSPACE}/results/
- tar -cf ${WORKSPACE}/${1}-results.tar.gz ${WORKSPACE}/results
+ tar -czf ${WORKSPACE}/${1}-results.tar.gz ${WORKSPACE}/results
change_junit_report_class_names
}
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/common/com/sun/enterprise/admin/mbeanapi/common/AMXMonitoringTestBase.java b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/common/com/sun/enterprise/admin/mbeanapi/common/AMXMonitoringTestBase.java
deleted file mode 100644
index e6ab0a2..0000000
--- a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/common/com/sun/enterprise/admin/mbeanapi/common/AMXMonitoringTestBase.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (c) 2003, 2018 Oracle and/or its affiliates. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-package com.sun.enterprise.admin.mbeanapi.common;
-
-import com.sun.appserv.management.DomainRoot;
-import com.sun.appserv.management.monitor.ApplicationMonitor;
-import com.sun.appserv.management.monitor.MonitoringRoot;
-import com.sun.appserv.management.monitor.MonitoringStats;
-import com.sun.appserv.management.monitor.ServerRootMonitor;
-import java.io.IOException;
-import javax.management.j2ee.statistics.Statistic;
-import javax.management.j2ee.statistics.Stats;
-
-/**
- */
-public class AMXMonitoringTestBase {
-
- DomainRoot mDomainRoot;
- public static final String SERVER_NAME = "server";
- public static final String APP_NAME = "stateless-simple";
- public static final String STATELESS_EJB_NAME = "stateless-simple.war";
-
-
- public AMXMonitoringTestBase(final String host, final int port,
- final String adminUser, final String adminPassword,
- final boolean useTLS) throws IOException {
-
- final AMXConnector ct =
- new AMXConnector( host, port, adminUser, adminPassword, useTLS );
- mDomainRoot = ct.getDomainRoot();
-
- }
-
- /**
- *
- */
- private MonitoringRoot getMonitoringRoot() {
- return mDomainRoot.getMonitoringRoot();
- }
-
- /**
- *
- */
- public ServerRootMonitor getServerRootMonitor(final String serverName) {
-
- ServerRootMonitor svrRoot =
- (serverName != null || "".equals(serverName))
- ? ( (ServerRootMonitor) getMonitoringRoot().
- getServerRootMonitorMap().get(serverName) )
- : ( (ServerRootMonitor) getMonitoringRoot().
- getServerRootMonitorMap().get(SERVER_NAME) );
- assert(svrRoot != null) : "Cannot find server with name " +
- serverName + "!";
- return svrRoot;
- }
-
-
- /**
- *
- */
- public ApplicationMonitor getApplicationMonitor(
- final String serverName, final String appName) {
- ApplicationMonitor app =
- (appName != null || "".equals(appName))
- ? ( (ApplicationMonitor) getServerRootMonitor(serverName).
- getApplicationMonitorMap().get(appName) )
- : ( (ApplicationMonitor) getServerRootMonitor(serverName).
- getApplicationMonitorMap().get(APP_NAME) );
- assert(app != null) : "Cannot find application monitor with name " +
- appName + "!";
- return app;
- }
-
-
- /**
- *
- */
- public void listStats (MonitoringStats ms) {
- if (ms != null) {
- Stats stats = ms.getStats();
- Statistic[] sts = stats.getStatistics();
- printStats(sts);
- } else {
- System.out.println("VERIFY! Stats for " + ms.getName()
- + " doesn't exist!");
- }
- }
-
-
- /**
- *
- */
- public void printStats(Statistic[] stats) {
- if (stats == null) {
- return;
- }
-
- for ( int i=0; i < stats.length; i++) {
- printStat(stats[i]);
- }
- }
-
-
- /**
- *
- *
- */
- public void printStat(Statistic stat) {
- if (stat == null) {
- return;
- } else {
- System.out.println(" | ");
- System.out.println(" | ");
- System.out.println(" --- Stat [" + stat.getName() + "]");
- System.out.println(" |");
- System.out.println(" |");
- System.out.println(" ---- Description: "
- + stat.getDescription());
- System.out.println(" ---- Start Time: "
- + stat.getStartTime());
- System.out.println(" ---- Last Sample Time: "
- + stat.getLastSampleTime());
- System.out.println(" ---- Unit: "
- + stat.getUnit());
- System.out.println("\n");
- }
- }
-
- /**
- *
- */
- public static void printArgs(final String [] args) {
- System.out.println("Printing arguments......");
- for(int i = 0; i < args.length; i++) {
- System.out.println("Args[" + i + "]: " + args[i]);
- }
- }
-
- /**
- *
- */
- public void printBlock(final String title) {
- System.out.println("\n*******************************************");
- System.out.println("* *");
- System.out.println("* " + title + " *");
- System.out.println("* *");
- System.out.println("*******************************************\n");
- }
-}
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/README b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/README
deleted file mode 100644
index f09c6b9..0000000
--- a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/README
+++ /dev/null
@@ -1,8 +0,0 @@
-To run tests:
-
-cd mbeanapi/common
-ant all // compiles common files required
-
-cd mbeanapi/monitoring
-ant all
-
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/build.properties b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/build.properties
deleted file mode 100644
index 9f2f6c3..0000000
--- a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/build.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
-
- Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v. 2.0, which is available at
- http://www.eclipse.org/legal/epl-2.0.
-
- This Source Code may also be made available under the following Secondary
- Licenses when the conditions for such availability set forth in the
- Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- version 2 with the GNU Classpath Exception, which is available at
- https://www.gnu.org/software/classpath/license.html.
-
- SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-
--->
-
-
-<property name="ee" value="enterprise edition"/>
-<property name="appserver.instance.name" value="server"/>
-
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/build.xml b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/build.xml
deleted file mode 100644
index 63552c9..0000000
--- a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/build.xml
+++ /dev/null
@@ -1,120 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE project [
-<!--
-
- Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v. 2.0, which is available at
- http://www.eclipse.org/legal/epl-2.0.
-
- This Source Code may also be made available under the following Secondary
- Licenses when the conditions for such availability set forth in the
- Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- version 2 with the GNU Classpath Exception, which is available at
- https://www.gnu.org/software/classpath/license.html.
-
- SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-
--->
-
-<!ENTITY commonSetup SYSTEM "file:./../../../../../config/properties.xml">
-<!ENTITY commonBuild SYSTEM "file:./../../../../../config/common.xml">
-<!ENTITY commonBuild SYSTEM "file:./../../../../../config/run.xml">
-<!ENTITY eeCommonBuild SYSTEM "file:./../../../../../config/ee-common.xml">
-<!ENTITY testproperties SYSTEM "file:./build.properties">
-]>
-
-<project name="ee-synchronization" default="usage" basedir=".">
-
- &commonSetup;
- &commonBuild;
- &eeCommonBuild;
- &testproperties;
-
- <target name="all" depends="setup, run-tests, cleanup"/>
-
- <target name="setup">
- <antcall target="deploy-apps"/>
- <antcall target="create-connection-pools"/>
- </target>
-
- <target name="deploy-apps">
- <echo message="Deploying ${env.S1AS_HOME}/samples/ejb/stateless/apps/simple/stateless-simple.ear "/>
- <antcall target="deploy-common">
- <param name="deployed.app" value="${env.S1AS_HOME}/samples/ejb/stateless/apps/simple/stateless-simple.ear"/>
- </antcall>
- </target>
-
- <target name="undeploy-apps">
- <echo message="Un deploying stateless-simple"/>
- <antcall target="undeploy-common">
- <param name="deployedapp.name" value="stateless-simple"/>
- </antcall>
- </target>
-
- <target name="create-connection-pools">
- <echo message="creating a connection pool mbeanapi-test-conn-pool"/>
- <antcall target="create-connector-connpool">
- <param name="ra.name" value="stateless-simple#jdbcra"/>
- <param name="connection.defname" value="javax.sql.DataSource"/>
- <param name="connector.conpool.name" value="mbeanapi-test-conn-pool"/>
- </antcall>
- </target>
-
- <target name="remove-connection-pools">
- <echo message="deleting connection pool mbeanapi-test-conn-pool"/>
- <antcall target="delete-connector-connpool-common">
- <param name="connector.conpool.name" value="mbeanapi-test-conn-pool"/>
- </antcall>
- </target>
-
- <target name="run-tests" depends="setup">
- <antcall target="ejb">
- <param name="ejb.target" value="all"/>
- </antcall>
- <antcall target="web">
- <param name="web.target" value="all"/>
- </antcall>
- <antcall target="jdbc">
- <param name="jdbc.target" value="all"/>
- </antcall>
- <antcall target="misc">
- <param name="misc.target" value="all"/>
- </antcall>
- </target>
-
- <target name="ejb">
- <record name="ejb.output" action="start"/>
- <ant dir="ejb" target="${ejb.target}"/>
- <record name="ejb.output" action="stop"/>
- </target>
-
- <target name="web">
- <record name="web.output" action="start"/>
- <ant dir="web" target="${web.target}"/>
- <record name="web.output" action="stop"/>
- </target>
-
- <target name="jdbc">
- <record name="jdbc.output" action="start"/>
- <ant dir="jdbc" target="${jdbc.target}"/>
- <record name="jdbc.output" action="stop"/>
- </target>
-
- <target name="misc">
- <record name="misc.output" action="start"/>
- <ant dir="misc" target="${misc.target}"/>
- <record name="misc.output" action="stop"/>
- </target>
-
- <target name="cleanup">
- <antcall target="undeploy-apps"/>
- <antcall target="remove-connection-pools"/>
- </target>
-
- <target name="usage">
- <antcall target="usage-common"/>
- </target>
-
-</project>
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/connector/ConnectorMonitoring.java b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/connector/ConnectorMonitoring.java
deleted file mode 100644
index 6d2dcf2..0000000
--- a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/connector/ConnectorMonitoring.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (c) 2003, 2018 Oracle and/or its affiliates. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-package com.sun.s1asdev.admin.mbeanapi.monitoring.connector;
-
-import com.sun.appserv.management.monitor.ConnectorConnectionPoolMonitor;
-import java.io.IOException;
-
-import java.util.Map;
-import java.util.Set;
-import java.util.Iterator;
-import java.util.Collection;
-
-import com.sun.appserv.management.monitor.ApplicationMonitor;
-import com.sun.appserv.management.monitor.WebModuleMonitor;
-import com.sun.appserv.management.monitor.ServletMonitor;
-import com.sun.appserv.management.monitor.WebModuleVirtualServerMonitor;
-import com.sun.appserv.management.monitor.NativeWebCoreVirtualServerRequestMonitor;
-import com.sun.appserv.management.monitor.statistics.NativeWebCoreVirtualServerRequestStats;
-
-import com.sun.appserv.management.util.misc.ExceptionUtil;
-
-import com.sun.appserv.management.util.stringifier.SmartStringifier;
-import com.sun.appserv.management.util.stringifier.StringifierRegistryIniterImpl;
-import com.sun.appserv.management.util.stringifier.StringifierRegistryImpl;
-
-import com.sun.enterprise.admin.mbeanapi.common.AMXConnector;
-import com.sun.enterprise.admin.mbeanapi.common.AMXMonitoringTestBase;
-
-
-
-/**
- * This test prints the statistics for ejb module and stateless bean
- *
- * ConnectorMonitoring</B>
- *
- * @author <a href=mailto:satish.viswanatham@sun.com>Satish Viswanatham</a>
- * Date: Aug 24, 2004
- * @version $Revision: 1.1 $
- */
-public class ConnectorMonitoring extends AMXMonitoringTestBase {
-
- private String serverName;
- private static String SERVLETS = " - SERVLETS -";
- private static String VS = "VIRTUAL SERVER";
-
- public ConnectorMonitoring(final String host, final int port, final String serverName,
- final String adminUser, final String adminPassword,
- final boolean useTLS) throws IOException {
- super(host, port, adminUser,adminPassword,useTLS);
- this.serverName = serverName;
- }
-
-
- public void test() {
- Map connMap =
- getServerRootMonitor(serverName).
- getConnectorConnectionPoolMonitorMap();
- assert(connMap.size() > 0) :
- "The connection pool monitor map is " + connMap.size();
- for(Iterator itr = connMap.values().iterator(); itr.hasNext();) {
- ConnectorConnectionPoolMonitor connMonitor =
- (ConnectorConnectionPoolMonitor) itr.next();
- System.out.println("\nConnectorConnectionPoolMonitor [" +
- connMonitor.getName() + "]");
- printStats(connMonitor.getStats().getStatistics());
- }
- /*
- HTTPServiceMonitor httpService =
- getServerRootMonitor(serverName).getHTTPServiceMonitor();
- assert (httpService != null) : "The http service monitor is null!";
- Map vsMap = httpService.getHTTPServiceVirtualServerMonitorMap();
- assert (vsMap.size() > 0) : "The http service monitor map is empty!";
- for(Iterator itr = vsMap.values().iterator(); itr.hasNext();) {
- HTTPServiceVirtualServerMonitor vsMtr =
- (HTTPServiceVirtualServerMonitor) vsMap.get(itr.next());
- assert (vsMtr != null) : "The http virtual server monitor is null!";
- NativeWebCoreVirtualServerRequestMonitor rMtr =
- vsMtr.getNativeWebCoreVirtualServerRequestMonitor();
- NativeWebCoreVirtualServerRequestStats wcStats =
- rMtr.getNativeWebCoreVirtualServerRequestStats();
- printStats(wcStats.getStatistics());
- }
- **/
- }
-
-
- /**
- *
- */
- public static void main( final String[] args ) {
- new StringifierRegistryIniterImpl( StringifierRegistryImpl.DEFAULT );
-
- try {
- ConnectorMonitoring connMtr = new ConnectorMonitoring(
- System.getProperty("HOST", "hoyas.red.iplanet.com"),
- Integer.parseInt(System.getProperty("PORT","8686")), args[0],
- System.getProperty("ADMIN_USER", "admin"),
- System.getProperty("ADMIN_PASSWORD", "adminadmin"),
- Boolean.getBoolean(System.getProperty("USE_TLS", "false")));
-
- ConnectorMonitoring.printArgs(args);
-
- connMtr.test();
-
- } catch( Throwable t ) {
- ExceptionUtil.getRootCause( t ).printStackTrace();
- }
- }
-
-}
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/connector/build.properties b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/connector/build.properties
deleted file mode 100644
index 895c078..0000000
--- a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/connector/build.properties
+++ /dev/null
@@ -1,55 +0,0 @@
-#
-# Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
-#
-# This program and the accompanying materials are made available under the
-# terms of the Eclipse Public License v. 2.0, which is available at
-# http://www.eclipse.org/legal/epl-2.0.
-#
-# This Source Code may also be made available under the following Secondary
-# Licenses when the conditions for such availability set forth in the
-# Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
-# version 2 with the GNU Classpath Exception, which is available at
-# https://www.gnu.org/software/classpath/license.html.
-#
-# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-#
-
-#
-# The environment variables for compiling and running the tests.
-#
-src.dir=
-
-#
-# Set location for jmx.jar either from install or build.
-#
-jmx.jar=
-
-#
-# Classpath dependent variables
-#
-module.publish.home=${src.dir}/publish/JDK1.4_DBG.OBJ
-mbeanapi.jar=${module.publish.home}/admin-core/mbeanapi/lib/mbeanapi.jar
-mbeanapi-impl.jar=${module.publish.home}/admin/mbeanapi-impl/lib/mbeanapi-impl.jar
-jmx-ri.jar=${module.publish.home}/jmx/lib/jmxri.jar
-jmx-remote.jar=${module.publish.home}/rjmx-ri/jmxremote.jar
-jmx-remote_optional.jar=${module.publish.home}/rjmx-ri/jmxremote_optional.jar
-appserv-commons.jar=${module.publish.home}/appserv-commons/lib/appserv-commons.jar
-mgmt-api.jar=${module.publish.home}/management-api/lib/management-api.jar
-
-#
-# The instance that the web module or application is deployed on. If this is
-# null or "" then the default server instance "server" is assumed.
-#
-instance.name=server
-
-#
-# The application that the web module lives in. This is only relevant if the
-# web module to be tested is embedded within an application.
-#
-application.name=stateless-simple
-
-#
-# The embedded or standalone web module.
-#
-web.module.name=stateless-simple.war
-
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/connector/build.xml b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/connector/build.xml
deleted file mode 100644
index 663db17..0000000
--- a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/connector/build.xml
+++ /dev/null
@@ -1,118 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-
- Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v. 2.0, which is available at
- http://www.eclipse.org/legal/epl-2.0.
-
- This Source Code may also be made available under the following Secondary
- Licenses when the conditions for such availability set forth in the
- Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- version 2 with the GNU Classpath Exception, which is available at
- https://www.gnu.org/software/classpath/license.html.
-
- SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-
--->
-
-<project name="MBeanApi Monitoring tests" default="all" basedir=".">
-
-<property name="testsRoot" value="."/>
-<property name="build" value="${testsRoot}/build"/>
-<property file="./bootstrap.subcomponent.properties"/>
-<property file="./../../../../../../../bootstrap/bootstrap.properties"/>
-<property file="./../../../../../../../appserv/build.properties"/>
-<property file="./build.properties"/>
-
-
- <path id="compile.classpath">
- <pathelement location="${jmxri.jar}"/>
- <pathelement location="${mbeanapi.jar}"/>
- <pathelement location="${mbeanapi-impl.jar}"/>
- <pathelement location="${jmx.jar}"/>
- </path>
-
- <path id="run.classpath">
- <pathelement location="${jmx-ri.jar}"/>
- <pathelement location="${mbeanapi.jar}"/>
- <pathelement location="${mbeanapi-impl.jar}"/>
- <pathelement location="../../common/build"/>
- <pathelement location="${jmx-remote.jar}"/>
- <pathelement location="${jmx-remote_optional.jar}"/>
- <pathelement location="${appserv-commons.jar}"/>
- <pathelement location="${mgmt-api.jar}"/>
- <pathelement location="${jmx.jar}"/>
- <pathelement location="build"/>
- </path>
-
- <target name="init" description="MBeanapi Tests initialization">
- <mkdir dir="${build}"/>
- </target>
-
- <!-- all -->
- <target name="all" depends="build"
- description="Build entire component">
- <antcall target="connector-mtr-test"/>
- </target>
-
- <!-- build -->
- <target name="build" depends="compile"
- description="Build entire component" />
-
- <!-- compile-common -->
- <target name="compile-common" depends="init">
- <javac srcdir="${src.dir}/appserv-tests/devtests/ee/admin/mbeanapi/common"
- destdir="${build}"
- debug="${javac.debug}"
- optimize="${javac.optimize}"
- source="${javac.source}"
- deprecation="${javac.deprecation}"
- failonerror="true">
- <classpath refid="compile.classpath"/>
- <include name="**/AMXMonitoringTestBase.java"/>
- </javac>
- </target>
-
- <!-- compile -->
- <target name="compile" depends="init, compile-common">
- <javac srcdir="${src.dir}/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/connector"
- destdir="${build}"
- debug="${javac.debug}"
- optimize="${javac.optimize}"
- source="${javac.source}"
- deprecation="${javac.deprecation}"
- failonerror="true">
- <classpath refid="compile.classpath"/>
- <include name="**/*.java"/>
- </javac>
- </target>
-
- <!-- clean -->
- <target name="clean" description="clean">
- <delete dir="${build}"/>
- </target>
-
- <!-- EJB pool monitoring Test Case -->
- <target name="connector-mtr-test">
- <antcall target="test-common">
- <param name="test.class"
- value="com.sun.s1asdev.admin.mbeanapi.monitoring.connector.ConnectorMonitoring"/>
- </antcall>
- </target>
-
- <target name="test-common">
- <java classname="${test.class}" failonerror="true" fork="true">
- <classpath>
- <path refid="run.classpath"/>
- </classpath>
- <jvmarg value="-enableassertions"/>
- <arg value="${instance.name}" />
- <arg value="${application.name}" />
- <arg value="${web.module.name}" />
- </java>
- </target>
-
-
-</project>
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/ejb/EJBMonitoring.java b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/ejb/EJBMonitoring.java
deleted file mode 100755
index 1a6df95..0000000
--- a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/ejb/EJBMonitoring.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Copyright (c) 2003, 2018 Oracle and/or its affiliates. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-package com.sun.s1asdev.admin.mbeanapi.monitoring.ejb;
-
-import java.io.IOException;
-
-import java.util.Map;
-import java.util.Set;
-import java.util.Iterator;
-
-import javax.management.j2ee.statistics.Statistic;
-import javax.management.j2ee.statistics.Stats;
-
-import com.sun.appserv.management.DomainRoot;
-import com.sun.appserv.management.monitor.MonitoringRoot;
-import com.sun.appserv.management.monitor.ServerRootMonitor;
-import com.sun.appserv.management.monitor.ApplicationMonitor;
-import com.sun.appserv.management.monitor.EJBModuleMonitor;
-import com.sun.appserv.management.monitor.EJBMonitor;
-import com.sun.appserv.management.monitor.BeanPoolMonitor;
-import com.sun.appserv.management.monitor.BeanCacheMonitor;
-import com.sun.appserv.management.monitor.BeanMethodMonitor;
-import com.sun.appserv.management.monitor.MonitoringStats;
-
-import com.sun.appserv.management.util.misc.ExceptionUtil;
-
-import com.sun.appserv.management.util.stringifier.SmartStringifier;
-import com.sun.appserv.management.util.stringifier.StringifierRegistryIniterImpl;
-import com.sun.appserv.management.util.stringifier.StringifierRegistryImpl;
-import com.sun.enterprise.admin.mbeanapi.common.AMXConnector;
-
-
-/**
- * This test print the statistics for ejb module and stateless bean
- *
- * EJBMonitoring</B>
- *
- * @author <a href=mailto:satish.viswanatham@sun.com>Satish Viswanatham</a>
- * Date: Aug 24, 2004
- * @version $Revision: 1.5 $
- */
-public class EJBMonitoring {
-
- private final DomainRoot mDomainRoot;
-
- private String SERVER_NAME = "server";
-
- //private String APP_NAME = "cmpcustomer1";
- //private String APP_NAME = "bmp-simple";
- private String APP_NAME = "stateless-simple";
-
- private String STATELESS_EJB_NAME = "stateless-simpleEjb_jar";
-
- public void testEJBPoolStats()
- {
- MonitoringRoot monitorRoot = mDomainRoot.getMonitoringRoot() ;
- assert(monitorRoot !=null);
- ServerRootMonitor svrRootMtr = (ServerRootMonitor) monitorRoot.
- getServerRootMonitorMap(). get(SERVER_NAME);
- Map appsMtrMgr = svrRootMtr.getApplicationMonitorMap();
-
- ApplicationMonitor appMtr =
- (ApplicationMonitor) appsMtrMgr.get(APP_NAME);
-
- Map ejbMgr = appMtr.getEJBModuleMonitorMap();
-
- Stats stats = null;
- Statistic[] sts = null;
-
- System.out.println(" size is " + ejbMgr.size());
- Iterator itr = ejbMgr.values().iterator();
-
- while (itr.hasNext()) {
- Object tmp = itr.next();
- System.out.println("Ejb is " + tmp);
- EJBModuleMonitor beanMgr = (EJBModuleMonitor) tmp;
-
- Map beans = beanMgr.getEJBMonitorMap();
-
- Iterator it = beans.values().iterator();
-
- while (it.hasNext()) {
- EJBMonitor em = (EJBMonitor) it.next();
- listStats(em);
-
- Map methodMap = em.getBeanMethodMonitorMap();
- itr = methodMap.values().iterator();
-
- while (itr.hasNext()) {
- Object o = itr.next();
- System.out.println(
- " Looking at stats for this method " + o);
- BeanMethodMonitor bmm = (BeanMethodMonitor) o;
- listStats(bmm);
-
- }
- }
-
- BeanPoolMonitor bPool = beanMgr.getBeanPoolMonitor(
- STATELESS_EJB_NAME);
- if (bPool == null) {
- System.out.println("Error: BeanPool monitor is null");
- } else {
- listStats(bPool);
- }
-
- BeanCacheMonitor bCache = beanMgr.getBeanCacheMonitor(
- STATELESS_EJB_NAME);
- if (bCache == null) {
- System.out.println("Error: BeanCache monitor is null");
- } else {
- listStats(bCache);
- }
-
- }
-
-
- }
-
- public void listStats (MonitoringStats ms)
- {
- Stats stats = ms.getStats();
- Statistic[] sts = stats.getStatistics();
- printStats(sts);
- }
-
- public void printStats(Statistic[] stats)
- {
- if (stats == null)
- return;
-
- for ( int i=0; i < stats.length; i++)
- {
- printStat(stats[i]);
- }
-
- }
-
- public void printStat(Statistic stat)
- {
- if (stat == null)
- return;
- else
- System.out.println(" Stat name is " + stat.getName() +
- " description: " + stat.getDescription() + " start time "
- + stat.getStartTime() + " last sample time "
- + stat.getLastSampleTime() + " unit " + stat.getUnit());
- }
-
- public EJBMonitoring(final String host,
- final int port,
- final String adminUser,
- final String adminPassword,
- final boolean useTLS)
- throws IOException
- {
- final AMXConnector ct =
- new AMXConnector( host, port, adminUser, adminPassword, useTLS );
-
- mDomainRoot = ct.getDomainRoot();
-
- }
-
-
- public static void main( final String[] args )
- {
- new StringifierRegistryIniterImpl( StringifierRegistryImpl.DEFAULT );
-
- try
- {
- EJBMonitoring ejbMtr = new EJBMonitoring(
- System.getProperty("HOST", "localhost"),
- Integer.parseInt(System.getProperty("PORT","8686")),
- System.getProperty("ADMIN_USER", "admin"),
- System.getProperty("ADMIN_PASSWORD", "adminadmin"),
- Boolean.getBoolean(System.getProperty("USE_TLS", "false")));
-
- ejbMtr.testEJBPoolStats();
- }
- catch( Throwable t )
- {
- ExceptionUtil.getRootCause( t ).printStackTrace();
- }
- }
-}
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/ejb/build.properties b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/ejb/build.properties
deleted file mode 100755
index b1a1948..0000000
--- a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/ejb/build.properties
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
-#
-# This program and the accompanying materials are made available under the
-# terms of the Eclipse Public License v. 2.0, which is available at
-# http://www.eclipse.org/legal/epl-2.0.
-#
-# This Source Code may also be made available under the following Secondary
-# Licenses when the conditions for such availability set forth in the
-# Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
-# version 2 with the GNU Classpath Exception, which is available at
-# https://www.gnu.org/software/classpath/license.html.
-#
-# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-#
-
-
-
-src.dir=.
-module.publish.home=../../../../../../${publish.home}
-mbeanapi.jar=${module.publish.home}/admin-core/mbeanapi/lib/mbeanapi.jar
-mbeanapi-impl.jar=${module.publish.home}/admin/mbeanapi-impl/lib/mbeanapi-impl.jar
-jmx-ri.jar=${module.publish.home}/jmx/lib/jmxri.jar
-jmx-remote.jar=${module.publish.home}/rjmx-ri/jmxremote.jar
-jmx-remote_optional.jar=${module.publish.home}/rjmx-ri/jmxremote_optional.jar
-appserv-commons.jar=${module.publish.home}/appserv-commons/lib/appserv-commons.jar
-mgmt-api.jar=${module.publish.home}/management-api/lib/management-api.jar
-
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/ejb/build.xml b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/ejb/build.xml
deleted file mode 100755
index 322e1f7..0000000
--- a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/ejb/build.xml
+++ /dev/null
@@ -1,100 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-
- Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v. 2.0, which is available at
- http://www.eclipse.org/legal/epl-2.0.
-
- This Source Code may also be made available under the following Secondary
- Licenses when the conditions for such availability set forth in the
- Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- version 2 with the GNU Classpath Exception, which is available at
- https://www.gnu.org/software/classpath/license.html.
-
- SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-
--->
-
-<project name="MBeanApi Monitoring tests" default="all" basedir=".">
-
-<property name="testsRoot" value="."/>
-<property name="build" value="${testsRoot}/build"/>
-<property file="./bootstrap.subcomponent.properties"/>
-<property file="./../../../../../../../bootstrap/bootstrap.properties"/>
-<property file="./../../../../../../../appserv/build.properties"/>
-<property file="./build.properties"/>
-
-
- <path id="compile.classpath">
- <pathelement location="${jmxri.jar}"/>
- <pathelement location="${mbeanapi.jar}"/>
- <pathelement location="${mbeanapi-impl.jar}"/>
- <pathelement location="../../common/build"/>
- </path>
-
- <path id="run.classpath">
- <pathelement location="${jmx-ri.jar}"/>
- <pathelement location="${mbeanapi.jar}"/>
- <pathelement location="${mbeanapi-impl.jar}"/>
- <pathelement location="../../common/build"/>
- <pathelement location="${jmx-remote.jar}"/>
- <pathelement location="${jmx-remote_optional.jar}"/>
- <pathelement location="${appserv-commons.jar}"/>
- <pathelement location="${mgmt-api.jar}"/>
- <pathelement location="build"/>
- </path>
-
- <target name="init" description="MBeanapi Tests initialization">
- <mkdir dir="${build}"/>
- </target>
-
- <!-- all -->
- <target name="all" depends="build"
- description="Build entire component">
- <antcall target="ejb-pool-mtr-test"/>
- </target>
-
- <!-- build -->
- <target name="build" depends="compile"
- description="Build entire component" />
-
- <!-- compile -->
- <target name="compile" depends="init">
- <javac srcdir="${src.dir}"
- destdir="${build}"
- debug="${javac.debug}"
- optimize="${javac.optimize}"
- source="${javac.source}"
- deprecation="${javac.deprecation}"
- failonerror="true">
- <classpath refid="compile.classpath"/>
- <include name="**/*.java"/>
- </javac>
- </target>
-
- <!-- clean -->
- <target name="clean" description="clean">
- <delete dir="${build}"/>
- </target>
-
- <!-- EJB pool monitoring Test Case -->
- <target name="ejb-pool-mtr-test">
- <antcall target="test-common">
- <param name="test.class"
- value="com.sun.s1asdev.admin.mbeanapi.monitoring.ejb.EJBMonitoring"/>
- </antcall>
- </target>
-
- <target name="test-common">
- <java classname="${test.class}" failonerror="true" fork="true">
- <classpath>
- <path refid="run.classpath"/>
- </classpath>
- <!--jvmarg value="-Dcom.sun.aas.instanceRoot=/tmp"/-->
- </java>
- </target>
-
-
-</project>
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/http/HTTPMonitoring.java b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/http/HTTPMonitoring.java
deleted file mode 100644
index 8bea846..0000000
--- a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/http/HTTPMonitoring.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 2003, 2018 Oracle and/or its affiliates. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-package com.sun.s1asdev.admin.mbeanapi.monitoring.http;
-
-import com.sun.appserv.management.monitor.HTTPServiceMonitor;
-import com.sun.appserv.management.monitor.HTTPServiceVirtualServerMonitor;
-import java.io.IOException;
-
-import java.util.Map;
-import java.util.Set;
-import java.util.Iterator;
-import java.util.Collection;
-
-import com.sun.appserv.management.monitor.ApplicationMonitor;
-import com.sun.appserv.management.monitor.WebModuleMonitor;
-import com.sun.appserv.management.monitor.ServletMonitor;
-import com.sun.appserv.management.monitor.WebModuleVirtualServerMonitor;
-import com.sun.appserv.management.monitor.NativeWebCoreVirtualServerRequestMonitor;
-import com.sun.appserv.management.monitor.statistics.NativeWebCoreVirtualServerRequestStats;
-
-import com.sun.appserv.management.util.misc.ExceptionUtil;
-
-import com.sun.appserv.management.util.stringifier.SmartStringifier;
-import com.sun.appserv.management.util.stringifier.StringifierRegistryIniterImpl;
-import com.sun.appserv.management.util.stringifier.StringifierRegistryImpl;
-
-import com.sun.enterprise.admin.mbeanapi.common.AMXConnector;
-import com.sun.enterprise.admin.mbeanapi.common.AMXMonitoringTestBase;
-
-
-
-/**
- * This test prints the statistics for ejb module and stateless bean
- *
- * HTTPMonitoring</B>
- *
- * @author <a href=mailto:satish.viswanatham@sun.com>Satish Viswanatham</a>
- * Date: Aug 24, 2004
- * @version $Revision: 1.1 $
- */
-public class HTTPMonitoring extends AMXMonitoringTestBase {
-
- private String serverName;
- private static String SERVLETS = " - SERVLETS -";
- private static String VS = "VIRTUAL SERVER";
-
- public HTTPMonitoring(final String host, final int port, final String serverName,
- final String adminUser, final String adminPassword,
- final boolean useTLS) throws IOException {
- super(host, port, adminUser,adminPassword,useTLS);
- this.serverName = serverName;
- }
-
-
- public void test() {
- HTTPServiceMonitor httpService =
- getServerRootMonitor(serverName).getHTTPServiceMonitor();
- assert (httpService != null) : "The http service monitor is null!";
- Map vsMap = httpService.getHTTPServiceVirtualServerMonitorMap();
- assert (vsMap.size() > 0) : "The http service monitor map is empty!";
- for(Iterator itr = vsMap.values().iterator(); itr.hasNext();) {
- HTTPServiceVirtualServerMonitor vsMtr =
- (HTTPServiceVirtualServerMonitor) vsMap.get(itr.next());
- assert (vsMtr != null) : "The http virtual server monitor is null!";
- NativeWebCoreVirtualServerRequestMonitor rMtr =
- vsMtr.getNativeWebCoreVirtualServerRequestMonitor();
- NativeWebCoreVirtualServerRequestStats wcStats =
- rMtr.getNativeWebCoreVirtualServerRequestStats();
- printStats(wcStats.getStatistics());
- }
- }
-
-
- /**
- *
- */
- public static void main( final String[] args ) {
- new StringifierRegistryIniterImpl( StringifierRegistryImpl.DEFAULT );
-
- try {
- HTTPMonitoring httpMtr = new HTTPMonitoring(
- System.getProperty("HOST", "localhost"),
- Integer.parseInt(System.getProperty("PORT","8686")), args[0],
- System.getProperty("ADMIN_USER", "admin"),
- System.getProperty("ADMIN_PASSWORD", "adminadmin"),
- Boolean.getBoolean(System.getProperty("USE_TLS", "false")));
-
- HTTPMonitoring.printArgs(args);
-
- httpMtr.test();
-
- } catch( Throwable t ) {
- ExceptionUtil.getRootCause( t ).printStackTrace();
- }
- }
-
-}
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/http/build.properties b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/http/build.properties
deleted file mode 100644
index 895c078..0000000
--- a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/http/build.properties
+++ /dev/null
@@ -1,55 +0,0 @@
-#
-# Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
-#
-# This program and the accompanying materials are made available under the
-# terms of the Eclipse Public License v. 2.0, which is available at
-# http://www.eclipse.org/legal/epl-2.0.
-#
-# This Source Code may also be made available under the following Secondary
-# Licenses when the conditions for such availability set forth in the
-# Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
-# version 2 with the GNU Classpath Exception, which is available at
-# https://www.gnu.org/software/classpath/license.html.
-#
-# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-#
-
-#
-# The environment variables for compiling and running the tests.
-#
-src.dir=
-
-#
-# Set location for jmx.jar either from install or build.
-#
-jmx.jar=
-
-#
-# Classpath dependent variables
-#
-module.publish.home=${src.dir}/publish/JDK1.4_DBG.OBJ
-mbeanapi.jar=${module.publish.home}/admin-core/mbeanapi/lib/mbeanapi.jar
-mbeanapi-impl.jar=${module.publish.home}/admin/mbeanapi-impl/lib/mbeanapi-impl.jar
-jmx-ri.jar=${module.publish.home}/jmx/lib/jmxri.jar
-jmx-remote.jar=${module.publish.home}/rjmx-ri/jmxremote.jar
-jmx-remote_optional.jar=${module.publish.home}/rjmx-ri/jmxremote_optional.jar
-appserv-commons.jar=${module.publish.home}/appserv-commons/lib/appserv-commons.jar
-mgmt-api.jar=${module.publish.home}/management-api/lib/management-api.jar
-
-#
-# The instance that the web module or application is deployed on. If this is
-# null or "" then the default server instance "server" is assumed.
-#
-instance.name=server
-
-#
-# The application that the web module lives in. This is only relevant if the
-# web module to be tested is embedded within an application.
-#
-application.name=stateless-simple
-
-#
-# The embedded or standalone web module.
-#
-web.module.name=stateless-simple.war
-
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/http/build.xml b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/http/build.xml
deleted file mode 100644
index a8ba55b..0000000
--- a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/http/build.xml
+++ /dev/null
@@ -1,118 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-
- Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v. 2.0, which is available at
- http://www.eclipse.org/legal/epl-2.0.
-
- This Source Code may also be made available under the following Secondary
- Licenses when the conditions for such availability set forth in the
- Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- version 2 with the GNU Classpath Exception, which is available at
- https://www.gnu.org/software/classpath/license.html.
-
- SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-
--->
-
-<project name="MBeanApi Monitoring tests" default="all" basedir=".">
-
-<property name="testsRoot" value="."/>
-<property name="build" value="${testsRoot}/build"/>
-<property file="./bootstrap.subcomponent.properties"/>
-<property file="./../../../../../../../bootstrap/bootstrap.properties"/>
-<property file="./../../../../../../../appserv/build.properties"/>
-<property file="./build.properties"/>
-
-
- <path id="compile.classpath">
- <pathelement location="${jmxri.jar}"/>
- <pathelement location="${mbeanapi.jar}"/>
- <pathelement location="${mbeanapi-impl.jar}"/>
- <pathelement location="${jmx.jar}"/>
- </path>
-
- <path id="run.classpath">
- <pathelement location="${jmx-ri.jar}"/>
- <pathelement location="${mbeanapi.jar}"/>
- <pathelement location="${mbeanapi-impl.jar}"/>
- <pathelement location="../../common/build"/>
- <pathelement location="${jmx-remote.jar}"/>
- <pathelement location="${jmx-remote_optional.jar}"/>
- <pathelement location="${appserv-commons.jar}"/>
- <pathelement location="${mgmt-api.jar}"/>
- <pathelement location="${jmx.jar}"/>
- <pathelement location="build"/>
- </path>
-
- <target name="init" description="MBeanapi Tests initialization">
- <mkdir dir="${build}"/>
- </target>
-
- <!-- all -->
- <target name="all" depends="build"
- description="Build entire component">
- <antcall target="http-mtr-test"/>
- </target>
-
- <!-- build -->
- <target name="build" depends="compile"
- description="Build entire component" />
-
- <!-- compile-common -->
- <target name="compile-common" depends="init">
- <javac srcdir="${src.dir}/appserv-tests/devtests/ee/admin/mbeanapi/common"
- destdir="${build}"
- debug="${javac.debug}"
- optimize="${javac.optimize}"
- source="${javac.source}"
- deprecation="${javac.deprecation}"
- failonerror="true">
- <classpath refid="compile.classpath"/>
- <include name="**/AMXMonitoringTestBase.java"/>
- </javac>
- </target>
-
- <!-- compile -->
- <target name="compile" depends="init, compile-common">
- <javac srcdir="${src.dir}/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/http"
- destdir="${build}"
- debug="${javac.debug}"
- optimize="${javac.optimize}"
- source="${javac.source}"
- deprecation="${javac.deprecation}"
- failonerror="true">
- <classpath refid="compile.classpath"/>
- <include name="**/*.java"/>
- </javac>
- </target>
-
- <!-- clean -->
- <target name="clean" description="clean">
- <delete dir="${build}"/>
- </target>
-
- <!-- EJB pool monitoring Test Case -->
- <target name="http-mtr-test">
- <antcall target="test-common">
- <param name="test.class"
- value="com.sun.s1asdev.admin.mbeanapi.monitoring.http.HTTPMonitoring"/>
- </antcall>
- </target>
-
- <target name="test-common">
- <java classname="${test.class}" failonerror="true" fork="true">
- <classpath>
- <path refid="run.classpath"/>
- </classpath>
- <jvmarg value="-enableassertions"/>
- <arg value="${instance.name}" />
- <arg value="${application.name}" />
- <arg value="${web.module.name}" />
- </java>
- </target>
-
-
-</project>
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/jdbc/JDBCMonitoring.java b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/jdbc/JDBCMonitoring.java
deleted file mode 100644
index 7d8647c..0000000
--- a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/jdbc/JDBCMonitoring.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright (c) 2003, 2018 Oracle and/or its affiliates. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-package com.sun.s1asdev.admin.mbeanapi.monitoring.jdbc;
-
-import java.io.IOException;
-
-import java.util.Map;
-import java.util.Set;
-import java.util.Iterator;
-
-import javax.management.j2ee.statistics.Statistic;
-import javax.management.j2ee.statistics.Stats;
-
-import com.sun.appserv.management.DomainRoot;
-import com.sun.appserv.management.monitor.MonitoringRoot;
-import com.sun.appserv.management.monitor.ServerRootMonitor;
-import com.sun.appserv.management.monitor.JDBCConnectionPoolMonitor;
-import com.sun.appserv.management.monitor.ConnectorConnectionPoolMonitor;
-import com.sun.appserv.management.monitor.MonitoringStats;
-
-import com.sun.appserv.management.util.misc.ExceptionUtil;
-
-import com.sun.appserv.management.util.stringifier.SmartStringifier;
-import com.sun.appserv.management.util.stringifier.StringifierRegistryIniterImpl;
-import com.sun.appserv.management.util.stringifier.StringifierRegistryImpl;
-import com.sun.enterprise.admin.mbeanapi.common.AMXConnector;
-
-
-/**
- * This test print the statistics for jdbc and connector connection pools
- *
- * JDBCMonitoring</B>
- *
- * @author <a href=mailto:satish.viswanatham@sun.com>Satish Viswanatham</a>
- * Date: Aug 24, 2004
- * @version $Revision: 1.3 $
- */
-public class JDBCMonitoring {
-
- private static DomainRoot mDomainRoot;
-
- private static String SERVER_NAME = "server";
-
- public void testCCPoolStats( ServerRootMonitor svrRootMtr)
- {
-
- Map cpMtrMgr = svrRootMtr.getConnectorConnectionPoolMonitorMap();
- System.out.println("connector connection pool size is " +
- cpMtrMgr.size());
- Iterator itr = cpMtrMgr.values().iterator();
- while (itr.hasNext()) {
- Object o = itr.next();
- System.out.println(" Connector Connection pool is " + o);
- ConnectorConnectionPoolMonitor cPool =
- (ConnectorConnectionPoolMonitor)o;
- listStat(cPool);
- }
-
- }
-
- public void testJDBCPoolStats( ServerRootMonitor svrRootMtr)
- {
-
- Map cpMtrMgr = svrRootMtr.getJDBCConnectionPoolMonitorMap();
- System.out.println("jdbc connection pool size is " + cpMtrMgr.size());
- Iterator itr = cpMtrMgr.values().iterator();
- while (itr.hasNext()) {
- Object o = itr.next();
- System.out.println(" Connection pool is " + o);
- JDBCConnectionPoolMonitor cPool = (JDBCConnectionPoolMonitor)o;
- listStat(cPool);
- }
-
- }
-
- public void listStat(MonitoringStats mtr)
- {
- if (mtr == null) {
- System.out.println("Monitoring stats is null");
- } else {
- listStats(mtr);
- }
- }
-
- public void listStats(MonitoringStats ms)
- {
- Stats stats = ms.getStats();
- Statistic[] sts = stats.getStatistics();
- printStats(sts);
- }
-
- public void printStats(Statistic[] stats)
- {
- if (stats == null)
- return;
-
- for ( int i=0; i < stats.length; i++)
- {
- printStat(stats[i]);
- }
-
- }
-
- public void printStat(Statistic stat)
- {
- if (stat == null)
- return;
- else
- System.out.println(" Stat name is " + stat.getName() +
- " description: " + stat.getDescription() + " start time "
- + stat.getStartTime() + " last sample time "
- + stat.getLastSampleTime() + " unit " + stat.getUnit());
- }
-
- public JDBCMonitoring(final String host,
- final int port,
- final String adminUser,
- final String adminPassword,
- final boolean useTLS)
- throws IOException
- {
- final AMXConnector ct =
- new AMXConnector( host, port, adminUser, adminPassword, useTLS );
-
- mDomainRoot = ct.getDomainRoot();
-
- }
-
-
- public static void main( final String[] args )
- {
- new StringifierRegistryIniterImpl( StringifierRegistryImpl.DEFAULT );
-
- try
- {
- JDBCMonitoring jdbcMtr = new JDBCMonitoring(
- System.getProperty("HOST", "localhost"),
- Integer.parseInt(System.getProperty("PORT","8686")),
- System.getProperty("ADMIN_USER", "admin"),
- System.getProperty("ADMIN_PASSWORD", "adminadmin"),
- Boolean.getBoolean(System.getProperty("USE_TLS", "false")));
-
- MonitoringRoot monitorRoot = mDomainRoot.getMonitoringRoot() ;
- assert(monitorRoot !=null);
- ServerRootMonitor svrRootMtr = (ServerRootMonitor) monitorRoot.
- getServerRootMonitorMap(). get(SERVER_NAME);
-
- jdbcMtr.testJDBCPoolStats(svrRootMtr);
- jdbcMtr.testCCPoolStats(svrRootMtr);
- }
- catch( Throwable t )
- {
- ExceptionUtil.getRootCause( t ).printStackTrace();
- }
- }
-}
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/jdbc/build.properties b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/jdbc/build.properties
deleted file mode 100644
index b1a1948..0000000
--- a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/jdbc/build.properties
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
-#
-# This program and the accompanying materials are made available under the
-# terms of the Eclipse Public License v. 2.0, which is available at
-# http://www.eclipse.org/legal/epl-2.0.
-#
-# This Source Code may also be made available under the following Secondary
-# Licenses when the conditions for such availability set forth in the
-# Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
-# version 2 with the GNU Classpath Exception, which is available at
-# https://www.gnu.org/software/classpath/license.html.
-#
-# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-#
-
-
-
-src.dir=.
-module.publish.home=../../../../../../${publish.home}
-mbeanapi.jar=${module.publish.home}/admin-core/mbeanapi/lib/mbeanapi.jar
-mbeanapi-impl.jar=${module.publish.home}/admin/mbeanapi-impl/lib/mbeanapi-impl.jar
-jmx-ri.jar=${module.publish.home}/jmx/lib/jmxri.jar
-jmx-remote.jar=${module.publish.home}/rjmx-ri/jmxremote.jar
-jmx-remote_optional.jar=${module.publish.home}/rjmx-ri/jmxremote_optional.jar
-appserv-commons.jar=${module.publish.home}/appserv-commons/lib/appserv-commons.jar
-mgmt-api.jar=${module.publish.home}/management-api/lib/management-api.jar
-
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/jdbc/build.xml b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/jdbc/build.xml
deleted file mode 100644
index 6afd09b..0000000
--- a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/jdbc/build.xml
+++ /dev/null
@@ -1,100 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-
- Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v. 2.0, which is available at
- http://www.eclipse.org/legal/epl-2.0.
-
- This Source Code may also be made available under the following Secondary
- Licenses when the conditions for such availability set forth in the
- Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- version 2 with the GNU Classpath Exception, which is available at
- https://www.gnu.org/software/classpath/license.html.
-
- SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-
--->
-
-<project name="MBeanApi Monitoring tests" default="all" basedir=".">
-
-<property name="testsRoot" value="."/>
-<property name="build" value="${testsRoot}/build"/>
-<property file="./bootstrap.subcomponent.properties"/>
-<property file="./../../../../../../../bootstrap/bootstrap.properties"/>
-<property file="./../../../../../../../appserv/build.properties"/>
-<property file="./build.properties"/>
-
-
- <path id="compile.classpath">
- <pathelement location="${jmxri.jar}"/>
- <pathelement location="${mbeanapi.jar}"/>
- <pathelement location="${mbeanapi-impl.jar}"/>
- <pathelement location="../../common/build"/>
- </path>
-
- <path id="run.classpath">
- <pathelement location="${jmx-ri.jar}"/>
- <pathelement location="${mbeanapi.jar}"/>
- <pathelement location="${mbeanapi-impl.jar}"/>
- <pathelement location="../../common/build"/>
- <pathelement location="${jmx-remote.jar}"/>
- <pathelement location="${jmx-remote_optional.jar}"/>
- <pathelement location="${appserv-commons.jar}"/>
- <pathelement location="build"/>
- <pathelement location="${mgmt-api.jar}"/>
- </path>
-
- <target name="init" description="MBeanapi Tests initialization">
- <mkdir dir="${build}"/>
- </target>
-
- <!-- all -->
- <target name="all" depends="build"
- description="Build entire component">
- <antcall target="jdbc-mtr-test"/>
- </target>
-
- <!-- build -->
- <target name="build" depends="compile"
- description="Build entire component" />
-
- <!-- compile -->
- <target name="compile" depends="init">
- <javac srcdir="${src.dir}"
- destdir="${build}"
- debug="${javac.debug}"
- optimize="${javac.optimize}"
- source="${javac.source}"
- deprecation="${javac.deprecation}"
- failonerror="true">
- <classpath refid="compile.classpath"/>
- <include name="**/*.java"/>
- </javac>
- </target>
-
- <!-- clean -->
- <target name="clean" description="clean">
- <delete dir="${build}"/>
- </target>
-
- <!-- EJB pool monitoring Test Case -->
- <target name="jdbc-mtr-test">
- <antcall target="test-common">
- <param name="test.class"
- value="com.sun.s1asdev.admin.mbeanapi.monitoring.jdbc.JDBCMonitoring"/>
- </antcall>
- </target>
-
- <target name="test-common">
- <java classname="${test.class}" failonerror="true" fork="true">
- <classpath>
- <path refid="run.classpath"/>
- </classpath>
- <!--jvmarg value="-Dcom.sun.aas.instanceRoot=/tmp"/-->
- </java>
- </target>
-
-
-</project>
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/misc/MiscMonitoring.java b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/misc/MiscMonitoring.java
deleted file mode 100644
index a058c65..0000000
--- a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/misc/MiscMonitoring.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * Copyright (c) 2003, 2018 Oracle and/or its affiliates. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-package com.sun.s1asdev.admin.mbeanapi.monitoring.misc;
-
-import java.io.IOException;
-
-import java.util.Map;
-import java.util.Set;
-import java.util.Iterator;
-
-import javax.management.j2ee.statistics.Statistic;
-import javax.management.j2ee.statistics.Stats;
-
-import com.sun.appserv.management.DomainRoot;
-import com.sun.appserv.management.monitor.MonitoringRoot;
-import com.sun.appserv.management.monitor.ServerRootMonitor;
-import com.sun.appserv.management.monitor.JVMMonitor;
-import com.sun.appserv.management.monitor.TransactionServiceMonitor;
-import com.sun.appserv.management.monitor.HTTPServiceMonitor;
-import com.sun.appserv.management.monitor.ConnectionManagerMonitor;
-import com.sun.appserv.management.monitor.ThreadPoolMonitor;
-import com.sun.appserv.management.monitor.MonitoringStats;
-
-import com.sun.appserv.management.util.misc.ExceptionUtil;
-
-import com.sun.appserv.management.util.stringifier.SmartStringifier;
-import com.sun.appserv.management.util.stringifier.StringifierRegistryIniterImpl;
-import com.sun.appserv.management.util.stringifier.StringifierRegistryImpl;
-import com.sun.enterprise.admin.mbeanapi.common.AMXConnector;
-
-
-/**
- * This test print the statistics for ejb module and stateless bean
- *
- * JDBCMonitoring</B>
- *
- * @author <a href=mailto:satish.viswanatham@sun.com>Satish Viswanatham</a>
- * Date: Aug 24, 2004
- * @version $Revision: 1.3 $
- */
-public class MiscMonitoring {
-
- private static DomainRoot mDomainRoot;
-
- private static final String SERVER_NAME = "server";
-
- public void testThreadPoolStats(ServerRootMonitor svrRootMtr)
- {
- Map tpMap= svrRootMtr.getThreadPoolMonitorMap();
- System.out.println("\n" + "Thread Pool Monitor Stats: "
- + "\n");
-
- System.out.println("Thread PoolORB monitor map " + tpMap.size());
-
- Iterator itr = tpMap.values().iterator();
-
- while ( itr.hasNext()) {
- Object o = itr.next();
- System.out.println(" Looking at monitor " + o);
-
- ThreadPoolMonitor tpm = (ThreadPoolMonitor) o;
- listStats(tpm);
- }
- }
-
- public void testORBStats(ServerRootMonitor svrRootMtr)
- {
- Map orbMap= svrRootMtr.getORBConnectionManagerMonitorMap();
- System.out.println("\n" + "ORB Connection Manager Monitor Stats: "
- + "\n");
-
- System.out.println("ORB monitor map " + orbMap.size());
-
- Iterator itr = orbMap.values().iterator();
-
- while ( itr.hasNext()) {
- Object o = itr.next();
- System.out.println(" Looking at monitor " + o);
-
- ConnectionManagerMonitor cm = (ConnectionManagerMonitor) o;
- listStats(cm);
- }
- }
-
- public void testJVMStats(ServerRootMonitor svrRootMtr)
- {
- JVMMonitor jvmMtr = svrRootMtr.getJVMMonitor();
-
- System.out.println("\n" + "JVM Monitor Stats: " + "\n");
- listStats(jvmMtr);
- }
-
- public void testTransactionServiceStats(ServerRootMonitor svrRootMtr)
- {
- TransactionServiceMonitor tsMtr =
- svrRootMtr.getTransactionServiceMonitor();
-
- System.out.println("\n" + "Transaction Service Monitor Stats: " + "\n");
- listStats(tsMtr);
- }
-
- public void testHTTPServiceStats(ServerRootMonitor svrRootMtr)
- {
- HTTPServiceMonitor tsMtr = svrRootMtr.getHTTPServiceMonitor();
-
- System.out.println("\n" + "File Cache Monitor Stats: " + "\n");
- listStats(tsMtr.getFileCacheMonitor());
- System.out.println("\n" + "DNS Monitor Stats: " + "\n");
- listStats(tsMtr.getDNSMonitor());
- System.out.println("\n" + "PWC Thread pool Monitor Stats: " + "\n");
- listStats(tsMtr.getPWCThreadPoolMonitor());
- System.out.println("\n" + "Connection queue Monitor Stats: " + "\n");
- listStats(tsMtr.getConnectionQueueMonitor());
- System.out.println("\n" + "Keep Alive Monitor Stats: " + "\n");
- listStats(tsMtr.getKeepAliveMonitor());
- }
-
- public void listStats(MonitoringStats mtr)
- {
- if (mtr == null) {
- System.out.println("Monitoring stats is null");
- } else {
- Stats stats = mtr.getStats();
- Statistic[] sts = stats.getStatistics();
- printStats(sts);
- }
- }
-
- public void printStats(Statistic[] stats)
- {
- if (stats == null)
- return;
-
- for ( int i=0; i < stats.length; i++)
- {
- printStat(stats[i]);
- }
-
- }
-
- public void printStat(Statistic stat)
- {
- if (stat == null)
- return;
- else
- System.out.println(" Stat name is " + stat.getName() +
- " description: " + stat.getDescription() + " start time "
- + stat.getStartTime() + " last sample time "
- + stat.getLastSampleTime() + " unit " + stat.getUnit());
- }
-
- public MiscMonitoring(final String host,
- final int port,
- final String adminUser,
- final String adminPassword,
- final boolean useTLS)
- throws IOException
- {
- final AMXConnector ct =
- new AMXConnector( host, port, adminUser, adminPassword, useTLS );
-
- mDomainRoot = ct.getDomainRoot();
-
- }
-
-
- public static void main( final String[] args )
- {
- new StringifierRegistryIniterImpl( StringifierRegistryImpl.DEFAULT );
-
- try
- {
- MiscMonitoring miscMtr = new MiscMonitoring(
- System.getProperty("HOST", "localhost"),
- Integer.parseInt(System.getProperty("PORT","8686")),
- System.getProperty("ADMIN_USER", "admin"),
- System.getProperty("ADMIN_PASSWORD", "adminadmin"),
- Boolean.getBoolean(System.getProperty("USE_TLS", "false")));
-
- MonitoringRoot monitorRoot = mDomainRoot.getMonitoringRoot() ;
- assert(monitorRoot !=null);
- ServerRootMonitor svrRootMtr = (ServerRootMonitor) monitorRoot.
- getServerRootMonitorMap(). get(SERVER_NAME);
-
- miscMtr.testJVMStats(svrRootMtr);
- miscMtr.testTransactionServiceStats(svrRootMtr);
- miscMtr.testHTTPServiceStats(svrRootMtr);
- miscMtr.testThreadPoolStats(svrRootMtr);
- miscMtr.testORBStats(svrRootMtr);
- }
- catch( Throwable t )
- {
- ExceptionUtil.getRootCause( t ).printStackTrace();
- }
- }
-}
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/misc/build.properties b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/misc/build.properties
deleted file mode 100644
index b1a1948..0000000
--- a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/misc/build.properties
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
-#
-# This program and the accompanying materials are made available under the
-# terms of the Eclipse Public License v. 2.0, which is available at
-# http://www.eclipse.org/legal/epl-2.0.
-#
-# This Source Code may also be made available under the following Secondary
-# Licenses when the conditions for such availability set forth in the
-# Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
-# version 2 with the GNU Classpath Exception, which is available at
-# https://www.gnu.org/software/classpath/license.html.
-#
-# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-#
-
-
-
-src.dir=.
-module.publish.home=../../../../../../${publish.home}
-mbeanapi.jar=${module.publish.home}/admin-core/mbeanapi/lib/mbeanapi.jar
-mbeanapi-impl.jar=${module.publish.home}/admin/mbeanapi-impl/lib/mbeanapi-impl.jar
-jmx-ri.jar=${module.publish.home}/jmx/lib/jmxri.jar
-jmx-remote.jar=${module.publish.home}/rjmx-ri/jmxremote.jar
-jmx-remote_optional.jar=${module.publish.home}/rjmx-ri/jmxremote_optional.jar
-appserv-commons.jar=${module.publish.home}/appserv-commons/lib/appserv-commons.jar
-mgmt-api.jar=${module.publish.home}/management-api/lib/management-api.jar
-
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/misc/build.xml b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/misc/build.xml
deleted file mode 100644
index 1127060..0000000
--- a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/misc/build.xml
+++ /dev/null
@@ -1,100 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-
- Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v. 2.0, which is available at
- http://www.eclipse.org/legal/epl-2.0.
-
- This Source Code may also be made available under the following Secondary
- Licenses when the conditions for such availability set forth in the
- Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- version 2 with the GNU Classpath Exception, which is available at
- https://www.gnu.org/software/classpath/license.html.
-
- SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-
--->
-
-<project name="MBeanApi Monitoring tests" default="all" basedir=".">
-
-<property name="testsRoot" value="."/>
-<property name="build" value="${testsRoot}/build"/>
-<property file="./bootstrap.subcomponent.properties"/>
-<property file="./../../../../../../../bootstrap/bootstrap.properties"/>
-<property file="./../../../../../../../appserv/build.properties"/>
-<property file="./build.properties"/>
-
-
- <path id="compile.classpath">
- <pathelement location="${jmxri.jar}"/>
- <pathelement location="${mbeanapi.jar}"/>
- <pathelement location="${mbeanapi-impl.jar}"/>
- <pathelement location="../../common/build"/>
- </path>
-
- <path id="run.classpath">
- <pathelement location="${jmx-ri.jar}"/>
- <pathelement location="${mbeanapi.jar}"/>
- <pathelement location="${mbeanapi-impl.jar}"/>
- <pathelement location="../../common/build"/>
- <pathelement location="${jmx-remote.jar}"/>
- <pathelement location="${jmx-remote_optional.jar}"/>
- <pathelement location="${appserv-commons.jar}"/>
- <pathelement location="${mgmt-api.jar}"/>
- <pathelement location="build"/>
- </path>
-
- <target name="init" description="MBeanapi Tests initialization">
- <mkdir dir="${build}"/>
- </target>
-
- <!-- all -->
- <target name="all" depends="build"
- description="Build entire component">
- <antcall target="misc-mtr-test"/>
- </target>
-
- <!-- build -->
- <target name="build" depends="compile"
- description="Build entire component" />
-
- <!-- compile -->
- <target name="compile" depends="init">
- <javac srcdir="${src.dir}"
- destdir="${build}"
- debug="${javac.debug}"
- optimize="${javac.optimize}"
- source="${javac.source}"
- deprecation="${javac.deprecation}"
- failonerror="true">
- <classpath refid="compile.classpath"/>
- <include name="**/*.java"/>
- </javac>
- </target>
-
- <!-- clean -->
- <target name="clean" description="clean">
- <delete dir="${build}"/>
- </target>
-
- <!-- EJB pool monitoring Test Case -->
- <target name="misc-mtr-test">
- <antcall target="test-common">
- <param name="test.class"
- value="com.sun.s1asdev.admin.mbeanapi.monitoring.misc.MiscMonitoring"/>
- </antcall>
- </target>
-
- <target name="test-common">
- <java classname="${test.class}" failonerror="true" fork="true">
- <classpath>
- <path refid="run.classpath"/>
- </classpath>
- <!--jvmarg value="-Dcom.sun.aas.instanceRoot=/tmp"/-->
- </java>
- </target>
-
-
-</project>
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/web/WebMonitoring.java b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/web/WebMonitoring.java
deleted file mode 100644
index ea22ff0..0000000
--- a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/web/WebMonitoring.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (c) 2003, 2018 Oracle and/or its affiliates. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-package com.sun.s1asdev.admin.mbeanapi.monitoring.web;
-
-import java.io.IOException;
-
-import java.util.Map;
-import java.util.Set;
-import java.util.Iterator;
-import java.util.Collection;
-
-import com.sun.appserv.management.monitor.ApplicationMonitor;
-import com.sun.appserv.management.monitor.ServletMonitor;
-import com.sun.appserv.management.monitor.WebModuleVirtualServerMonitor;
-
-import com.sun.appserv.management.util.misc.ExceptionUtil;
-
-import com.sun.appserv.management.util.stringifier.SmartStringifier;
-import com.sun.appserv.management.util.stringifier.StringifierRegistryIniterImpl;
-import com.sun.appserv.management.util.stringifier.StringifierRegistryImpl;
-
-import com.sun.enterprise.admin.mbeanapi.common.AMXConnector;
-import com.sun.enterprise.admin.mbeanapi.common.AMXMonitoringTestBase;
-
-
-
-/**
- * This test prints the statistics for ejb module and stateless bean
- *
- * WebMonitoring</B>
- *
- * @author <a href=mailto:satish.viswanatham@sun.com>Satish Viswanatham</a>
- * Date: Aug 24, 2004
- * @version $Revision: 1.7 $
- */
-public class WebMonitoring extends AMXMonitoringTestBase {
-
- private String serverName;
- private static String SERVLETS = " - SERVLETS -";
- private static String VS = "VIRTUAL SERVER";
-
- public WebMonitoring(final String host, final int port, final String serverName,
- final String adminUser, final String adminPassword,
- final boolean useTLS) throws IOException {
- super(host, port, adminUser,adminPassword,useTLS);
- this.serverName = serverName;
- }
-
-
- public void test(final String applicationName, final String webModule) {
- if(isEmbeddedWebModule(applicationName, webModule)) {
- testEmbeddedWebModules(getWebModules(applicationName));
- } else {
- testStandAloneWebModule(webModule);
- }
- }
-
-
- /**
- *
- */
- public void testStandAloneWebModule(final String webModuleName) {
- Map webMap = getServerRootMonitor(serverName).
- getWebModuleVirtualServerMonitorMap();
- assert(webMap != null && webMap.size() > 0) : "FAILURE!";
- testEmbeddedWebModules(webMap);
- }
-
-
- /**
- *
- */
- public void testEmbeddedWebModules(final Map webModules) {
- assert(webModules != null && webModules.size() > 0) :
- "No web module monitors found! Make sure that the monitoring level " +
- "is set to HIGH or LOW!!";
- Iterator itr = webModules.values().iterator();
- while(itr.hasNext()) {
- WebModuleVirtualServerMonitor webMonitor = (WebModuleVirtualServerMonitor)itr.next();
- if (!webMonitor.getName().equals("//__asadmin/adminapp")
- && !webMonitor.getName().equals("//__asadmin/admingui")
- && !webMonitor.getName().equals("//__asadmin/com_sun_web_ui")) {
- System.out.println("\nStats for WebModule [" +
- webMonitor.getName() + "]");
- testWebModuleServlets(webMonitor.getServletMonitorMap());
- }
- }
- }
-
-
- /**
- *
- */
- public void testWebModuleServlets(final Map servlets) {
- printBlock(SERVLETS);
- assert(servlets != null && servlets.size() > 0) :
- "No servlet monitors found! Make sure that the monitoring level " +
- "is set to HIGH or LOW!!";
- Iterator itr = servlets.values().iterator();
- while(itr.hasNext()) {
- ServletMonitor sltMonitor = (ServletMonitor)itr.next();
- System.out.println(" |");
- System.out.println(" |");
- System.out.println(" ---- SERVLET [" + sltMonitor.getName() + "]");
- listStats(sltMonitor);
- }
- }
-
-
- /**
- *
- */
- private Map getWebModules(final String applicationName) {
- return getApplicationMonitor(serverName, applicationName).
- getWebModuleVirtualServerMonitorMap();
- }
-
-
- /**
- *
- */
- private boolean isEmbeddedWebModule(final String applicationName,
- final String webModuleName) {
- final ApplicationMonitor appMtr =
- getApplicationMonitor(serverName, applicationName);
- final Map webMgr = appMtr.getWebModuleVirtualServerMonitorMap();
- return (webMgr.get(webModuleName) != null
- || "".equals(webMgr.get(webModuleName)));
- }
-
-
-
- /**
- *
- */
- public static void main( final String[] args ) {
- new StringifierRegistryIniterImpl( StringifierRegistryImpl.DEFAULT );
-
- try {
- WebMonitoring webMtr = new WebMonitoring(
- System.getProperty("HOST", "localhost"),
- Integer.parseInt(System.getProperty("PORT","8686")), args[0],
- System.getProperty("ADMIN_USER", "admin"),
- System.getProperty("ADMIN_PASSWORD", "adminadmin"),
- Boolean.getBoolean(System.getProperty("USE_TLS", "false")));
-
- WebMonitoring.printArgs(args);
-
- if(args.length < 3) {
- webMtr.test(null,null);
- } else {
- webMtr.test(args[1], args[2]);
- }
-
- } catch( Throwable t ) {
- ExceptionUtil.getRootCause( t ).printStackTrace();
- }
- }
-
-}
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/web/build.properties b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/web/build.properties
deleted file mode 100644
index 895c078..0000000
--- a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/web/build.properties
+++ /dev/null
@@ -1,55 +0,0 @@
-#
-# Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
-#
-# This program and the accompanying materials are made available under the
-# terms of the Eclipse Public License v. 2.0, which is available at
-# http://www.eclipse.org/legal/epl-2.0.
-#
-# This Source Code may also be made available under the following Secondary
-# Licenses when the conditions for such availability set forth in the
-# Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
-# version 2 with the GNU Classpath Exception, which is available at
-# https://www.gnu.org/software/classpath/license.html.
-#
-# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-#
-
-#
-# The environment variables for compiling and running the tests.
-#
-src.dir=
-
-#
-# Set location for jmx.jar either from install or build.
-#
-jmx.jar=
-
-#
-# Classpath dependent variables
-#
-module.publish.home=${src.dir}/publish/JDK1.4_DBG.OBJ
-mbeanapi.jar=${module.publish.home}/admin-core/mbeanapi/lib/mbeanapi.jar
-mbeanapi-impl.jar=${module.publish.home}/admin/mbeanapi-impl/lib/mbeanapi-impl.jar
-jmx-ri.jar=${module.publish.home}/jmx/lib/jmxri.jar
-jmx-remote.jar=${module.publish.home}/rjmx-ri/jmxremote.jar
-jmx-remote_optional.jar=${module.publish.home}/rjmx-ri/jmxremote_optional.jar
-appserv-commons.jar=${module.publish.home}/appserv-commons/lib/appserv-commons.jar
-mgmt-api.jar=${module.publish.home}/management-api/lib/management-api.jar
-
-#
-# The instance that the web module or application is deployed on. If this is
-# null or "" then the default server instance "server" is assumed.
-#
-instance.name=server
-
-#
-# The application that the web module lives in. This is only relevant if the
-# web module to be tested is embedded within an application.
-#
-application.name=stateless-simple
-
-#
-# The embedded or standalone web module.
-#
-web.module.name=stateless-simple.war
-
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/web/build.xml b/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/web/build.xml
deleted file mode 100644
index b764fe3..0000000
--- a/appserver/tests/v2-tests/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/web/build.xml
+++ /dev/null
@@ -1,118 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-
- Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v. 2.0, which is available at
- http://www.eclipse.org/legal/epl-2.0.
-
- This Source Code may also be made available under the following Secondary
- Licenses when the conditions for such availability set forth in the
- Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- version 2 with the GNU Classpath Exception, which is available at
- https://www.gnu.org/software/classpath/license.html.
-
- SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-
--->
-
-<project name="MBeanApi Monitoring tests" default="all" basedir=".">
-
-<property name="testsRoot" value="."/>
-<property name="build" value="${testsRoot}/build"/>
-<property file="./bootstrap.subcomponent.properties"/>
-<property file="./../../../../../../../bootstrap/bootstrap.properties"/>
-<property file="./../../../../../../../appserv/build.properties"/>
-<property file="./build.properties"/>
-
-
- <path id="compile.classpath">
- <pathelement location="${jmxri.jar}"/>
- <pathelement location="${mbeanapi.jar}"/>
- <pathelement location="${mbeanapi-impl.jar}"/>
- <pathelement location="${jmx.jar}"/>
- </path>
-
- <path id="run.classpath">
- <pathelement location="${jmx-ri.jar}"/>
- <pathelement location="${mbeanapi.jar}"/>
- <pathelement location="${mbeanapi-impl.jar}"/>
- <pathelement location="../../common/build"/>
- <pathelement location="${jmx-remote.jar}"/>
- <pathelement location="${jmx-remote_optional.jar}"/>
- <pathelement location="${appserv-commons.jar}"/>
- <pathelement location="${mgmt-api.jar}"/>
- <pathelement location="${jmx.jar}"/>
- <pathelement location="build"/>
- </path>
-
- <target name="init" description="MBeanapi Tests initialization">
- <mkdir dir="${build}"/>
- </target>
-
- <!-- all -->
- <target name="all" depends="build"
- description="Build entire component">
- <antcall target="web-mtr-test"/>
- </target>
-
- <!-- build -->
- <target name="build" depends="compile"
- description="Build entire component" />
-
- <!-- compile-common -->
- <target name="compile-common" depends="init">
- <javac srcdir="${src.dir}/appserv-tests/devtests/ee/admin/mbeanapi/common"
- destdir="${build}"
- debug="${javac.debug}"
- optimize="${javac.optimize}"
- source="${javac.source}"
- deprecation="${javac.deprecation}"
- failonerror="true">
- <classpath refid="compile.classpath"/>
- <include name="**/*.java"/>
- </javac>
- </target>
-
- <!-- compile -->
- <target name="compile" depends="init, compile-common">
- <javac srcdir="${src.dir}/appserv-tests/devtests/ee/admin/mbeanapi/monitoring/web"
- destdir="${build}"
- debug="${javac.debug}"
- optimize="${javac.optimize}"
- source="${javac.source}"
- deprecation="${javac.deprecation}"
- failonerror="true">
- <classpath refid="compile.classpath"/>
- <include name="**/*.java"/>
- </javac>
- </target>
-
- <!-- clean -->
- <target name="clean" description="clean">
- <delete dir="${build}"/>
- </target>
-
- <!-- EJB pool monitoring Test Case -->
- <target name="web-mtr-test">
- <antcall target="test-common">
- <param name="test.class"
- value="com.sun.s1asdev.admin.mbeanapi.monitoring.web.WebMonitoring"/>
- </antcall>
- </target>
-
- <target name="test-common">
- <java classname="${test.class}" failonerror="true" fork="true">
- <classpath>
- <path refid="run.classpath"/>
- </classpath>
- <jvmarg value="-enableassertions"/>
- <arg value="${instance.name}" />
- <arg value="${application.name}" />
- <arg value="${web.module.name}" />
- </java>
- </target>
-
-
-</project>
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/mbeans1/build.properties b/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/mbeans1/build.properties
deleted file mode 100644
index 41f2762..0000000
--- a/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/mbeans1/build.properties
+++ /dev/null
@@ -1,30 +0,0 @@
-<!--
-
- Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v. 2.0, which is available at
- http://www.eclipse.org/legal/epl-2.0.
-
- This Source Code may also be made available under the following Secondary
- Licenses when the conditions for such availability set forth in the
- Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- version 2 with the GNU Classpath Exception, which is available at
- https://www.gnu.org/software/classpath/license.html.
-
- SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-
--->
-
-
-<property name="module" value="management-mejb"/>
-<property name="appname" value="${module}"/>
-<property name="assemble" value="${build.classes.dir}/archive"/>
-<property name="test.client" value="management-mejbClient"/>
-<property name="application.xml" value="descriptor/application.xml"/>
-<property name="sun-application.xml" value="descriptor/sun-application.xml"/>
-<property name="application-client.xml" value="descriptor/application-client.xml"/>
-<property name="sun-application-client.xml" value="descriptor/sun-application-client.xml"/>
-<property name="appclientjar.files" value="${build.classes.dir}"/>
-<property name="appclient.jar" value="${assemble.dir}/${appname}-client.jar"/>
-<property name="app.type" value="application"/>
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/mbeans1/build.xml b/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/mbeans1/build.xml
deleted file mode 100644
index 4988fda..0000000
--- a/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/mbeans1/build.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE project [
-<!--
-
- Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v. 2.0, which is available at
- http://www.eclipse.org/legal/epl-2.0.
-
- This Source Code may also be made available under the following Secondary
- Licenses when the conditions for such availability set forth in the
- Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- version 2 with the GNU Classpath Exception, which is available at
- https://www.gnu.org/software/classpath/license.html.
-
- SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-
--->
-
-<!ENTITY commonSetup SYSTEM "file:./../../../config/properties.xml">
-<!ENTITY commonBuild SYSTEM "file:./../../../config/common.xml">
-<!ENTITY commonLazyInit SYSTEM "file:./../common.xml">
-<!ENTITY testproperties SYSTEM "file:./build.properties">
-]>
-
-<project name="management-mejb" default="usage" basedir=".">
-
- &commonSetup;
- &commonBuild;
- &commonLazyInit;
- &testproperties;
-
- <target name="all" depends="run-test"/>
- <target name="run-test" depends="pre-start,clean,build,deploy,run,undeploy"/>
-
- <target name="clean" depends="init-common">
- <antcall target="clean-common"/>
- </target>
-
- <target name="compile" depends="clean">
- <antcall target="compile-common">
- <param name="src" value="client"/>
- </antcall>
- </target>
-
- <target name="build" depends="compile">
- <antcall target="appclient-jar-common">
- <param name="appclientjar.classes"
- value="**/*Client*.class" />
- </antcall>
- <antcall target="ear-common"/>
- </target>
-
- <target name="deploy"
- depends="init-common">
- <antcall target="deploy-common"/>
- </target>
-
-
- <target name="run" depends="init-common">
- <antcall target="restart-server"/>
- <antcall target="runclient-common"/>
- </target>
-
- <target name="undeploy" depends="init-common">
- <antcall target="undeploy-common"/>
- </target>
-
- <target name="usage">
- <antcall target="usage-common"/>
- </target>
-
-
-
-</project>
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/mbeans1/client/Client.java b/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/mbeans1/client/Client.java
deleted file mode 100644
index fd8935f..0000000
--- a/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/mbeans1/client/Client.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 2002, 2018 Oracle and/or its affiliates. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-package com.sun.s1asdev.management.mejb.client;
-
-
-import java.util.*;
-import javax.management.*;
-import javax.management.remote.*;
-
-import com.sun.appserv.management.*;
-import com.sun.appserv.management.client.*;
-import com.sun.appserv.management.config.*;
-
-import com.sun.ejte.ccl.reporter.SimpleReporterAdapter;
-
-public class Client {
-
- // consts
- public static String kTestNotRun = "TEST NOT RUN";
- public static String kTestPassed = "TEST PASSED";
- public static String kTestFailed = "TEST FAILED";
-
- private static SimpleReporterAdapter stat =
- new SimpleReporterAdapter("appserv-tests");
-
- public static void main (String[] args) {
- stat.addDescription("management-mejb");
- Client client = new Client(args);
- client.doTest();
- stat.printSummary("management-mejb");
- }
-
- public Client (String[] args) {}
-
- public String doTest() {
-
- boolean pass = false;
- String res = kTestNotRun;
-
- try {
-
- String host = "localhost";
- int port = 8686;
- String user = "admin";
- String password = "adminadmin";
-
- // Get Config info using AMX
- AppserverConnectionSource conn = new AppserverConnectionSource(
- host, port, user, password, null);
-
- DomainRoot domainRoot = conn.getDomainRoot();
-
- DomainConfig config = domainRoot.getDomainConfig();
-
- Map map = config.getJDBCResourceConfigMap();
- Collection<JDBCResourceConfig> jdbcConfigs =
- (Collection<JDBCResourceConfig>)map.values();
- for ( JDBCResourceConfig jdbcConfig : jdbcConfigs ) {
- System.err.println("JDBC Resource: name = " + jdbcConfig.getName()
- + ", JNDI Name = " + jdbcConfig.getJNDIName()
- + ", Pool Name = " + jdbcConfig.getPoolName());
- System.err.println("\t\tJ2EEType = " + jdbcConfig.getJ2EEType());
- pass = true;
- }
-
- if (pass == false) {
- throw new Exception("No JDBC resources found");
- }
- pass = false;
-
- // Get Config info using JMX
- //MBeanServerConnection mbConn = conn.getMBeanServerConnection( false );
- String urls = "service:jmx:rmi:///jndi/rmi://" +
- host + ":" + port + "/management/rmi-jmx-connector";
- JMXServiceURL url = new JMXServiceURL(urls);
- HashMap env = new HashMap();
- env.put(JMXConnector.CREDENTIALS, new String[] { user, password });
- JMXConnector jmxConnector = JMXConnectorFactory.connect(url, env);
- MBeanServerConnection mbConn = jmxConnector.getMBeanServerConnection();
-
- //ObjectName objectName =
- // new ObjectName("amx:j2eeType=X-JDBCResourceConfig,*");
- ObjectName objectName = null; // to query all MBeans
- Set mbeans = (Set) mbConn.queryNames(objectName, null);
- Iterator it = mbeans.iterator();
- while ( it.hasNext() ) {
- ObjectName mbean = (ObjectName) it.next();
- System.err.println("Object Name : " + mbean.getCanonicalName());
- pass = true;
- }
-
- if (pass == false) {
- throw new Exception("No Mbeans found");
- }
-
- } catch(Exception re) {
- re.printStackTrace();
- res = kTestFailed;
- return res;
- }
-
- if ( pass ) {
- res = kTestPassed;
- System.out.println("Mbean Test passed");
- stat.addStatus("Mbean Test", stat.PASS);
-
- } else {
- res = kTestFailed;
- System.out.println("Mbean Test failed");
- stat.addStatus("Mbean Test", stat.FAIL);
-
- }
-
- return res;
- }
-
-}
-
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/mbeans1/client/MANIFEST.MF b/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/mbeans1/client/MANIFEST.MF
deleted file mode 100644
index b4bb107..0000000
--- a/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/mbeans1/client/MANIFEST.MF
+++ /dev/null
@@ -1,4 +0,0 @@
-Manifest-Version: 1.0
-Created-By: Apache Ant 1.5.1
-Main-Class: com.sun.s1asdev.management.mejb.client.Client
-
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/mbeans1/descriptor/application-client.xml b/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/mbeans1/descriptor/application-client.xml
deleted file mode 100644
index e9aa427..0000000
--- a/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/mbeans1/descriptor/application-client.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v. 2.0, which is available at
- http://www.eclipse.org/legal/epl-2.0.
-
- This Source Code may also be made available under the following Secondary
- Licenses when the conditions for such availability set forth in the
- Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- version 2 with the GNU Classpath Exception, which is available at
- https://www.gnu.org/software/classpath/license.html.
-
- SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-
--->
-
-<application-client version="1.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application-client_1_4.xsd">
- <display-name>management-mejbClient</display-name>
- <ejb-ref>
- <ejb-ref-name>ejbs/mejb</ejb-ref-name>
- <ejb-ref-type>Session</ejb-ref-type>
- <home>javax.management.j2ee.ManagementHome</home>
- <remote>javax.management.j2ee.Management</remote>
- <ejb-link>MEjbBean</ejb-link>
- </ejb-ref>
-</application-client>
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/mbeans1/descriptor/application.xml b/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/mbeans1/descriptor/application.xml
deleted file mode 100644
index 67b56f4..0000000
--- a/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/mbeans1/descriptor/application.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v. 2.0, which is available at
- http://www.eclipse.org/legal/epl-2.0.
-
- This Source Code may also be made available under the following Secondary
- Licenses when the conditions for such availability set forth in the
- Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- version 2 with the GNU Classpath Exception, which is available at
- https://www.gnu.org/software/classpath/license.html.
-
- SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-
--->
-
-<application version="1.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
- <description>MEJB Client Application</description>
- <display-name>mejbClientApp</display-name>
- <module>
- <java>management-mejb-client.jar</java>
- </module>
-</application>
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/mbeans1/descriptor/sun-application-client.xml b/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/mbeans1/descriptor/sun-application-client.xml
deleted file mode 100644
index e0cc83a..0000000
--- a/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/mbeans1/descriptor/sun-application-client.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE sun-application-client PUBLIC "-//Sun Microsystems, Inc.//DTD Sun ONE Application Server 7.0 Application Client 1.3//EN" "http://www.sun.com/software/sunone/appserver/dtds/sun-application-client_1_3-0.dtd">
-<!--
-
- Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v. 2.0, which is available at
- http://www.eclipse.org/legal/epl-2.0.
-
- This Source Code may also be made available under the following Secondary
- Licenses when the conditions for such availability set forth in the
- Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- version 2 with the GNU Classpath Exception, which is available at
- https://www.gnu.org/software/classpath/license.html.
-
- SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-
--->
-
-<sun-application-client>
- <ejb-ref>
- <ejb-ref-name>ejbs/mejb</ejb-ref-name>
- <jndi-name>ejb/mgmt/MEJB</jndi-name>
- </ejb-ref>
-</sun-application-client>
diff --git a/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/mbeans1/descriptor/sun-application.xml b/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/mbeans1/descriptor/sun-application.xml
deleted file mode 100644
index a956f32..0000000
--- a/appserver/tests/v2-tests/appserv-tests/devtests/lazyInit/mbeans1/descriptor/sun-application.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE sun-application PUBLIC "-//Sun Microsystems, Inc.//DTD Sun ONE Application Server 7.0 J2EE Application 1.3//EN" "http://www.sun.com/software/sunone/appserver/dtds/sun-application_1_3-0.dtd">
-<!--
-
- Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v. 2.0, which is available at
- http://www.eclipse.org/legal/epl-2.0.
-
- This Source Code may also be made available under the following Secondary
- Licenses when the conditions for such availability set forth in the
- Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- version 2 with the GNU Classpath Exception, which is available at
- https://www.gnu.org/software/classpath/license.html.
-
- SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-
--->
-
-<sun-application/>
diff --git a/appserver/tests/v2-tests/appserv-tests/sqetests/management/README b/appserver/tests/v2-tests/appserv-tests/sqetests/management/README
deleted file mode 100644
index d1099fd..0000000
--- a/appserver/tests/v2-tests/appserv-tests/sqetests/management/README
+++ /dev/null
@@ -1,18 +0,0 @@
-unit tests for management
-This test is not turned on as part of quick test yet.
-Until MEjbApp.ear is deployed in the appserver as part of auto deploy, please deploy the mejb manually and run this test to check the
-availability of the mejb.
-MEjbAppl.ear is available as part of the source build in publish/<JDK...>/admin-core/jsr77/lib directory.
-Here is the deploy command to deploy the MEjbApp.ear, assuming its copied to c:\temp
-
-asadmin>deploy --user admin --password password --name MEjbApp c:/temp/MEjbApp.ear --type application
-
-To execute the test, cd to appserv-tests\sqetests\management directory and run the following commond.
-> ant mejb
-
-
-
-
-
-
-
diff --git a/appserver/tests/v2-tests/appserv-tests/sqetests/management/build.xml b/appserver/tests/v2-tests/appserv-tests/sqetests/management/build.xml
deleted file mode 100644
index c39d17a..0000000
--- a/appserver/tests/v2-tests/appserv-tests/sqetests/management/build.xml
+++ /dev/null
@@ -1,117 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-
- Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v. 2.0, which is available at
- http://www.eclipse.org/legal/epl-2.0.
-
- This Source Code may also be made available under the following Secondary
- Licenses when the conditions for such availability set forth in the
- Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- version 2 with the GNU Classpath Exception, which is available at
- https://www.gnu.org/software/classpath/license.html.
-
- SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-
--->
-
-<project name="management" default="usage" basedir=".">
-
- <property name="mejb-target" value="all"/>
-
-<!-- ======== Targets by execution granularity ========== -->
- <target name="all">
- <antcall target="mejbtests">
- <param name="mejb-target" value="all"/>
- </antcall>
- </target>
-
- <target name="run-test">
- <antcall target="mejbtests">
- <param name="mejb-target" value="run-test"/>
- </antcall>
- </target>
-
- <target name="clean">
- <antcall target="mejbtests">
- <param name="mejb-target" value="clean"/>
- </antcall>
- </target>
-
- <target name="build">
- <antcall target="mejbtests">
- <param name="mejb-target" value="build"/>
- </antcall>
- </target>
-
- <target name="deploy">
- <antcall target="mejbtests">
- <param name="mejb-target" value="deploy"/>
- </antcall>
- </target>
-
- <target name="undeploy">
- <antcall target="mejbtests">
- <param name="mejb-target" value="undeploy"/>
- </antcall>
- </target>
-
- <target name="run">
- <antcall target="mejbtests">
- <param name="mejb-target" value="run"/>
- </antcall>
- </target>
-
- <target name="setup">
- <antcall target="mejbtests">
- <param name="mejb-target" value="setup"/>
- </antcall>
- </target>
-
- <target name="unsetup">
- <antcall target="mejbtests">
- <param name="mejb-target" value="unsetup"/>
- </antcall>
- </target>
-
-
- <target name="mejbtests">
- <antcall target="mejb"/>
- </target>
-
-<!-- ======== Targets by technology ========== -->
-
- <target name="mejb">
- <record name="mejb.output" action="start" />
- <ant dir="mejb" target="${mejb-target}"/>
- <record name="mejb.output" action="stop" />
- </target>
-
- <target name="usage">
- <echo> Usage:
- ======== Targets by execution granularity =========
-
- ant clean (Cleans all management tests)
- ant build (builds all mejb tests)
- ant setup (setup all required resources)
- ant deploy (deploy all test apps)
- ant run (Executes all tests)
- ant undeploy (undeploy all test apps)
- ant unsetup (remove all set resources)
-
- ======== Targets by technology =========
-
- ant mejb (Executes the mejb test)
- ant all (Executes all the mejb tests)
-
- ===== Targets by technoloy and execution granularity ======
- Note: Run the command of the following type:
-
- % ant mejb -Dmejb-target=clean
-
- to run the 'clean' target for 'stateless' tests
- </echo>
- </target>
-</project>
diff --git a/appserver/tests/v2-tests/appserv-tests/sqetests/management/mejb/build.properties b/appserver/tests/v2-tests/appserv-tests/sqetests/management/mejb/build.properties
deleted file mode 100644
index 0158802..0000000
--- a/appserver/tests/v2-tests/appserv-tests/sqetests/management/mejb/build.properties
+++ /dev/null
@@ -1,31 +0,0 @@
-<!--
-
- Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v. 2.0, which is available at
- http://www.eclipse.org/legal/epl-2.0.
-
- This Source Code may also be made available under the following Secondary
- Licenses when the conditions for such availability set forth in the
- Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- version 2 with the GNU Classpath Exception, which is available at
- https://www.gnu.org/software/classpath/license.html.
-
- SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-
--->
-
-
-<property name="module" value="management-mejb"/>
-<property name="appname" value="${module}"/>
-<property name="assemble" value="${build.classes.dir}/archive"/>
-<property name="test.client" value="management-mejbClient"/>
-<property name="application.xml" value="descriptor/application.xml"/>
-<property name="sun-application.xml" value="descriptor/sun-application.xml"/>
-<property name="application-client.xml" value="descriptor/application-client.xml"/>
-<property name="sun-application-client.xml" value="descriptor/sun-application-client.xml"/>
-<property name="appclientjar.files" value="${build.classes.dir}"/>
-<property name="appclient.jar" value="${assemble.dir}/${appname}-client.jar"/>
-<property name="app.type" value="application"/>
-<property name="verbose.mode" value="false"/>
diff --git a/appserver/tests/v2-tests/appserv-tests/sqetests/management/mejb/build.xml b/appserver/tests/v2-tests/appserv-tests/sqetests/management/mejb/build.xml
deleted file mode 100644
index a5f9f55..0000000
--- a/appserver/tests/v2-tests/appserv-tests/sqetests/management/mejb/build.xml
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE project [
-<!--
-
- Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v. 2.0, which is available at
- http://www.eclipse.org/legal/epl-2.0.
-
- This Source Code may also be made available under the following Secondary
- Licenses when the conditions for such availability set forth in the
- Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- version 2 with the GNU Classpath Exception, which is available at
- https://www.gnu.org/software/classpath/license.html.
-
- SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-
--->
-
-<!ENTITY commonSetup SYSTEM "file:./../../../config/properties.xml">
-<!ENTITY commonBuild SYSTEM "file:./../../../config/common.xml">
-<!ENTITY testproperties SYSTEM "file:./build.properties">
-]>
-
-<project name="management-mejb" default="usage" basedir=".">
-
- &commonSetup;
- &commonBuild;
- &testproperties;
-
- <target name="all" depends="clean,build,deploy,setup, run,undeploy,unsetup"/>
- <target name="run-test" depends="clean,build,deploy,run,undeploy"/>
-
- <target name="setup">
- <antcall target="create-file-users"/>
- </target>
- <target name="unsetup">
- <antcall target="delete-file-users"/>
- </target>
-
- <target name="clean" depends="init-common">
- <antcall target="clean-common"/>
- </target>
-
- <target name="compile" depends="clean">
- <antcall target="compile-common">
- <param name="src" value="client"/>
- </antcall>
- </target>
-
- <target name="build" depends="compile">
- <antcall target="appclient-jar-common">
- <param name="appclientjar.classes"
- value="**/*Client*.class" />
- </antcall>
- <antcall target="ear-common"/>
- </target>
-
- <target name="deploy"
- depends="init-common">
- <antcall target="deploy-common"/>
- </target>
-
- <target name="run" depends="init-common">
- <antcall target="runclient-common">
- <param name="appclient.application.args" value="${verbose.mode}"/>
- </antcall>
-
- </target>
-
- <target name="undeploy" depends="init-common">
- <antcall target="undeploy-common"/>
- </target>
-
- <target name="usage">
- <antcall target="usage-common"/>
- </target>
-
-<!-- ================================================================ -->
-<!-- Target to create users in file realm -->
-<!-- ================================================================ -->
-
-<target name="create-file-users" depends="init-common">
- <antcall target ="create-user-common">
- <param name="user" value="j2ee"/>
- <param name="password" value="j2ee"/>
- <param name="groups" value="asadmin"/>
- </antcall>
-</target>
-
-<!-- ================================================================ -->
-<!-- Target to delete users in file realm -->
-<!-- ================================================================ -->
-
-<target name="delete-file-users" depends="init-common">
- <antcall target ="delete-user-common">
- <param name="user" value="j2ee"/>
- <param name="password" value="j2ee"/>
- <param name="groups" value="asadmin"/>
- </antcall>
-</target>
-
-</project>
diff --git a/appserver/tests/v2-tests/appserv-tests/sqetests/management/mejb/client/Client.java b/appserver/tests/v2-tests/appserv-tests/sqetests/management/mejb/client/Client.java
deleted file mode 100644
index e5c974b..0000000
--- a/appserver/tests/v2-tests/appserv-tests/sqetests/management/mejb/client/Client.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright (c) 2002, 2018 Oracle and/or its affiliates. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-package com.sun.s1asdev.management.mejb.client;
-
-import java.io.*;
-import java.util.*;
-import javax.management.j2ee.ManagementHome;
-import javax.management.j2ee.Management;
-import javax.management.*;
-import javax.naming.*;
-import javax.rmi.PortableRemoteObject;
-
-import com.sun.ejte.ccl.reporter.SimpleReporterAdapter;
-
-public class Client {
-
- // consts
- public static String kTestNotRun = "TEST NOT RUN";
- public static String kTestPassed = "TEST PASSED";
- public static String kTestFailed = "TEST FAILED";
- public boolean DEBUG = false;
-
- String jndiName = "ejb/mgmt/MEJB";
- private static SimpleReporterAdapter stat =
- new SimpleReporterAdapter("appserv-tests");
-
- public static void main (String[] args) {
- stat.addDescription("management-mejb");
- Client client = new Client(args);
- client.doTest();
- stat.printSummary("management-mejb");
- }
-
- public Client(String[] args) {
- String debug=args[0];
- if(debug.equalsIgnoreCase("false"))
- DEBUG=false;
- if(debug.equalsIgnoreCase("true"))
- DEBUG=true;
- }
-
-
-
- public String doTest() {
-
- boolean pass = true;
- String res = kTestNotRun;
-
- try {
-
- Context ic = new InitialContext();
- System.out.println("***Created initial context");
-
- java.lang.Object objref = ic.lookup("ejb/mgmt/MEJB");
- System.out.println("***Looked up ManagementHome!!");
-
- ManagementHome home = (ManagementHome)PortableRemoteObject.narrow(
- objref, ManagementHome.class);
- System.out.println("***Narrowed ManagementHome!!");
-
- Management mejb = home.create();
- System.out.println("***Got the MEJB!!");
-
- String domain = mejb.getDefaultDomain();
- System.out.println("***MEJB default domain = "+domain);
- int mbeanCount = mejb.getMBeanCount().intValue();
- System.out.println("***MBeanCount = "+mbeanCount);
-
- // Print attributes of all MBeans
- ObjectName query = new ObjectName("*:*");
- Set mbeanNames = mejb.queryNames(query, null);
- if ( mbeanNames.size() != mbeanCount ) {
- System.out.println("***ERROR: mbeans returned by query is "
- +mbeanNames.size());
- pass = false;
- }
- if(DEBUG){
- System.out.println("Test running in verbose mode");
- printConsoleOutput(mbeanNames,mejb);
- }
- mejb.remove();
- if ( pass ) {
- res = kTestPassed;
- System.out.println("MEJB Test passed");
- stat.addStatus("MEJB Test", stat.PASS);
-
- } else {
- res = kTestFailed;
- System.out.println("MEJB Test failed");
- stat.addStatus("MEJB Test", stat.FAIL);
-
- }
-
- return res;
-
- } catch(NamingException ne){
- System.out.println("***Exception while initializing context.\n");
- ne.printStackTrace();
- res = kTestFailed;
- return res;
- } catch(Exception re) {
- re.printStackTrace();
- res = kTestFailed;
- return res;
- }
- }
-
- public void printConsoleOutput(Set mbeanNames, Management managementbean){
- Set mbeanNamesSet=mbeanNames;
- Management mejb=managementbean;
-
- try{
- Iterator it = mbeanNamesSet.iterator();
- while ( it.hasNext() ) {
-
- ObjectName name = (ObjectName)it.next();
- System.out.println("ObjectName = "+name);
-
- // Construct list of attr names
- MBeanInfo info = mejb.getMBeanInfo(name);
- MBeanAttributeInfo[] attrInfo = info.getAttributes();
- String[] attrNames = new String[attrInfo.length];
- for ( int i=0; i<attrInfo.length; i++ ) {
- attrNames[i] = attrInfo[i].getName();
- }
- // Get attr values from MEJB and print them
-
- AttributeList attrs = mejb.getAttributes(name, attrNames);
- for ( int i=0; i<attrs.size(); i++ ) {
-
- if (attrs.get(i) != null) {
- System.out.println("TYPE = " +
- attrs.get(i).getClass().getName());
- }
-
- if (attrs.get(i) instanceof Attribute) {
- Attribute attr = (Attribute)attrs.get(i);
- System.out.println("Attribute name = "+attr.getName()
- +"value = "+attr.getValue());
- } else {
- Object attr = attrs.get(i);
- System.out.println("Attribute = " + attr);
- }
- }
- }
- } catch(Exception exp){
- //exp.printStackTrace();
- System.out.println("***Exception occured while "+
- "accessing mbean details: Keep continuing\n");
- }
- //System.out.println("=======================");
- }
-
-
-}
diff --git a/appserver/tests/v2-tests/appserv-tests/sqetests/management/mejb/client/MANIFEST.MF b/appserver/tests/v2-tests/appserv-tests/sqetests/management/mejb/client/MANIFEST.MF
deleted file mode 100644
index b4bb107..0000000
--- a/appserver/tests/v2-tests/appserv-tests/sqetests/management/mejb/client/MANIFEST.MF
+++ /dev/null
@@ -1,4 +0,0 @@
-Manifest-Version: 1.0
-Created-By: Apache Ant 1.5.1
-Main-Class: com.sun.s1asdev.management.mejb.client.Client
-
diff --git a/appserver/tests/v2-tests/appserv-tests/sqetests/management/mejb/descriptor/application-client.xml b/appserver/tests/v2-tests/appserv-tests/sqetests/management/mejb/descriptor/application-client.xml
deleted file mode 100644
index e9aa427..0000000
--- a/appserver/tests/v2-tests/appserv-tests/sqetests/management/mejb/descriptor/application-client.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v. 2.0, which is available at
- http://www.eclipse.org/legal/epl-2.0.
-
- This Source Code may also be made available under the following Secondary
- Licenses when the conditions for such availability set forth in the
- Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- version 2 with the GNU Classpath Exception, which is available at
- https://www.gnu.org/software/classpath/license.html.
-
- SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-
--->
-
-<application-client version="1.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application-client_1_4.xsd">
- <display-name>management-mejbClient</display-name>
- <ejb-ref>
- <ejb-ref-name>ejbs/mejb</ejb-ref-name>
- <ejb-ref-type>Session</ejb-ref-type>
- <home>javax.management.j2ee.ManagementHome</home>
- <remote>javax.management.j2ee.Management</remote>
- <ejb-link>MEjbBean</ejb-link>
- </ejb-ref>
-</application-client>
diff --git a/appserver/tests/v2-tests/appserv-tests/sqetests/management/mejb/descriptor/application.xml b/appserver/tests/v2-tests/appserv-tests/sqetests/management/mejb/descriptor/application.xml
deleted file mode 100644
index 67b56f4..0000000
--- a/appserver/tests/v2-tests/appserv-tests/sqetests/management/mejb/descriptor/application.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v. 2.0, which is available at
- http://www.eclipse.org/legal/epl-2.0.
-
- This Source Code may also be made available under the following Secondary
- Licenses when the conditions for such availability set forth in the
- Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- version 2 with the GNU Classpath Exception, which is available at
- https://www.gnu.org/software/classpath/license.html.
-
- SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-
--->
-
-<application version="1.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
- <description>MEJB Client Application</description>
- <display-name>mejbClientApp</display-name>
- <module>
- <java>management-mejb-client.jar</java>
- </module>
-</application>
diff --git a/appserver/tests/v2-tests/appserv-tests/sqetests/management/mejb/descriptor/sun-application-client.xml b/appserver/tests/v2-tests/appserv-tests/sqetests/management/mejb/descriptor/sun-application-client.xml
deleted file mode 100644
index e0cc83a..0000000
--- a/appserver/tests/v2-tests/appserv-tests/sqetests/management/mejb/descriptor/sun-application-client.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE sun-application-client PUBLIC "-//Sun Microsystems, Inc.//DTD Sun ONE Application Server 7.0 Application Client 1.3//EN" "http://www.sun.com/software/sunone/appserver/dtds/sun-application-client_1_3-0.dtd">
-<!--
-
- Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v. 2.0, which is available at
- http://www.eclipse.org/legal/epl-2.0.
-
- This Source Code may also be made available under the following Secondary
- Licenses when the conditions for such availability set forth in the
- Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- version 2 with the GNU Classpath Exception, which is available at
- https://www.gnu.org/software/classpath/license.html.
-
- SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-
--->
-
-<sun-application-client>
- <ejb-ref>
- <ejb-ref-name>ejbs/mejb</ejb-ref-name>
- <jndi-name>ejb/mgmt/MEJB</jndi-name>
- </ejb-ref>
-</sun-application-client>
diff --git a/appserver/tests/v2-tests/appserv-tests/sqetests/management/mejb/descriptor/sun-application.xml b/appserver/tests/v2-tests/appserv-tests/sqetests/management/mejb/descriptor/sun-application.xml
deleted file mode 100644
index a956f32..0000000
--- a/appserver/tests/v2-tests/appserv-tests/sqetests/management/mejb/descriptor/sun-application.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE sun-application PUBLIC "-//Sun Microsystems, Inc.//DTD Sun ONE Application Server 7.0 J2EE Application 1.3//EN" "http://www.sun.com/software/sunone/appserver/dtds/sun-application_1_3-0.dtd">
-<!--
-
- Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v. 2.0, which is available at
- http://www.eclipse.org/legal/epl-2.0.
-
- This Source Code may also be made available under the following Secondary
- Licenses when the conditions for such availability set forth in the
- Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- version 2 with the GNU Classpath Exception, which is available at
- https://www.gnu.org/software/classpath/license.html.
-
- SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-
--->
-
-<sun-application/>
diff --git a/appserver/web/weld-integration/src/main/java/org/glassfish/weld/services/ProxyServicesImpl.java b/appserver/web/weld-integration/src/main/java/org/glassfish/weld/services/ProxyServicesImpl.java
index 4479088..683f895 100644
--- a/appserver/web/weld-integration/src/main/java/org/glassfish/weld/services/ProxyServicesImpl.java
+++ b/appserver/web/weld-integration/src/main/java/org/glassfish/weld/services/ProxyServicesImpl.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2010, 2018-2021 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -16,13 +17,12 @@
package org.glassfish.weld.services;
-import java.lang.reflect.Method;
+import com.sun.ejb.codegen.ClassGenerator;
+
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedExceptionAction;
import java.security.ProtectionDomain;
-import java.util.concurrent.atomic.AtomicBoolean;
-
import org.glassfish.hk2.api.ServiceLocator;
import org.glassfish.internal.api.ClassLoaderHierarchy;
import org.jboss.weld.serialization.spi.ProxyServices;
@@ -42,10 +42,6 @@
*/
public class ProxyServicesImpl implements ProxyServices {
- private static Method defineClassMethod;
- private static Method defineClassMethodSM;
- private static final AtomicBoolean CL_METHODS_INITIALIZATION_FINISHED = new AtomicBoolean(false);
-
private final ClassLoaderHierarchy classLoaderHierarchy;
@@ -102,7 +98,6 @@
@Override
public Class<?> defineClass(final Class<?> originalClass, final String className, final byte[] classBytes,
final int off, final int len, final ProtectionDomain protectionDomain) throws ClassFormatError {
- checkClassDefinitionFeature();
final ClassLoader loader = getClassLoaderforBean(originalClass);
if (protectionDomain == null) {
return defineClass(loader, className, classBytes, off, len);
@@ -125,30 +120,6 @@
/**
- * Initialization of access to protected methods of the {@link ClassLoader} class.
- */
- private static void checkClassDefinitionFeature() {
- if (CL_METHODS_INITIALIZATION_FINISHED.compareAndSet(false, true)) {
- try {
- final PrivilegedExceptionAction<Void> action = () -> {
- final Class<?> cl = Class.forName("java.lang.ClassLoader");
- final String name = "defineClass";
- defineClassMethod = cl.getDeclaredMethod(name, String.class, byte[].class, int.class, int.class);
- defineClassMethod.setAccessible(true);
- defineClassMethodSM = cl.getDeclaredMethod(
- name, String.class, byte[].class, int.class, int.class, ProtectionDomain.class);
- defineClassMethodSM.setAccessible(true);
- return null;
- };
- AccessController.doPrivileged(action);
- } catch (final Exception e) {
- throw new WeldProxyException("Could not initialize access to ClassLoader.defineClass method.", e);
- }
- }
- }
-
-
- /**
* @param originalClass
* @return ClassLoader probably usable with the bean.
*/
@@ -199,7 +170,7 @@
final byte[] b, final int off, final int len,
final ProtectionDomain protectionDomain) {
try {
- return (Class<?>) defineClassMethodSM.invoke(loader, className, b, 0, len, protectionDomain);
+ return ClassGenerator.defineClass(loader, className, b, 0, len, protectionDomain);
} catch (final Exception e) {
throw new WeldProxyException("Could not define class " + className, e);
}
@@ -210,7 +181,7 @@
final ClassLoader loader, final String className,
final byte[] b, final int off, final int len) {
try {
- return (Class<?>) defineClassMethod.invoke(loader, className, b, 0, len);
+ return ClassGenerator.defineClass(loader, className, b, 0, len);
} catch (final Exception e) {
throw new WeldProxyException("Could not define class " + className, e);
}
diff --git a/etc/docker/Dockerfile b/etc/docker/Dockerfile
index 975b6a5..ba358db 100644
--- a/etc/docker/Dockerfile
+++ b/etc/docker/Dockerfile
@@ -56,7 +56,7 @@
ENV MAVEN_HOME /usr/share/maven
ENV M2_HOME /usr/share/maven
ENV ANT_HOME /usr/share/ant
-ENV JAVA_TOOL_OPTIONS "-Xmx2G"
+ENV JAVA_TOOL_OPTIONS "-Xmx2G -Xss768k"
ENV HOME /home/jenkins
WORKDIR /home/jenkins
diff --git a/gfbuild.sh b/gfbuild.sh
index a3ac016..30762b8 100755
--- a/gfbuild.sh
+++ b/gfbuild.sh
@@ -67,7 +67,7 @@
}
dev_build(){
- mvn -U clean install -Pstaging ${MVN_EXTRA}
+ mvn -U clean install -Pstaging,fastest -T2C ${MVN_EXTRA}
}
build_re_dev(){
@@ -83,7 +83,5 @@
"$@"
if [ ! -z "${JENKINS_HOME}" ] ; then
- # archive the local repository org.glassfish.main
- # the output is a tar archive split into 1MB chunks.
- tar -cz -f - -C ${HOME}/.m2/repository org/glassfish/main | split -b 1m - ${WORKSPACE}/bundles/_maven-repo
+ tar -c --exclude='*.zip' --exclude='*/main/tests/*' --exclude='*/main/distributions/*' --exclude='*/main/extras/*' --exclude='*/main/admingui/*' --newer-mtime '1 day ago' -C ${HOME}/.m2/repository org/glassfish/main | gzip --fast > ${WORKSPACE}/bundles/maven-repo.tar.gz
fi
diff --git a/gftest.sh b/gftest.sh
index 80fa231..75b11cf 100755
--- a/gftest.sh
+++ b/gftest.sh
@@ -33,6 +33,7 @@
"ejb_group_1"
"ejb_group_2"
"ejb_group_3"
+ "ejb_group_embedded"
"ejb_web_all"
"cdi_all"
"ql_gf_full_profile_all"
@@ -51,6 +52,9 @@
declare -a arr=("$@")
fi
+echo "Removing old glassfish directory: ${S1AS_HOME}";
+rm -rf "${S1AS_HOME}";
+
printf '\n Running tests for: \n\n'
printf '* %s\n' "${arr[@]}"
diff --git a/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/composite/CompositeUtil.java b/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/composite/CompositeUtil.java
index 117438f..1f39a75 100644
--- a/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/composite/CompositeUtil.java
+++ b/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/composite/CompositeUtil.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2012, 2020 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -22,6 +23,7 @@
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.annotation.Annotation;
+import java.lang.invoke.MethodHandles;
import java.lang.reflect.Array;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
@@ -29,7 +31,6 @@
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
-import java.security.ProtectionDomain;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
@@ -88,9 +89,9 @@
* @author jdlee
*/
public class CompositeUtil {
- private static final Map<String, Class<?>> generatedClasses = new HashMap<String, Class<?>>();
- private static final Map<String, List<String>> modelExtensions = new HashMap<String, List<String>>();
- private boolean extensionsLoaded = false;
+ private static final Map<String, Class<?>> generatedClasses = new HashMap<>();
+ private static final Map<String, List<String>> modelExtensions = new HashMap<>();
+ private final boolean extensionsLoaded = false;
private static volatile Validator beanValidator = null;
private static final LocalStringManagerImpl adminStrings = new LocalStringManagerImpl(CompositeUtil.class);
@@ -117,7 +118,7 @@
public synchronized <T> T getModel(Class<T> modelIface) {
String className = modelIface.getName() + "Impl";
if (!generatedClasses.containsKey(className)) {
- Map<String, Map<String, Object>> properties = new HashMap<String, Map<String, Object>>();
+ Map<String, Map<String, Object>> properties = new HashMap<>();
Set<Class<?>> interfaces = getModelExtensions(modelIface);
interfaces.add(modelIface);
@@ -155,7 +156,7 @@
}
public Set<Class<?>> getRestModels() {
- Set<Class<?>> classes = new HashSet<Class<?>>();
+ Set<Class<?>> classes = new HashSet<>();
for (ActiveDescriptor ad : Globals.getDefaultBaseServiceLocator()
.getDescriptors(BuilderHelper.createContractFilter(RestModel.class.getName()))) {
try {
@@ -176,7 +177,7 @@
* @param method
*/
public Object getResourceExtensions(Class<?> baseClass, Object data, String method) {
- List<RestExtension> extensions = new ArrayList<RestExtension>();
+ List<RestExtension> extensions = new ArrayList<>();
for (RestExtension extension : Globals.getDefaultHabitat().<RestExtension>getAllServices(RestExtension.class)) {
if (baseClass.getName().equals(extension.getParent())) {
@@ -531,7 +532,7 @@
* @return
*/
private Set<Class<?>> getModelExtensions(Class<?> baseModel) {
- Set<Class<?>> exts = new HashSet<Class<?>>();
+ Set<Class<?>> exts = new HashSet<>();
if (!extensionsLoaded) {
synchronized (modelExtensions) {
@@ -583,7 +584,7 @@
String ext = entry[1];
List<String> list = modelExtensions.get(base);
if (list == null) {
- list = new ArrayList<String>();
+ list = new ArrayList<>();
modelExtensions.put(base, list);
}
list.add(ext);
@@ -605,7 +606,7 @@
}
private List<Method> getSetters(Class<?> clazz) {
- List<Method> methods = new ArrayList<Method>();
+ List<Method> methods = new ArrayList<>();
for (Method method : clazz.getMethods()) {
if (method.getName().startsWith("set")) {
@@ -631,7 +632,7 @@
name = name.substring(3);
Map<String, Object> property = properties.get(name);
if (property == null) {
- property = new HashMap<String, Object>();
+ property = new HashMap<>();
properties.put(name, property);
}
@@ -662,12 +663,12 @@
}
private Map<String, Map<String, Object>> gatherReferencedAttributes(String bean, String attribute) {
- Map<String, Map<String, Object>> annos = new HashMap<String, Map<String, Object>>();
+ Map<String, Map<String, Object>> annos = new HashMap<>();
try {
Class<?> configBeanClass = Class.forName(bean);
Method m = configBeanClass.getMethod("get" + attribute);
for (Annotation a : m.getAnnotations()) {
- Map<String, Object> anno = new HashMap<String, Object>();
+ Map<String, Object> anno = new HashMap<>();
for (Method am : a.annotationType().getDeclaredMethods()) {
String methodName = am.getName();
Object value = am.invoke(a);
@@ -885,51 +886,9 @@
return className.replace(".", "/");
}
- // TODO: This is duplicated from the generator class.
private Class<?> defineClass(Class<?> similarClass, String className, byte[] classBytes) throws Exception {
- byte[] byteContent = classBytes;
- ProtectionDomain pd = similarClass.getProtectionDomain();
-
- java.lang.reflect.Method jm = null;
- for (java.lang.reflect.Method jm2 : ClassLoader.class.getDeclaredMethods()) {
- if (jm2.getName().equals("defineClass") && jm2.getParameterTypes().length == 5) {
- jm = jm2;
- break;
- }
- }
- if (jm == null) {//should never happen, makes findbug happy
- throw new RuntimeException("cannot find method called defineclass...");
- }
- final java.lang.reflect.Method clM = jm;
- try {
- java.security.AccessController.doPrivileged(new java.security.PrivilegedExceptionAction() {
- @Override
- public java.lang.Object run() throws Exception {
- if (!clM.isAccessible()) {
- clM.setAccessible(true);
- }
- return null;
- }
- });
-
- RestLogging.restLogger.log(Level.FINEST, "Loading bytecode for {0}", className);
- final ClassLoader classLoader = similarClass.getClassLoader();
- //Thread.currentThread().getContextClassLoader();
- // Thread.currentThread().getContextClassLoader();
- try {
- clM.invoke(classLoader, className, byteContent, 0, byteContent.length, pd);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- try {
- return classLoader.loadClass(className);
- } catch (ClassNotFoundException cnfEx) {
- throw new RuntimeException(cnfEx);
- }
- } catch (Exception ex) {
- throw new RuntimeException(ex);
- }
+ RestLogging.restLogger.log(Level.FINEST, "Loading bytecode for {0}", className);
+ return MethodHandles.privateLookupIn(similarClass, MethodHandles.lookup()).defineClass(classBytes);
}
private static synchronized void initBeanValidator() {
diff --git a/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/generator/ASMClassWriter.java b/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/generator/ASMClassWriter.java
index 676952f..473dc3d 100644
--- a/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/generator/ASMClassWriter.java
+++ b/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/generator/ASMClassWriter.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -16,7 +17,9 @@
package org.glassfish.admin.rest.generator;
+import com.sun.ejb.codegen.ClassGenerator;
import com.sun.enterprise.util.SystemPropertyConstants;
+
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -25,29 +28,31 @@
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
+
import org.glassfish.admin.rest.RestLogging;
import org.glassfish.admin.rest.utils.ResourceUtil;
import org.glassfish.hk2.api.ServiceLocator;
import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.MethodVisitor;
-import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
+import static org.objectweb.asm.Opcodes.*;
+
/**
* @author Ludovic Champenois
*/
-public class ASMClassWriter implements ClassWriter, Opcodes {
+public class ASMClassWriter implements ClassWriter {
private final static String INJECTOR_FIELD = "serviceLocator";
private final static String FORNAME_INJECTOR_TYPE = "Lorg/glassfish/hk2/api/ServiceLocator;";
private final static String INTERFACE_INJECTOR_TYPE = "org/glassfish/hk2/api/ServiceLocator";
private final static String CREATE_AND_INITIALIZE = "createAndInitialize";
private final static String CREATE_AND_INITIALIZE_SIG = "(Ljava/lang/Class;)Ljava/lang/Object;";
- private org.objectweb.asm.ClassWriter cw = new org.objectweb.asm.ClassWriter(0);
+ private final org.objectweb.asm.ClassWriter cw = new org.objectweb.asm.ClassWriter(0);
private String className;
private ServiceLocator habitat;
private final String generatedPath;
- private Map<String, String> generatedMethods = new HashMap<String, String>();
+ private final Map<String, String> generatedMethods = new HashMap<>();
// private String baseClassName;
// private String resourcePath;
@@ -441,56 +446,23 @@
return cw.toByteArray();
}
- public String defineClass(Class similarClass, byte[] classBytes) throws Exception {
-
- String generatedClassName = "org.glassfish.admin.rest.resources.generatedASM.";
- generatedClassName = generatedClassName + className;
-
- byte[] byteContent = getByteClass();
+ private void defineClass(Class similarClass, byte[] classBytes) throws Exception {
+ String generatedClassName = "org.glassfish.admin.rest.resources.generatedASM." + className;
+ RestLogging.restLogger.log(Level.FINEST, "Generating class {0}", generatedClassName);
+ ClassLoader loader = similarClass.getClassLoader();
ProtectionDomain pd = similarClass.getProtectionDomain();
-
- java.lang.reflect.Method jm = null;
- for (java.lang.reflect.Method jm2 : ClassLoader.class.getDeclaredMethods()) {
- if (jm2.getName().equals("defineClass") && jm2.getParameterTypes().length == 5) {
- jm = jm2;
- break;
- }
- }
- if (jm == null) {//should never happen, makes findbug happy
- throw new RuntimeException("cannot find method called defineclass...");
- }
- final java.lang.reflect.Method clM = jm;
+ byte[] byteContent = getByteClass();
+ ClassGenerator.defineClass(loader, generatedClassName, byteContent, pd);
try {
- java.security.AccessController.doPrivileged(new java.security.PrivilegedExceptionAction() {
-
- public java.lang.Object run() throws Exception {
- if (!clM.isAccessible()) {
- clM.setAccessible(true);
- }
- return null;
- }
- });
-
- RestLogging.restLogger.log(Level.FINEST, "Loading bytecode for {0}", generatedClassName);
- clM.invoke(similarClass.getClassLoader()
- /*Thread.currentThread().getContextClassLoader()*/, generatedClassName, byteContent, 0, byteContent.length, pd);
-
- try {
- similarClass.getClassLoader().loadClass(generatedClassName);
- } catch (ClassNotFoundException cnfEx) {
- throw new RuntimeException(cnfEx);
- }
-
- return generatedClassName;
- } catch (Exception ex) {
- throw new RuntimeException(ex);
+ loader.loadClass(generatedClassName);
+ } catch (ClassNotFoundException cnfEx) {
+ throw new GeneratorException(cnfEx);
}
-
}
- /*
- dump bytecode in class files so that we can decompile them to check the real content
- */
+ /**
+ * dump bytecode in class files so that we can decompile them to check the real content
+ */
private void debug(String clsName, byte[] classData) {
// the path is horribly long. Let's just write t directly into the
diff --git a/nucleus/common/internal-api/src/main/java/org/glassfish/internal/api/ClassLoaderHierarchy.java b/nucleus/common/internal-api/src/main/java/org/glassfish/internal/api/ClassLoaderHierarchy.java
index 52736ce..f312c78 100644
--- a/nucleus/common/internal-api/src/main/java/org/glassfish/internal/api/ClassLoaderHierarchy.java
+++ b/nucleus/common/internal-api/src/main/java/org/glassfish/internal/api/ClassLoaderHierarchy.java
@@ -26,7 +26,7 @@
import com.sun.enterprise.module.ResolveError;
/**
- * This class is responsible foe creation of class loader hierarchy
+ * This class is responsible for creation of class loader hierarchy
* of an application.
*
* @author Sanjeeb.Sahoo@Sun.COM
@@ -132,7 +132,7 @@
* @return class loader capable of loading public APIs identified by the deployers
* @throws com.sun.enterprise.module.ResolveError if one of the deployer's public API module is not found.
*/
- public ClassLoader createApplicationParentCL(ClassLoader parent, DeploymentContext context)
+ ClassLoader createApplicationParentCL(ClassLoader parent, DeploymentContext context)
throws ResolveError;
}
diff --git a/nucleus/flashlight/framework/src/main/java/org/glassfish/flashlight/impl/core/ProviderImplGenerator.java b/nucleus/flashlight/framework/src/main/java/org/glassfish/flashlight/impl/core/ProviderImplGenerator.java
index 58d6ee7..08f819d 100644
--- a/nucleus/flashlight/framework/src/main/java/org/glassfish/flashlight/impl/core/ProviderImplGenerator.java
+++ b/nucleus/flashlight/framework/src/main/java/org/glassfish/flashlight/impl/core/ProviderImplGenerator.java
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2009, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -21,8 +22,15 @@
* Date: Jul 20, 2008
*/
import com.sun.enterprise.util.SystemPropertyConstants;
-import com.sun.enterprise.util.LocalStringManagerImpl;
import com.sun.enterprise.util.io.FileUtils;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.lang.invoke.MethodHandles;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.glassfish.flashlight.FlashlightLoggerInfo;
import org.glassfish.flashlight.provider.FlashlightProbe;
import org.glassfish.flashlight.provider.ProbeRegistry;
import org.objectweb.asm.ClassWriter;
@@ -32,16 +40,6 @@
import org.objectweb.asm.commons.GeneratorAdapter;
import org.objectweb.asm.commons.Method;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.PrintStream;
-import java.lang.reflect.InvocationTargetException;
-import java.security.PrivilegedActionException;
-import java.security.ProtectionDomain;
-import java.util.logging.Logger;
-import java.util.logging.Level;
-import org.glassfish.flashlight.FlashlightLoggerInfo;
-
public class ProviderImplGenerator {
private static final Logger logger = FlashlightLoggerInfo.getLogger();
@@ -50,49 +48,13 @@
String generatedClassName = provider.getModuleProviderName() + "_Flashlight_" + provider.getModuleName() + "_"
+ "Probe_" + ((provider.getProbeProviderName() == null) ? providerClazz.getName() : provider.getProbeProviderName());
generatedClassName = providerClazz.getName() + "_" + generatedClassName;
-
byte[] classData = generateClassData(provider, providerClazz, generatedClassName);
-
- ProtectionDomain pd = providerClazz.getProtectionDomain();
-
- java.lang.reflect.Method jm = null;
- for (java.lang.reflect.Method jm2 : ClassLoader.class.getDeclaredMethods()) {
- if (jm2.getName().equals("defineClass") && jm2.getParameterTypes().length == 5) {
- jm = jm2;
- break;
- }
- }
-
- if (jm == null)
- throw new RuntimeException();
-
- final java.lang.reflect.Method clM = jm;
try {
- java.security.AccessController.doPrivileged(
- new java.security.PrivilegedExceptionAction() {
- public java.lang.Object run() throws Exception {
- if (!clM.isAccessible()) {
- clM.setAccessible(true);
- }
- return null;
- }
- });
-
- clM.invoke(providerClazz.getClassLoader(), generatedClassName, classData, 0,
- classData.length, pd);
-
+ MethodHandles.privateLookupIn(providerClazz, MethodHandles.lookup()).defineClass(classData);
return generatedClassName;
- }
- catch (PrivilegedActionException pEx) {
- throw new RuntimeException(pEx);
- }
- catch (IllegalAccessException illegalAccessException) {
+ } catch (IllegalAccessException illegalAccessException) {
throw new RuntimeException(illegalAccessException);
}
- catch (InvocationTargetException invtEx) {
- throw new RuntimeException(invtEx);
- }
-
}
public byte[] generateClassData(FlashlightProbeProvider provider, Class providerClazz, String generatedClassName) {
@@ -173,8 +135,9 @@
if (Boolean.parseBoolean(System.getenv("AS_DEBUG"))) {
- if (logger.isLoggable(Level.FINE))
+ if (logger.isLoggable(Level.FINE)) {
logger.fine("Generated ClassDATA " + clsName);
+ }
// the path is horribly long. Let's just write t directly into the
// lib dir. It is not for loading as a class but just for us humans
@@ -183,8 +146,9 @@
clsName = clsName.replace('\\', '/'); // just in case Windows? unlikely...
index = clsName.lastIndexOf("/");
- if (index >= 0)
+ if (index >= 0) {
clsName = clsName.substring(index + 1);
+ }
FileOutputStream fos = null;
try {
String rootPath = System.getProperty(SystemPropertyConstants.INSTALL_ROOT_PROPERTY)
@@ -192,8 +156,9 @@
String fileName = rootPath + clsName + ".class";
- if (logger.isLoggable(Level.FINE))
+ if (logger.isLoggable(Level.FINE)) {
logger.fine("ClassFile: " + fileName);
+ }
File file = new File(fileName);
@@ -208,8 +173,9 @@
}
finally {
try {
- if (fos != null)
+ if (fos != null) {
fos.close();
+ }
}
catch (Exception e) {
// nothing can be done...
diff --git a/runtests.sh b/runtests.sh
index ae2c957..f3d3ad0 100755
--- a/runtests.sh
+++ b/runtests.sh
@@ -22,8 +22,9 @@
echo "Second argument is a test set id, one of:
cdi_all, ql_gf_full_profile_all, \n
\n
-web_jsp, deployment_all, ejb_group_1
-ejb_group_2, ejb_group_3, ejb_web_all, cdi_all, ql_gf_full_profile_all, ql_gf_nucleus_all, \
+web_jsp, deployment_all, \n
+ejb_group_1. ejb_group_2, ejb_group_3, ejb_group_embedded, \n
+cdi_all, ql_gf_full_profile_all, ql_gf_nucleus_all, \
ql_gf_web_profile_all, nucleus_admin_all, jdbc_all, batch_all, persistence_all, \
connector_group_1, connector_group_2, connector_group_3, connector_group_4";