Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, 2025 Contributors to the Eclipse Foundation
* Copyright (c) 2023, 2026 Contributors to the Eclipse Foundation
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -40,7 +40,7 @@
import org.glassfish.appclient.client.acc.config.TargetServer;
import org.glassfish.appclient.client.acc.config.util.XML;
import org.glassfish.embeddable.client.UserError;
import org.glassfish.enterprise.iiop.api.GlassFishORBHelper;
import org.glassfish.enterprise.iiop.api.GlassFishORBFactory;
import org.xml.sax.SAXException;

import static java.util.logging.Level.CONFIG;
Expand Down Expand Up @@ -87,8 +87,6 @@ public class AppClientContainerBuilder implements AppClientContainer.Builder {

private boolean sendPassword = true;

private GlassFishORBHelper orbHelper;

/** caller-provided message security configurations */
private final List<MessageSecurityConfig> messageSecurityConfigs = new ArrayList<>();

Expand Down Expand Up @@ -181,7 +179,6 @@ private CallbackHandler getCallbackHandlerFromDescriptor(final String callbackHa

private void prepareHabitat() throws URISyntaxException {
ACCModulesManager.initialize(Thread.currentThread().getContextClassLoader());
orbHelper = ACCModulesManager.getService(GlassFishORBHelper.class);
}

/**
Expand Down Expand Up @@ -218,11 +215,10 @@ private void prepareIIOP(final TargetServer[] targetServers, Properties containe
}

if (isSSLRequired(targetServers, containerProperties)) {
orbHelper.setCSIv2Prop(ORB_SSL_CLIENT_REQUIRED, "true");
ACCModulesManager.getService(GlassFishORBFactory.class).setCSIv2Prop(ORB_SSL_CLIENT_REQUIRED, "true");
}

logger.log(CONFIG, "Using endpoint address(es): {0}", sb.toString());

}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2025 Contributors to the Eclipse Foundation.
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand All @@ -24,7 +25,8 @@
import org.glassfish.appclient.client.acc.config.Security;
import org.glassfish.appclient.client.acc.config.TargetServer;
import org.glassfish.embeddable.client.UserError;
import org.glassfish.enterprise.iiop.api.GlassFishORBHelper;

import static org.glassfish.internal.api.ORBLocator.DEFAULT_ORB_INIT_PORT;

/**
* Encapsulates the logic for deciding what TargetServer objects to use for
Expand All @@ -34,7 +36,7 @@
*/
public class TargetServerHelper {

private static int DEFAULT_ENDPOINT_PORT = Integer.parseInt(GlassFishORBHelper.DEFAULT_ORB_INIT_PORT);
private static int DEFAULT_ENDPOINT_PORT = Integer.parseInt(DEFAULT_ORB_INIT_PORT);
private static final String SSL_PROPERTY_NAME = "ssl";


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Contributors to the Eclipse Foundation
* Copyright (c) 2023, 2025 Contributors to the Eclipse Foundation
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -245,7 +245,9 @@ public void clean(DeploymentContext dc) {
if (params != null) {
final com.sun.enterprise.config.serverbeans.Application app =
applications.getApplication(params.name);
DeploymentUtils.downloadableArtifacts(app).clearArtifacts();
if (app != null) {
DeploymentUtils.downloadableArtifacts(app).clearArtifacts();
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Contributors to the Eclipse Foundation
* Copyright (c) 2023, 2026 Contributors to the Eclipse Foundation
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -382,28 +382,25 @@ private Properties prepareRequestPlaceholders(
* @return
*/
private String targetServerSetting(final Properties props) {
String result = null;
try {
result = orbFactory.getIIOPEndpoints();
} catch (NullPointerException npe) {
/*
* orbFactory.getIIOPEndpoints is supposed to return a valid
* answer whether this server is in a cluster or not. A bug
* causes it to throw a NullPointerException in the non-cluster case.
* So catch that and use the configured listener for this server.
*
* Find the IIOP listener with the default listener ID.
*/
String port = null;
for (IiopListener listener : iiopService.getIiopListener()) {
if (listener.getId().equals(DEFAULT_ORB_LISTENER_ID)) {
port = listener.getPort();
break;
}
String result = orbFactory.getIIOPEndpoints();
if (result != null) {
return result;
}
/*
* orbFactory.getIIOPEndpoints is supposed to return a valid
* answer whether this server is in a cluster or not. A bug
* causes it to throw a NullPointerException in the non-cluster case.
* So catch that and use the configured listener for this server.
* Find the IIOP listener with the default listener ID.
*/
String port = null;
for (IiopListener listener : iiopService.getIiopListener()) {
if (listener.getId().equals(DEFAULT_ORB_LISTENER_ID)) {
port = listener.getPort();
break;
}
result = props.getProperty("request.host") + ":" + port;
}
return result;
return props.getProperty("request.host") + ":" + port;
}

private void processQueryParameters(String queryString, final Properties answer) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Contributors to the Eclipse Foundation
* Copyright (c) 2022, 2025 Contributors to the Eclipse Foundation.
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -33,7 +33,7 @@
import org.glassfish.api.invocation.ComponentInvocation;
import org.glassfish.api.invocation.InvocationManager;
import org.glassfish.api.naming.SimpleJndiName;
import org.glassfish.enterprise.iiop.api.GlassFishORBHelper;
import org.glassfish.internal.api.ORBLocator;
import org.jvnet.hk2.annotations.Service;
import org.omg.CORBA.ORB;

Expand All @@ -48,10 +48,10 @@
public class EjbNamingReferenceManagerImpl implements EjbNamingReferenceManager {

@Inject
InvocationManager invMgr;
private InvocationManager invMgr;

@Inject
Provider<GlassFishORBHelper> glassFishORBHelperProvider;
private Provider<ORBLocator> orbLocatorProvider;

@Override
public Object resolveEjbReference(EjbReferenceDescriptor ejbRefDesc, Context context)
Expand Down Expand Up @@ -119,22 +119,17 @@ public Object resolveEjbReference(EjbReferenceDescriptor ejbRefDesc, Context con

ClassLoader origClassLoader = Utility.getClassLoader();
boolean setCL = false;

try {

try {

String refInterface = ejbRefDesc.isEJB30ClientView() ?
ejbRefDesc.getEjbInterface() : ejbRefDesc.getHomeClassName();
String refInterface = ejbRefDesc.isEJB30ClientView()
? ejbRefDesc.getEjbInterface()
: ejbRefDesc.getHomeClassName();
origClassLoader.loadClass(refInterface);

} catch(ClassNotFoundException e) {

ClassLoader referringBundleClassLoader =
ejbRefDesc.getReferringBundleDescriptor().getClassLoader();
Utility.setContextClassLoader(referringBundleClassLoader);
setCL = true;

} catch (ClassNotFoundException e) {
ClassLoader referringBundleClassLoader = ejbRefDesc.getReferringBundleDescriptor().getClassLoader();
Utility.setContextClassLoader(referringBundleClassLoader);
setCL = true;
}

/* For remote ejb refs, first lookup the target remote object
Expand All @@ -147,8 +142,7 @@ public Object resolveEjbReference(EjbReferenceDescriptor ejbRefDesc, Context con
* MEJB resolution for cluster support post V3 FCS.
*/
if (remoteJndiName.hasCorbaPrefix()) {
GlassFishORBHelper orbHelper = glassFishORBHelperProvider.get();
ORB orb = orbHelper.getORB();
ORB orb = orbLocatorProvider.get().getORB();
jndiObj = orb.string_to_object(remoteJndiName.toString());
} else {
jndiObj = context.lookup(remoteJndiName.toString());
Expand Down Expand Up @@ -190,17 +184,13 @@ public Object getEJBContextObject(String contextType) {

if(currentInv == null) {
throw new IllegalStateException("no current invocation");
} else if (currentInv.getInvocationType() !=
ComponentInvocation.ComponentInvocationType.EJB_INVOCATION) {
throw new IllegalStateException
("Illegal invocation type for EJB Context : "
+ currentInv.getInvocationType());
} else if (currentInv.getInvocationType() != ComponentInvocation.ComponentInvocationType.EJB_INVOCATION) {
throw new IllegalStateException(
"Illegal invocation type for EJB Context : " + currentInv.getInvocationType());
}

EjbInvocation ejbInv = (EjbInvocation) currentInv;

Object returnObject = ejbInv.context;

if (contextType.equals("jakarta.ejb.TimerService")) {
if (EJBTimerService.getEJBTimerService() == null) {
throw new IllegalStateException("EJB Timer Service not available");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2025 Contributors to the Eclipse Foundation
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand All @@ -25,7 +26,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;

import org.glassfish.enterprise.iiop.api.GlassFishORBHelper;
import org.glassfish.enterprise.iiop.api.GlassFishORBLocator;
import org.glassfish.enterprise.iiop.api.ProtocolManager;
import org.glassfish.internal.api.Globals;

Expand Down Expand Up @@ -69,14 +70,8 @@ public Object resolveObject(Object obj)
}
}

/**
* Do all ProtocolManager access lazily and only request orb if it has already been
* initialized so that code doesn't make the assumption that an orb is available in
* this runtime.
*/
private ProtocolManager getProtocolManager() {
GlassFishORBHelper orbHelper = Globals.getDefaultHabitat().getService(GlassFishORBHelper.class);
return orbHelper.isORBInitialized() ? orbHelper.getProtocolManager() : null;
GlassFishORBLocator orbLocator = Globals.getDefaultHabitat().getService(GlassFishORBLocator.class);
return orbLocator.getProtocolManager();
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2022 Contributors to the Eclipse Foundation
* Copyright (c) 2021, 2025 Contributors to the Eclipse Foundation.
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -40,7 +40,7 @@

import org.glassfish.api.naming.GlassfishNamingManager;
import org.glassfish.api.naming.SimpleJndiName;
import org.glassfish.enterprise.iiop.api.GlassFishORBHelper;
import org.glassfish.enterprise.iiop.api.GlassFishORBLocator;
import org.glassfish.enterprise.iiop.api.ProtocolManager;
import org.glassfish.internal.api.Globals;

Expand Down Expand Up @@ -92,14 +92,9 @@ public Object replaceObject(Object obj) throws IOException {
}


/**
* Do all ProtocolManager access lazily and only request orb if it has already been
* initialized so that code doesn't make the assumption that an orb is available in
* this runtime.
*/
private ProtocolManager getProtocolManager() {
GlassFishORBHelper orbHelper = Globals.getDefaultHabitat().getService(GlassFishORBHelper.class);
return orbHelper.isORBInitialized() ? orbHelper.getProtocolManager() : null;
GlassFishORBLocator orbLocator = Globals.getDefaultHabitat().getService(GlassFishORBLocator.class);
return orbLocator.getProtocolManager();
}


Expand Down Expand Up @@ -199,7 +194,7 @@ protected static java.rmi.Remote doRemoteRefClassLoaderConversion(final java.rmi
byte[] serializedRef = EJBObjectOutputStreamHandler._javaEEIOUtils.serializeObject(reference, false);
Remote returnReference = (java.rmi.Remote) EJBObjectOutputStreamHandler._javaEEIOUtils
.deserializeObject(serializedRef, false, contextClassLoader);
GlassFishORBHelper orbHelper = EjbContainerUtilImpl.getInstance().getORBHelper();
GlassFishORBLocator orbHelper = EjbContainerUtilImpl.getInstance().getOrbLocator();
ProtocolManager protocolMgr = orbHelper.getProtocolManager();
protocolMgr.connectObject(returnReference);
return returnReference;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@
import org.glassfish.ejb.deployment.descriptor.EjbSessionDescriptor;
import org.glassfish.ejb.spi.EjbContainerInterceptor;
import org.glassfish.ejb.spi.WSEjbEndpointRegistry;
import org.glassfish.enterprise.iiop.api.GlassFishORBHelper;
import org.glassfish.enterprise.iiop.api.ProtocolManager;
import org.glassfish.enterprise.iiop.api.RemoteReferenceFactory;
import org.glassfish.enterprise.iiop.spi.EjbContainerFacade;
Expand Down Expand Up @@ -565,7 +564,7 @@ protected BaseContainer(final ContainerType type, final EjbDescriptor ejbDesc, f

if (ejbDescriptor.isRemoteInterfacesSupported() || ejbDescriptor.isRemoteBusinessInterfacesSupported()) {
assertFullProfile("exposes a Remote client view");
initializeProtocolManager();
this.protocolMgr = initializeOrb(ejbContainerUtilImpl);
}

if (ejbDescriptor.isRemoteInterfacesSupported()) {
Expand Down Expand Up @@ -627,7 +626,7 @@ protected BaseContainer(final ContainerType type, final EjbDescriptor ejbDesc, f
localBusinessHomeIntf = GenericEJBLocalHome.class;

for (String next : ejbDescriptor.getLocalBusinessClassNames()) {
Class clz = loader.loadClass(next);
Class<?> clz = loader.loadClass(next);
localBusinessIntfs.add(clz);
addToGeneratedMonitoredMethodInfo(clz);
}
Expand All @@ -638,7 +637,7 @@ protected BaseContainer(final ContainerType type, final EjbDescriptor ejbDesc, f
hasOptionalLocalBusinessView = true;

ejbOptionalLocalBusinessHomeIntf = GenericEJBLocalHome.class;
Class clz = loader.loadClass(ejbDescriptor.getEjbClassName());
Class<?> clz = loader.loadClass(ejbDescriptor.getEjbClassName());
addToGeneratedMonitoredMethodInfo(clz);

this.optIntfClassName = EJBUtils.getGeneratedOptionalInterfaceName(ejbClass.getName());
Expand Down Expand Up @@ -763,20 +762,17 @@ private void addToGeneratedMonitoredMethodInfo(Class generatedClass) {
monitoredGeneratedClasses.add(generatedClass);
}

protected void initializeProtocolManager() {
private static ProtocolManager initializeOrb(EjbContainerUtil ejbContainerUtil) {
try {
GlassFishORBHelper orbHelper = ejbContainerUtilImpl.getORBHelper();
protocolMgr = orbHelper.getProtocolManager();

} catch (Throwable t) {
return ejbContainerUtil.getOrbLocator().getProtocolManager();
} catch (Exception e) {
throw new RuntimeException(
"IIOP Protocol Manager initialization failed. " + "Possible cause is that ORB is not available in this "
+ ((ejbContainerUtilImpl.isEmbeddedServer())
? "embedded container, or server instance is running and required ports are in use"
: "container"),
t);
"IIOP Protocol Manager initialization failed. Possible cause is that ORB is not available in this "
+ (ejbContainerUtil.isEmbeddedServer()
? "embedded container, or server instance is running and required ports are in use"
: "container"),
e);
}

}

protected void preInitialize(EjbDescriptor ejbDesc, ClassLoader loader) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Contributors to the Eclipse Foundation
* Copyright (c) 2022, 2025 Contributors to the Eclipse Foundation.
* Copyright (c) 2008, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -38,7 +38,7 @@
import org.glassfish.api.naming.GlassfishNamingManager;
import org.glassfish.ejb.config.EjbContainer;
import org.glassfish.ejb.config.EjbTimerService;
import org.glassfish.enterprise.iiop.api.GlassFishORBHelper;
import org.glassfish.enterprise.iiop.api.GlassFishORBLocator;
import org.glassfish.flashlight.provider.ProbeProviderFactory;
import org.glassfish.hk2.api.ServiceLocator;
import org.glassfish.internal.api.ServerContext;
Expand All @@ -64,7 +64,7 @@ public interface EjbContainerUtil {
// Used by the TimerService upgrade
String TIMER_SERVICE_UPGRADED = "ejb-timer-service-upgraded";

GlassFishORBHelper getORBHelper();
GlassFishORBLocator getOrbLocator();

ServiceLocator getServices();

Expand Down
Loading
Loading