AnsweredAssumed Answered

How to get the Spring context that is already running?

Question asked by raarm on Jan 16, 2008
Latest reply on Jan 16, 2008 by pmonks
Hi everyone,

I use this code in my application:

ApplicationContext ctx = ApplicationContextHelper.getApplicationContext();
ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
AuthenticationService authenticationService = serviceRegistry.getAuthenticationService();
authenticationService.authenticate("admin", "admin".toCharArray());
………..
       

when I compile this code occur a exception:

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serverConnector' defined in class path resource [alfresco/core-services-context.xml]: Invocation of init method failed; nested exception is java.io.IOException: Cannot bind to URL [rmi://localhost:50500/alfresco/jmxrmi]: javax.naming.NameAlreadyBoundException: alfresco/jmxrmi [Root exception is java.rmi.AlreadyBoundException: alfresco/jmxrmi]
Caused by: java.io.IOException: Cannot bind to URL [rmi://localhost:50500/alfresco/jmxrmi]: javax.naming.NameAlreadyBoundException: alfresco/jmxrmi [Root exception is java.rmi.AlreadyBoundException: alfresco/jmxrmi]

I don´t wanna stop my Alfresco server!!! I think that……I need to get the instance or registry that is already running…..How to get this context?? Today my application is running in the same localhost that Alfresco server but I want to use this code in applets.

Thanks :roll:

Outcomes