Saturday, March 14, 2015

BeanFactory not initialized or already closed Error Fix For ActiveMQ In Windows

Are you getting same kind of exceptions as below while starting Apache ActiveMQ in Windows?
Caused by: java.io.IOException: Failed to bind to server socket: tcp://0.0.0.0:61616?maximumConnections=1000&wireformat.maxFrameSize=104857600 due to: java.net.BindException: Address already in use: JVM_Bind
        at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:33)
        at org.apache.activemq.transport.tcp.TcpTransportServer.bind(TcpTransportServer.java:135)
        at org.apache.activemq.transport.tcp.TcpTransportFactory.doBind(TcpTransportFactory.java:56)
        at org.apache.activemq.transport.TransportFactorySupport.bind(TransportFactorySupport.java:40)
        at org.apache.activemq.broker.TransportConnector.createTransportServer(TransportConnector.java:307)
        at org.apache.activemq.broker.TransportConnector.getServer(TransportConnector.java:139)
        at org.apache.activemq.broker.TransportConnector.asManagedConnector(TransportConnector.java:106)
        at org.apache.activemq.broker.BrokerService.registerConnectorMBean(BrokerService.java:1965)

Caused by: java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
        at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:172)
        at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1078)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
        at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:64)
        at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:52)
        at org.apache.activemq.xbean.XBeanBrokerFactory$1.<init>(XBeanBrokerFactory.java:101)
        at org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:101)
        at org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:65)
        at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71)
        at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54)
        at org.apache.activemq.console.command.StartCommand.startBroker(StartCommand.java:125)
        at org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:84)

That has most probably happened due to Internet Connection Sharing (ICS) service if you are using Windows 7. This service happens to run on same port as ActiveMQ. So if it starts before ActiveMQ launch, ActiveMQ will throw exception during start up. I used to get this error intermittently in my Windows Laptop because in one network adapter ICS was enabled. I disabled it as I didn't require it. From then on, I never had any issues.

Tuesday, March 10, 2015

Fix jre.msi Missing Issue While Uninstalling Java From Windows

While trying to uninstall java you are getting message like below:
The feature you are trying to use is on a
network resource that is unavailable.

Click OK to try again, or enter an alternate path to a
folder containing installation package 'jre.msi' in the
box below.
I got this message in Windows 7. I tried to uninstall Java 7 from my laptop. After uninstall, I got some message that a restart was required to complete the changes. I chose to do it later. After some time when I restarted Windows, I still saw Java 7 in installed programs list in Control Panel. And when I tried to uninstall it again I got above message and couldn't finish uninstall process.



I found a solution by using Microsoft Fix it utility software for programs that cannot be installed or uninstalled. I ran the program. It searched for all the programs that can be uninstalled. After I selected my corrupted Java installation from the list, it cleaned up the existing installation. This program fixed corrupted registries and also removed the program from Control Panel programs list.