Graph API - ClosedChannelException - java

I am getting the ClosedChannelException error while sending a mail using Graph API.
I know the connection parameters are correct as it works fine when I tried via postman.
Also my old code with graph API 1.6.0 is working fine. I am trying to upgrade it to 5.45.0.
Does anyone have any idea what the issue could be? Code looks correct to me. So I tried changing the dependent jar versions too but so far nothing worked.
I used the following code with TokenCredentialAuthProvider.
https://github.com/microsoftgraph/microsoft-graph-docs/blob/main/api-reference/v1.0/includes/snippets/java/user-sendmail-with-attachment-java-snippets.md
Versions used:
microsoft-graph - 5.45.0
azure-identity - 1.7.3
reactor-core - 3.5.2
reactor-netty - 1.1.2
netty-all - 4.1.87.Final
com.microsoft.graph.core.ClientException: Error executing the request
at com.microsoft.graph.http.CoreHttpProvider.sendRequestInternal(CoreHttpProvider.java:410)
at com.microsoft.graph.http.CoreHttpProvider.send(CoreHttpProvider.java:225)
at com.microsoft.graph.http.CoreHttpProvider.send(CoreHttpProvider.java:202)
at com.microsoft.graph.http.BaseRequest.send(BaseRequest.java:335)
at com.microsoft.graph.requests.UserSendMailRequest.post(UserSendMailRequest.java:54)
at com.test.GraphProducer.sendEmail(GraphProducer.java:151)
.....................
Caused by: java.io.IOException: java.util.concurrent.ExecutionException: com.microsoft.aad.msal4j.MsalClientException: reactor.core.Exceptions$ReactiveException: java.nio.channels.ClosedChannelException
at com.microsoft.graph.httpcore.AuthenticationHandler.intercept(AuthenticationHandler.java:67)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
.....................
at com.microsoft.graph.http.CoreHttpProvider.sendRequestInternal(CoreHttpProvider.java:407)
... 52 more
Caused by: java.util.concurrent.ExecutionException: com.microsoft.aad.msal4j.MsalClientException: reactor.core.Exceptions$ReactiveException: java.nio.channels.ClosedChannelException
.....................
at com.microsoft.graph.httpcore.AuthenticationHandler.intercept(AuthenticationHandler.java:55)
... 60 more
Caused by: com.microsoft.aad.msal4j.MsalClientException: reactor.core.Exceptions$ReactiveException: java.nio.channels.ClosedChannelException
at com.microsoft.aad.msal4j.HttpHelper.executeHttpRequest(HttpHelper.java:53)
.....................
Caused by: reactor.core.Exceptions$ReactiveException: java.nio.channels.ClosedChannelException
at reactor.core.Exceptions.propagate(Exceptions.java:408)
at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:97)
at reactor.core.publisher.Mono.block(Mono.java:1710)
at com.azure.core.http.HttpClient.sendSync(HttpClient.java:42)
.....................
at com.microsoft.aad.msal4j.HttpHelper.executeHttpRequestWithRetries(HttpHelper.java:96)
at com.microsoft.aad.msal4j.HttpHelper.executeHttpRequest(HttpHelper.java:49)
... 16 more
Suppressed: java.lang.Exception: #block terminated with an error
at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:99)
... 34 more
Suppressed: reactor.core.Exceptions$ReactiveException: java.nio.channels.ClosedChannelException
at reactor.core.Exceptions.propagate(Exceptions.java:408)
at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:97)
at reactor.core.publisher.Mono.block(Mono.java:1710)
at com.azure.core.http.HttpClient.sendSync(HttpClient.java:42)
.....................
... 25 more
Suppressed: java.lang.Exception: #block terminated with an error
at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:99)
... 31 more
Caused by: java.nio.channels.ClosedChannelException
at io.netty.channel.AbstractChannel$AbstractUnsafe.newClosedChannelException(AbstractChannel.java:957)
.....................
at java.lang.Thread.run(Thread.java:745)
Suppressed: reactor.core.Exceptions$ReactiveException: java.nio.channels.ClosedChannelException
at reactor.core.Exceptions.propagate(Exceptions.java:408)
at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:97)
at reactor.core.publisher.Mono.block(Mono.java:1710)
at com.azure.core.http.HttpClient.sendSync(HttpClient.java:42)
.....................
... 26 more
Suppressed: java.lang.Exception: #block terminated with an error
at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:99)
... 32 more
Caused by: java.nio.channels.ClosedChannelException
at io.netty.channel.AbstractChannel$AbstractUnsafe.newClosedChannelException(AbstractChannel.java:957)
.....................
at java.lang.Thread.run(Thread.java:745)
Suppressed: reactor.core.Exceptions$ReactiveException: java.nio.channels.ClosedChannelException
at reactor.core.Exceptions.propagate(Exceptions.java:408)
at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:97)
at reactor.core.publisher.Mono.block(Mono.java:1710)
at com.azure.core.http.HttpClient.sendSync(HttpClient.java:42)
.....................
... 27 more
Suppressed: java.lang.Exception: #block terminated with an error
at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:99)
... 33 more
Caused by: java.nio.channels.ClosedChannelException
at io.netty.channel.AbstractChannel$AbstractUnsafe.newClosedChannelException(AbstractChannel.java:957)
at io.netty.channel.AbstractChannel$AbstractUnsafe.ensureOpen(AbstractChannel.java:976)
.....................
Caused by: java.nio.channels.ClosedChannelException
at io.netty.channel.AbstractChannel$AbstractUnsafe.newClosedChannelException(AbstractChannel.java:957)
at io.netty.channel.AbstractChannel$AbstractUnsafe.ensureOpen(AbstractChannel.java:976)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.connect(AbstractNioChannel.java:237)
at io.netty.channel.DefaultChannelPipeline$HeadContext.connect(DefaultChannelPipeline.java:1342)
at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:548)
at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:533)
at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:517)
at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:457)
at io.netty.channel.DefaultChannelPipeline.connect(DefaultChannelPipeline.java:942)
at io.netty.channel.AbstractChannel.connect(AbstractChannel.java:217)
at reactor.netty.transport.TransportConnector.lambda$doConnect$8(TransportConnector.java:240)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:745)
Update on '03Feb2022':
I tried the below code to check if token part is working and found out that it is throwing the same error.
IAuthenticationProvider authProvider = new TokenCredentialAuthProvider(scopes, clientSecretCredential);
java.net.URL url = new java.net.URL("https://graph.microsoft.com/v1.0/users");
String token = authProvider.getAuthorizationTokenAsync(url).get();

It was a version conflict issue. Used netty-all - 4.1.80.Final version in maven to fix it.

Related

Spring integration Sftp inbound adapter getting unknown host exception intermittently

How do I gracefully log the error message generated by my spring integration sftp inbound adapter ? I don’t see any advice object configuration for it. Plus is there a way to get rid of intermittent session unknown host exception. This happens every other week.
Caused by: org.springframework.integration.util.PoolItemNotAvailableException: Failed to obtain pooled item
at org.springframework.integration.util.SimplePool.getItem(SimplePool.java:190)
at org.springframework.integration.file.remote.session.CachingSessionFactory.getSession(CachingSessionFactory.java:134)
at org.springframework.integration.file.remote.RemoteFileTemplate.execute(RemoteFileTemplate.java:447)
... 38 more
Caused by: java.lang.IllegalStateException: failed to create SFTP Session
at org.springframework.integration.sftp.session.DefaultSftpSessionFactory.getSession(DefaultSftpSessionFactory.java:404)
at org.springframework.integration.sftp.session.DefaultSftpSessionFactory.getSession(DefaultSftpSessionFactory.java:61)
at org.springframework.integration.file.remote.session.CachingSessionFactory$1.createForPool(CachingSessionFactory.java:85)
at org.springframework.integration.file.remote.session.CachingSessionFactory$1.createForPool(CachingSessionFactory.java:82)
at org.springframework.integration.util.SimplePool.doGetItem(SimplePool.java:200)
at org.springframework.integration.util.SimplePool.doGetItem(SimplePool.java:211)
at org.springframework.integration.util.SimplePool.getItem(SimplePool.java:181)
... 40 more
Caused by: java.lang.IllegalStateException: failed to connect
at org.springframework.integration.sftp.session.SftpSession.connect(SftpSession.java:303)
at org.springframework.integration.sftp.session.DefaultSftpSessionFactory.getSession(DefaultSftpSessionFactory.java:398)
... 46 more
Caused by: com.jcraft.jsch.JSchException: java.net.UnknownHostException: XXXXXXXXXXXX.com
at com.jcraft.jsch.Util.createSocket(Util.java:349)
at com.jcraft.jsch.Session.connect(Session.java:215)
at com.jcraft.jsch.Session.connect(Session.java:183)
at org.springframework.integration.sftp.session.SftpSession.connect(SftpSession.java:294)
... 47 more
Caused by: java.net.UnknownHostException: XXXXXXXXXXX.com
at java.base/java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.base/java.net.SocksSocketImpl.connect(Unknown Source)
at java.base/java.net.Socket.connect(Unknown Source)
at java.base/java.net.Socket.connect(Unknown Source)
at java.base/java.net.Socket.<init>(Unknown Source)
at java.base/java.net.Socket.<init>(Unknown Source)
at com.jcraft.jsch.Util.createSocket(Util.java:343)
... 50 more

ava.lang.ClassNotFoundException: org.apache.juli.logging.LogFactory

I dont know what to provide to solve this problem but here's the log.
Im running this on apache tomcat 10.0.6
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory
at org.apache.catalina.util.LifecycleBase.(LifecycleBase.java:39)
Caused by: java.lang.ClassNotFoundException: org.apache.juli.logging.LogFactory
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:636)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:182)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519)
... 1 more

Upgrading jdk from 8u221 to 8u241 getting java.net.SocketException: Broken pipe (Write failed) exception

After upgrading JDK8 from 8u221 to 8u241(Minor version change) getting below exception. Please tell me where it went wrong but it is working in 8u231. Please guide me
WARNING: Unable to synchronize with remote stored reports. Some stored report might not be available.
com.watch4net.apg.report.scheduling.gui.ReportSchedulerNotAvailableException: Unable to connect to the Task-Scheduler with URL 'https://localhost:48443/'!
at com.watch4net.apg.report.scheduling.gui.TaskReportScheduler.updateTaskSchedulerModule(TaskReportScheduler.java:300)
at com.watch4net.apg.report.scheduling.gui.TaskReportScheduler.setTaskSchedulerConnection(TaskReportScheduler.java:170)
at com.watch4net.apg.report.scheduling.gui.ReportSchedulerUtils.getReportSchedulerIfAvailable(ReportSchedulerUtils.java:130)
at com.watch4net.apg.report.scheduling.gui.ReportSchedulerUtils.isSchedulerServerDisabled(ReportSchedulerUtils.java:268)
at com.watch4net.apg.v2.gui.stats.FrontendStats.initialize(FrontendStats.java:156)
at com.watch4net.apg.v2.gui.stats.FrontendStats$ApplicationListener.onStartup(FrontendStats.java:116)
at com.watch4net.apg.common.util.ApplicationListenerUtils.startup(ApplicationListenerUtils.java:54)
at com.watch4net.apg.v2.gui.servlet.listener.ApgListener.contextInitialized(ApgListener.java:741)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4699)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5165)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:614)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1823)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: com.watch4net.apg.report.scheduling.gui.ReportSchedulerNotAvailableException: Unable to retrieve the 'task-scheduler' module!
at com.watch4net.apg.report.scheduling.gui.WebserviceCommunicator.getTaskSchedulerModule(WebserviceCommunicator.java:82)
at com.watch4net.apg.report.scheduling.gui.TaskReportScheduler.updateTaskSchedulerModule(TaskReportScheduler.java:296)
... 20 more
Caused by: com.sun.xml.internal.ws.client.ClientTransportException: HTTP transport error: java.net.SocketException: Broken pipe (Write failed)
at com.sun.xml.internal.ws.transport.http.client.HttpClientTransport.getOutput(HttpClientTransport.java:117)
at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:208)
at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:130)
at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:124)
at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:1121)
at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:1035)
at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:1004)
at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:862)
at com.sun.xml.internal.ws.client.Stub.process(Stub.java:448)
at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:178)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:93)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:77)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:147)
at com.sun.proxy.$Proxy42.getModules(Unknown Source)
at com.watch4net.apg.report.scheduling.gui.WebserviceCommunicator.getTaskSchedulerModule(WebserviceCommunicator.java:70)
... 21 more
Caused by: java.net.SocketException: Broken pipe (Write failed)
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111)
at java.net.SocketOutputStream.write(SocketOutputStream.java:155)
at sun.security.ssl.OutputRecord.writeBuffer(OutputRecord.java:431)
at sun.security.ssl.OutputRecord.write(OutputRecord.java:417)
at sun.security.ssl.SSLSocketImpl.writeRecordInternal(SSLSocketImpl.java:879)
at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:850)
at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:720)
at sun.security.ssl.Handshaker.sendChangeCipherSpec(Handshaker.java:1144)
at sun.security.ssl.ClientHandshaker.sendChangeCipherAndFinish(ClientHandshaker.java:1281)
at sun.security.ssl.ClientHandshaker.serverHelloDone(ClientHandshaker.java:1191)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:369)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1037)
at sun.security.ssl.Handshaker.process_record(Handshaker.java:965)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1064)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1367)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1395)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1379)
at`enter code here` sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1340)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1315)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:264)
at com.sun.xml.internal.ws.transport.http.client.HttpClientTransport.getOutput(HttpClientTransport.java:104)
... 35 more

Caused by: java.lang.NoClassDefFoundError: org/mozilla/javascript/ScriptOrFnNode

I have installed BIRT modules in Eclipse but while generating Preview I am getting below error.
I am not sure where should i place js.jar file on the file system.
Please advise.
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.eclipse.birt.report.service.api.ReportServiceException: Error happened while running the report.
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:org.eclipse.birt.report.service.api.ReportServiceException: Error happened while running the report.
at Caused by: java.lang.NoClassDefFoundError: org/mozilla/javascript/ScriptOrFnNode
at org.eclipse.birt.data.engine.impl.PreparedQuery.<init>(PreparedQuery.java:100)
at org.eclipse.birt.data.engine.impl.PreparedDataSourceQuery.<init>(PreparedDataSourceQuery.java:75)
at org.eclipse.birt.data.engine.impl.PreparedOdaDSQuery.<init>(PreparedOdaDSQuery.java:76)
at org.eclipse.birt.data.engine.impl.PreparedQueryUtil.newInstance(PreparedQueryUtil.java:211)
at org.eclipse.birt.data.engine.impl.DataEngineImpl.prepare(DataEngineImpl.java:426)
at org.eclipse.birt.report.data.adapter.impl.DataRequestSessionImpl.prepare(DataRequestSessionImpl.java:473)
at org.eclipse.birt.report.data.adapter.impl.DataRequestSessionImpl.prepare(DataRequestSessionImpl.java:673)
at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.doPrepareQuery(AbstractDataEngine.java:226)
at org.eclipse.birt.report.engine.data.dte.DteDataEngine.doPrepareQuery(DteDataEngine.java:272)
at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.prepare(AbstractDataEngine.java:182)
at org.eclipse.birt.report.engine.executor.ReportExecutor.execute(ReportExecutor.java:122)
at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportExecutor.execute(WrappedReportExecutor.java:60)
at org.eclipse.birt.report.engine.internal.executor.dup.SuppressDuplciateReportExecutor.execute(SuppressDuplciateReportExecutor.java:42)
at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportExecutor.execute(WrappedReportExecutor.java:60)
at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportExecutor.execute(LocalizedReportExecutor.java:61)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:179)
... 40 more
Caused by: java.lang.ClassNotFoundException: org.mozilla.javascript.ScriptOrFnNode cannot be found by org.eclipse.birt.data_4.4.2.v201501161327
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:439)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:352)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:344)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 56 more
This is due to a bug. Updating will solve the issue.

ActiveMQ: No suitable Log constructor

I'm trying to run ActiveMQ on Mac OSX 10.5.7. I have Java version 1.5.0_19 and ActiveMQ 5.2.0. Below is the exception I get when running bin/activemq. It seems to be unable to find Log4j which is odd considering it comes with ActiveMQ and is definitely in the lib/optional directory. The only thing I can think of is that I have a conflict somewhere, but I can't imagine how this is possible. If anyone has any tips whatsoever I'm all ears. Googling produced almost no results with the same error, and the one person who has the exact error doesn't have a solution.
brad-robertsons-macbook-pro:apache-activemq-5.2.0
bradrobertson$ ./bin/activemq
ACTIVEMQ_HOME: /Users/bradrobertson/Java/apache-activemq-5.2.0
ACTIVEMQ_BASE: /Users/bradrobertson/Java/apache-activemq-5.2.0
Loading message broker from: xbean:activemq.xml
ERROR: java.lang.RuntimeException: Failed to execute start task. Reason: java.io.IOException: Could not load xbean factory:java.lang.ExceptionInInitializerError java.lang.RuntimeException: Failed to execute start task. Reason: java.io.IOException: Could not load xbean factory:java.lang.ExceptionInInitializerError
at org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:98)
at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
at org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:129)
at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
at org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.activemq.console.Main.runTaskClass(Main.java:225)
at org.apache.activemq.console.Main.main(Main.java:106)
Caused by: java.io.IOException: Could not load xbean factory:java.lang.ExceptionInInitializerError
at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:27)
at org.apache.activemq.broker.BrokerFactory.createBrokerFactoryHandler(BrokerFactory.java:43)
at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:70)
at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54)
at org.apache.activemq.console.command.StartCommand.startBroker(StartCommand.java:115)
at org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:74)
... 10 more
Caused by: java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at java.lang.Class.newInstance0(Class.java:350)
at java.lang.Class.newInstance(Class.java:303)
at org.apache.activemq.util.FactoryFinder.newInstance(FactoryFinder.java:55)
at org.apache.activemq.util.FactoryFinder.newInstance(FactoryFinder.java:42)
at org.apache.activemq.broker.BrokerFactory.createBrokerFactoryHandler(BrokerFactory.java:41)
... 14 more
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;#abcc03 for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError:org/apache/log4j/Category) (Caused by org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;#abcc03 for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category))
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
at org.apache.activemq.xbean.XBeanBrokerFactory.<clinit(XBeanBrokerFactory.java:43)
... 23 more
Caused by: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;#abcc03 for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category)
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:413)
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
... 27 more
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Category
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
at java.lang.Class.getConstructor0(Class.java:2671)
at java.lang.Class.getConstructor(Class.java:1629)
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:410)
... 28 more
ERROR: java.lang.Exception: java.io.IOException: Could not load xbean factory:java.lang.ExceptionInInitializerError java.lang.Exception: java.io.IOException: Could not load xbean factory:java.lang.ExceptionInInitializerError
at org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:99)
at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
at org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:129)
at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
at org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.activemq.console.Main.runTaskClass(Main.java:225)
at org.apache.activemq.console.Main.main(Main.java:106)
Caused by: java.io.IOException: Could not load xbean factory:java.lang.ExceptionInInitializerError
at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:27)
at org.apache.activemq.broker.BrokerFactory.createBrokerFactoryHandler(BrokerFactory.java:43)
at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:70)
at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54)
at org.apache.activemq.console.command.StartCommand.startBroker(StartCommand.java:115)
at org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:74)
... 10 more
Caused by: java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at java.lang.Class.newInstance0(Class.java:350)
at java.lang.Class.newInstance(Class.java:303)
at org.apache.activemq.util.FactoryFinder.newInstance(FactoryFinder.java:55)
at org.apache.activemq.util.FactoryFinder.newInstance(FactoryFinder.java:42)
at org.apache.activemq.broker.BrokerFactory.createBrokerFactoryHandler(BrokerFactory.java:41)
... 14 more
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;#abcc03 for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category) (Caused by org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;#abcc03 for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category))
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
at org.apache.activemq.xbean.XBeanBrokerFactory.<clinit(XBeanBrokerFactory.java:43)
... 23 more
Caused by: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;#abcc03 for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category)
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:413)
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
... 27 more
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Category
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
at java.lang.Class.getConstructor0(Class.java:2671)
at java.lang.Class.getConstructor(Class.java:1629)
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:410)
... 28 more
So, it was definitely a conflict with another log4j jar file. I think it's probably my eclipse plugin log4j that was conflicting. When i delete the log4j from activemq lib/optional it works.
This looks like the exception is being caused by a NoClassDefFoundError for org.apache.log4j.Category. You should make sure that the log4j jar is on the classpath.
Edit: Is there any way that you can inspect the value of the ACTIVEMQ_CLASSPATH variable? If you're invoking this through a script that is setting the variable, you might need to dig into the script to make sure it's adding all the directories you think it is to the classpath.

Categories

Resources