Hi,
I'm not sure I completely understand what you are trying to do.
You mention that you want to execute some code when the server starts up but it needs to be able to access the deployed EAR. So maybe you want to perform some action when the EAR is started (and not the server)?
Executing code during startup and shutdown of the application can be done through an Initializing Singleton bean within your application.
@Singleton
@Startup
public class AtStartupAndShutdown {
@PostConstruct
public void atStartup() {}
@PreDestroy
public void atShutdown() {}
}
Regards
Rudy