When I tried googlecast/CastHelloText-android, I met following failure. BTW, I uploaded receiver.html to one URL that I can access in my network. I registered app id in cast console as customer style.
==========================================================================
02-15 23:18:43.923: D/libEGL(15662): loaded /system/lib/egl/libEGL_tegra.so
02-15 23:18:43.943: D/libEGL(15662): loaded /system/lib/egl/libGLESv1_CM_tegra.so
02-15 23:18:43.963: D/libEGL(15662): loaded /system/lib/egl/libGLESv2_tegra.so
02-15 23:18:43.983: D/OpenGLRenderer(15662): Enabling debug mode 0
02-15 23:18:46.363: D/dalvikvm(15662): GC_FOR_ALLOC freed 128K, 2% free 8342K/8508K, paused 14ms, total 15ms
02-15 23:18:47.513: D/MainActivity(15662): onRouteSelected
02-15 23:18:49.113: D/MainActivity(15662): onConnected
02-15 23:18:52.593: D/MainActivity(15662): A*pplicationConnectionResultCallback.onResult: statusCode2002
02-15 23:18:52.603: E/MainActivity(15662): application could not launch*
==========================================================================
Meanwhile, I tried googlecast/CastVideos-android as well and met same error.
I ran both of the two sample app, the chromecast showed "brain freeze we're sorry, but something could not load. Activity aborted".
I tried allcast, still failed with following log and the screen showd the same error info as above. Could anybody give me any advise? Thanks a lot!!!
============================================================================
02-15 23:32:12.633: I/CastService(13119): Sending url: file:/storage/emulated/0/Tencent/MicroMsg/Camera/microMsg.1385135098732.jpg
02-15 23:32:12.633: I/CastService(13119): Cleaning up route
02-15 23:32:12.633: I/AllCast(13119): Releasing locks.
02-15 23:32:12.633: I/AllCast(13119): Acquiring partial lock.
02-15 23:32:12.653: D/dalvikvm(13119): GC_CONCURRENT freed 1571K, 11% free 13633K/15236K, paused 2ms+6ms, total 45ms
02-15 23:32:12.673: D/CastMediaRouteProvider(848): onSelect
02-15 23:32:12.673: D/CastMediaRouteProvider(848): Received control request Intent { act=android.media.intent.action.PLAY cat=[android.media.intent.category.REMOTE_PLAYBACK] dat=http :// 192.168.199.235:34118/13fa3c06-32dd-4660-bc6e-adbcfce89a1d/airplay.jpg typ=image/jpeg (has extras) }
02-15 23:32:12.673: D/CastMediaRouteProvider(848): processRemotePlaybackRequest()
02-15 23:32:12.673: D/CastMediaRouteProvider(848): got remote playback request; action=android.media.intent.action.PLAY
02-15 23:32:12.673: D/CastMediaRouteProvider(848): checkSession() sessionId=null, currentSessionId=null
02-15 23:32:12.673: D/CastMediaRouteProvider(848): startSession()
02-15 23:32:12.673: D/MediaRouteSession(848): starting session for app CC1AD845
02-15 23:32:12.693: D/CastDeviceController_MRP(848): launchApplicationInternal() id=CC1AD845, relaunch=true
02-15 23:32:12.773: D/ReceiverControlChannel(848): Received: {"requestId":0,"status":{"volume":{"level":1.0,"muted":false}},"type":"RECEIVER_STATUS"}
02-15 23:32:12.773: D/ReceiverControlChannel(848): requestId = 0, ignoreVolume = false
02-15 23:32:12.773: D/ReceiverControlChannel(848): onStatusReceived
02-15 23:32:12.773: D/CastDeviceController_MRP(848): processReceiverStatus: applicationInfo=null, volume=1.000000, muteState=false
02-15 23:32:12.773: D/CastMediaRouteProvider(848): onVolumeChanged to 1.000000, was 1.000000
02-15 23:32:12.773: D/CastMediaRouteProvider(848): onVolumeChanged to 1.000000, was 1.000000
02-15 23:32:12.773: D/CastMediaRouteProvider(848): onVolumeChanged to 1.000000, was 0.000000
02-15 23:32:12.773: D/CastMediaRouteProvider(848): buildRouteDescriptorForDevice: id=34e32664671cebbe2a2c890fd358e723, description=stone-cast, connecting=false, volume=20
02-15 23:32:12.773: D/CastMediaRouteProvider(848): published 1 routes
02-15 23:32:13.143: D/ReceiverControlChannel(848): Received: {"reason":"CANCELLED","requestId":2,"type":"LAUNCH_ERROR"}
02-15 23:32:13.143: D/RequestTracker(848): request 2 completed
02-15 23:32:13.143: D/CastMediaRouteProvider(848): onApplicationConnectionFailed: statusCode=2002
02-15 23:32:13.143: D/MediaRouteSession(848): [1105900168] onApplicationConnectionFailed; mPendingState=0
02-15 23:32:13.143: D/CastMediaRouteProvider(848): onApplicationConnectionFailed: statusCode=2002
02-15 23:32:13.143: D/MediaRouteSession(848): [1105754528] onApplicationConnectionFailed; mPendingState=0
02-15 23:32:13.143: D/CastMediaRouteProvider(848): onApplicationConnectionFailed: statusCode=2002
02-15 23:32:13.143: D/MediaRouteSession(848): [1107022664] onApplicationConnectionFailed; mPendingState=0
02-15 23:32:13.143: D/ReceiverControlChannel(848): Received: {"requestId":0,"status":{"volume":{"level":1.0,"muted":false}},"type":"RECEIVER_STATUS"}
02-15 23:32:13.143: D/ReceiverControlChannel(848): requestId = 0, ignoreVolume = false
02-15 23:32:13.143: D/ReceiverControlChannel(848): onStatusReceived
02-15 23:32:13.143: D/CastDeviceController_MRP(848): processReceiverStatus: applicationInfo=null, volume=1.000000, muteState=false
02-15 23:32:13.143: D/CastMediaRouteProvider(848): onVolumeChanged to 1.000000, was 1.000000
02-15 23:32:13.143: D/CastMediaRouteProvider(848): onVolumeChanged to 1.000000, was 1.000000
02-15 23:32:13.143: D/CastMediaRouteProvider(848): onVolumeChanged to 1.000000, was 1.000000
02-15 23:32:13.663: D/CastMediaRouteProvider(848): Received control request Intent { act=android.media.intent.action.GET_STATUS cat=[android.media.intent.category.REMOTE_PLAYBACK] (has extras) }
02-15 23:32:13.663: D/CastMediaRouteProvider(848): processRemotePlaybackRequest()
02-15 23:32:13.663: D/CastMediaRouteProvider(848): got remote playback request; action=android.media.intent.action.GET_STATUS
02-15 23:32:13.663: D/CastMediaRouteProvider(848): checkSession() sessionId=null, currentSessionId=null
02-15 23:32:13.683: D/ReceiverControlChannel(848): Received: {"requestId":0,"status":{"volume":{"level":1.0,"muted":false}},"type":"RECEIVER_STATUS"}
02-15 23:32:13.683: D/ReceiverControlChannel(848): requestId = 0, ignoreVolume = false
02-15 23:32:13.683: D/ReceiverControlChannel(848): onStatusReceived
02-15 23:32:13.683: D/CastDeviceController_MRP(848): processReceiverStatus: applicationInfo=null, volume=1.000000, muteState=false
02-15 23:32:13.683: D/CastMediaRouteProvider(848): onVolumeChanged to 1.000000, was 1.000000
02-15 23:32:13.683: D/CastMediaRouteProvider(848): onVolumeChanged to 1.000000, was 1.000000
02-15 23:32:13.683: D/CastMediaRouteProvider(848): onVolumeChanged to 1.000000, was 1.000000
02-15 23:32:13.683: D/ReceiverControlChannel(848): Received: {"requestId":0,"status":{"volume":{"level":1.0,"muted":false}},"type":"RECEIVER_STATUS"}
02-15 23:32:13.683: D/ReceiverControlChannel(848): requestId = 0, ignoreVolume = false
02-15 23:32:13.683: D/ReceiverControlChannel(848): onStatusReceived
02-15 23:32:13.683: D/CastDeviceController_MRP(848): processReceiverStatus: applicationInfo=null, volume=1.000000, muteState=false
02-15 23:32:13.683: D/CastMediaRouteProvider(848): onVolumeChanged to 1.000000, was 1.000000
02-15 23:32:13.683: D/CastMediaRouteProvider(848): onVolumeChanged to 1.000000, was 1.000000
02-15 23:32:13.683: D/CastMediaRouteProvider(848): onVolumeChanged to 1.000000, was 1.000000
02-15 23:32:13.683: D/ReceiverControlChannel(848): Received: {"requestId":0,"status":{"volume":{"level":1.0,"muted":false}},"type":"RECEIVER_STATUS"}
02-15 23:32:13.683: D/ReceiverControlChannel(848): requestId = 0, ignoreVolume = false
02-15 23:32:13.683: D/ReceiverControlChannel(848): onStatusReceived
02-15 23:32:13.683: D/CastDeviceController_MRP(848): processReceiverStatus: applicationInfo=null, volume=1.000000, muteState=false
02-15 23:32:13.683: D/CastMediaRouteProvider(848): onVolumeChanged to 1.000000, was 1.000000
02-15 23:32:13.683: D/CastMediaRouteProvider(848): onVolumeChanged to 1.000000, was 1.000000
02-15 23:32:13.683: D/CastMediaRouteProvider(848): onVolumeChanged to 1.000000, was 1.000000
02-15 23:32:14.663: D/CastMediaRouteProvider(848): Received control request Intent { act=android.media.intent.action.GET_STATUS cat=[android.media.intent.category.REMOTE_PLAYBACK] (has extras) }
02-15 23:32:14.663: D/CastMediaRouteProvider(848): processRemotePlaybackRequest()
02-15 23:32:14.673: D/CastMediaRouteProvider(848): got remote playback request; action=android.media.intent.action.GET_STATUS
02-15 23:32:14.673: D/CastMediaRouteProvider(848): checkSession() sessionId=null, currentSessionId=null
Related
I run a web application on Azure and it connects with Azure Sql.
This has worked without any problems for a few years now.
But today I have started to get the following message:
The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.
Problem is, that I can refresh, and sometimes it disappears, and sometimes it appears again. We haven't deployed anything for over a week, so does not seem to be related to that. App and Db are located at the same Azure hosting center.
Azure portal states there are no problems or know issues with anything, so what should I be looking for.
Any help is greatly appreciated.
The full stack trace
[Win32Exception (0x80004005): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond]
[SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)]
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling) +821
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +332
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +38
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +497
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +89
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +426
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +78
System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +191
System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +154
System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +21
System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) +90
System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +209
System.Data.SqlClient.SqlConnection.Open() +96
System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.<Open>b__36(DbConnection t, DbConnectionInterceptionContext c) +10
System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch(TTarget target, Action`2 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed) +72
System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection connection, DbInterceptionContext interceptionContext) +359
System.Data.Entity.Core.EntityClient.EntityConnection.<Open>b__2() +55
System.Data.Entity.SqlServer.<>c__DisplayClass1.<Execute>b__0() +10
System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Func`1 operation) +75
[EntityException: An exception has been raised that is likely due to a transient failure. If you are connecting to a SQL Azure database consider using SqlAzureExecutionStrategy.]
System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Func`1 operation) +184
System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Action operation) +77
System.Data.Entity.Core.EntityClient.EntityConnection.Open() +253
[EntityException: The underlying provider failed on Open.]
System.Data.Entity.Core.EntityClient.EntityConnection.Open() +323
System.Data.Entity.Core.Objects.ObjectContext.EnsureConnection(Boolean shouldMonitorTransactions) +133
System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction(Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess) +46
System.Data.Entity.Core.Objects.<>c__DisplayClass7.<GetResults>b__5() +155
System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Func`1 operation) +75
[EntityException: An exception has been raised that is likely due to a transient failure. If you are connecting to a SQL Azure database consider using SqlAzureExecutionStrategy.]
System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Func`1 operation) +184
System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) +281
System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0() +11
System.Data.Entity.Internal.LazyEnumerator`1.MoveNext() +45
System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source) +121
System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__1(IEnumerable`1 sequence) +40
System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.ExecuteSingle(IEnumerable`1 query, Expression queryRoot) +60
System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute(Expression expression) +113
System.Data.Entity.Internal.Linq.DbQueryProvider.Execute(Expression expression) +99
System.Linq.Queryable.FirstOrDefault(IQueryable`1 source, Expression`1 predicate) +249
.Areas.Data.Controllers.ExportsController.Overview(String exportGuid) in C:\Own\Projects\\codebase\\Areas\Data\Controllers\ExportsController.cs:0
lambda_method(Closure , ControllerBase , Object[] ) +104
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +157
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +22
System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +29
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +32
System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +50
System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +228
System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) +10
System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +34
System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +26
System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +100
System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27
System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +13
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +36
System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +12
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +22
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +26
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +21
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +28
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9748493
System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +48
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +159
As the errors you shared stated this is happening due to transient errors. "[EntityException: An exception has been raised that is likely due to a transient failure.
Please add a retry logic to your applications.
public void HandleTransients()
{
var connStr = "some database";
var _policy = RetryPolicy.Create < SqlAzureTransientErrorDetectionStrategy(
retryCount: 3,
retryInterval: TimeSpan.FromSeconds(5));
using (var conn = new ReliableSqlConnection(connStr, _policy))
{
// Do SQL stuff here.
}
}
Learn more about it here and here.
My requirement is to download the file from FTP (ex : FTP Dir "A") do validation and do some process. once processed , the same file has to moved "A" to FTP Dir "B".
Tried below once
#ServiceActivator(inputChannel = "jsonHttpOutBoundChannel",outputChannel = "testChannel")
public void handler() {
FtpOutboundGateway ftpOutboundGateway = new FtpOutboundGateway(ftpSessionFactory.getFTPSessionFactory(), "mv");
Message message1 = MessageBuilder.withPayload(false)
.setHeader("file_renameTo", "/FTP/success")
.setHeader("file_remoteFile", "category.xml")
.setHeader("file_remoteDirectory","/FTP/process")
.build();
ftpOutboundGateway.handleMessage(message1);
}
getting
Caused by: java.lang.NullPointerException
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.getRemoteFilename(AbstractRemoteFileOutboundGateway.java:1046)
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.doMv(AbstractRemoteFileOutboundGateway.java:629)
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.handleRequestMessage(AbstractRemoteFileOutboundGateway.java:526)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:109)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127)
at au.com.fluentretail.ftp.integration.serviceactivators.FTPServiceActivator.handler(FTPServiceActivator.java:69)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.expression.spel.support.ReflectiveMethodExecutor.execute(ReflectiveMethodExecutor.java:113)
at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:129)
at org.springframework.expression.spel.ast.MethodReference.access$000(MethodReference.java:49)
at org.springframework.expression.spel.ast.MethodReference$MethodValueRef.getValue(MethodReference.java:347).
Tried with RemoteFileTemplate with AbstractRemoteFileOutboundGateway ,
#Bean
#ServiceActivator(inputChannel = "jsonHttpOutBoundChannel")
public MessageHandler gatewayHandler() throws IOException {
Expression expression = new LiteralExpression("/processing");
Expression fileExpression = new LiteralExpression("category.xml");
RemoteFileTemplate remoteFileTemplate = new RemoteFileTemplate(ftpSessionFactory.getFTPSessionFactory());
remoteFileTemplate.setRemoteDirectoryExpression(expression);
remoteFileTemplate.setFileNameExpression(fileExpression);
AbstractRemoteFileOutboundGateway ftpOutboundGateway = new FtpOutboundGateway(remoteFileTemplate, "get");
ftpOutboundGateway.setLocalDirectoryExpression(new LiteralExpression(CONSTANTS.ftpErrorPath));
ftpOutboundGateway.setRequiresReply(false);
return ftpOutboundGateway;
}
still facing the same issue.
2017-09-14 15:55:25.058 ERROR 14648 --- [ask-scheduler-1] o.s.integration.handler.LoggingHandler : org.springframework.messaging.MessageHandlingException: error occurred in message handler [gatewayHandler]; nested exception is java.lang.NullPointerException, failedMessage=GenericMessage [payload=, headers={file_renameTo=/success, file_originalFile=/processing/category.xml, id=68fd370f-eb77-66a5-3462-e8f50c0c068c, file_remoteDirectory=/processing, file_remoteFile=category.xml, timestamp=1505384725042}]
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:139)
at org.springframework.integration.dispatcher.BroadcastingDispatcher.invokeHandler(BroadcastingDispatcher.java:236)
at org.springframework.integration.dispatcher.BroadcastingDispatcher.dispatch(BroadcastingDispatcher.java:185)
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:89)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:423)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:373)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:115)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:45)
at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:105)
at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutput(AbstractMessageProducingHandler.java:292)
at org.springframework.integration.handler.AbstractMessageProducingHandler.produceOutput(AbstractMessageProducingHandler.java:212)
at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutputs(AbstractMessageProducingHandler.java:129)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:115)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127)
at org.springframework.integration.dispatcher.BroadcastingDispatcher.invokeHandler(BroadcastingDispatcher.java:236)
at org.springframework.integration.dispatcher.BroadcastingDispatcher.dispatch(BroadcastingDispatcher.java:185)
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:89)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:423)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:373)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:115)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:45)
at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:105)
at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutput(AbstractMessageProducingHandler.java:292)
at org.springframework.integration.handler.AbstractMessageProducingHandler.produceOutput(AbstractMessageProducingHandler.java:212)
at org.springframework.integration.splitter.AbstractMessageSplitter.produceOutput(AbstractMessageSplitter.java:159)
at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutputs(AbstractMessageProducingHandler.java:129)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:115)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127)
at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116)
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:148)
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:121)
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:89)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:423)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:373)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:115)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:45)
at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:105)
at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutput(AbstractMessageProducingHandler.java:292)
at org.springframework.integration.handler.AbstractMessageProducingHandler.produceOutput(AbstractMessageProducingHandler.java:212)
at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutputs(AbstractMessageProducingHandler.java:129)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:115)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127)
at org.springframework.integration.dispatcher.BroadcastingDispatcher.invokeHandler(BroadcastingDispatcher.java:236)
at org.springframework.integration.dispatcher.BroadcastingDispatcher.dispatch(BroadcastingDispatcher.java:185)
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:89)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:423)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:373)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:115)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:45)
at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:105)
at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutput(AbstractMessageProducingHandler.java:292)
at org.springframework.integration.handler.AbstractMessageProducingHandler.produceOutput(AbstractMessageProducingHandler.java:212)
at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutputs(AbstractMessageProducingHandler.java:129)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:115)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127)
at org.springframework.integration.dispatcher.BroadcastingDispatcher.invokeHandler(BroadcastingDispatcher.java:236)
at org.springframework.integration.dispatcher.BroadcastingDispatcher.dispatch(BroadcastingDispatcher.java:185)
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:89)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:423)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:373)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:115)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:45)
at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:105)
at org.springframework.integration.endpoint.SourcePollingChannelAdapter.handleMessage(SourcePollingChannelAdapter.java:210)
at org.springframework.integration.endpoint.AbstractPollingEndpoint.doPoll(AbstractPollingEndpoint.java:272)
at org.springframework.integration.endpoint.AbstractPollingEndpoint.access$000(AbstractPollingEndpoint.java:58)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:190)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:186)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1.run(AbstractPollingEndpoint.java:353)
at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:55)
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:51)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:344)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.getRemoteFilename(AbstractRemoteFileOutboundGateway.java:1046)
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.doGet(AbstractRemoteFileOutboundGateway.java:564)
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.handleRequestMessage(AbstractRemoteFileOutboundGateway.java:520)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:109)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127)
... 81 more
It seems common issue there and here.
Can some one help me please.
Thanks in advance.
EDIT : Caused by: java.lang.IllegalArgumentException: BeanFactory must not be null is thrown on below code , it is already a bean.
This exception is thrown even if sessionFactory is used instead of RemoteFileTemplate
#Bean
#ServiceActivator(inputChannel = "finalProcessChannel")
public MessageHandler finalProcessHandler() {
return new MessageHandler() {
#Override
public void handleMessage(Message<?> message) throws MessagingException {
String fileName = message.getHeaders().get("file_name").toString();
message = MessageBuilder.createMessage("",createHeaders(message,CONSTANTS.ftpProcessingPath,CONSTANTS.ftpSuccessPath));
RemoteFileTemplate fileTemplate = new RemoteFileTemplate(ftpSessionFactory.getFTPSessionFactory());
FtpOutboundGateway ftpOutboundGateway = new FtpOutboundGateway(fileTemplate, "mv","'"+CONSTANTS.ftpProcessingPath+"/"+fileName+"'");
ftpOutboundGateway.setOutputChannelName("outputChannel");
ftpOutboundGateway.handleMessage(message);
}
};
}
EDIT : To return FtpOutboundGateway i need the file name from Message Header/String for the contructor initialization with expression. And with #Bean if Message is passed as parameter getting required a bean of type 'org.springframework.messaging.Message' that could not be found or required a bean of type 'java.lang.String' that could not be found
Ex :
#Bean
#ServiceActivator(inputChannel = "finalProcessChannel")
public FtpOutboundGateway finalProcessHandler(Message message) {
String fileName = message.getHeaders().get("file_name").toString();
return new FtpOutboundGateway(ftpSessionFactory.getFTPSessionFactory(), "mv", "'" + CONSTANTS.ftpProcessingPath + fileName + "'") {
#Override
protected Object handleRequestMessage(Message<?> requestMessage) {
requestMessage = MessageBuilder.createMessage("", createHeaders(requestMessage, CONSTANTS.ftpProcessingPath, CONSTANTS.ftpSuccessPath));
setOutputChannelName("outputChannel");
return super.handleRequestMessage(requestMessage);
}
};
}
EDIT : with dynamic expression
#Bean
#ServiceActivator(inputChannel = "finalProcessChannel")
public FtpOutboundGateway finalProcessHandler() {
return new FtpOutboundGateway(ftpSessionFactory.getFTPSessionFactory(), "mv","'"+CONSTANTS.ftpProcessingPath+"/"+"headers['file_name']"+"'"){
#Override
protected Object handleRequestMessage(Message<?> requestMessage) {
requestMessage = MessageBuilder.createMessage("", createHeaders(requestMessage, CONSTANTS.ftpProcessingPath, CONSTANTS.ftpSuccessPath));
setOutputChannelName("outputChannel");
return super.handleRequestMessage(requestMessage);
}
};
}
You are not using the gateway correctly; you shouldn't create a new gateway for each request.
The gateway must be a #Bean so that the framework initializes it correctly.
#ServiceActivator(...)
#Bean
public FtpOutboundGateway gateway() {
...
}
Then send a message to the service's inputChannel.
EDIT
We should protect against the NPE but the problem is that constructor (in your second example) sets the remote file path expression (with the gateway). Using that constructor you need to add the expression again...
AbstractRemoteFileOutboundGateway ftpOutboundGateway = new FtpOutboundGateway(remoteFileTemplate, "get", "/processing/category.xml");
I would stay away from the constructors that take a RemoteFileTemplate; use the ones with a session factory instead.
I will open a JIRA issue for these problems.
I am trying to create a spring-integration application that ingests data from http , than enriches it and forwards it to a websocket connection. The exceptions that i get are telling me that SPeL tries to call configure(String) method. But i cannot any configure method in my code.
#Bean
public IntegrationFlow enrichmentFlow(){
return flow -> flow.enrich(e -> e
.requestPayload(Message::getPayload))
.transform(Transformers.fromJson(Data.class))
.handle(Data.class, (payload, headers) -> enrichment.transform(payload))
.transform(Transformers.toJson())
.handle(updateToBrowser());
}
#Bean
public MessageHandler webSocketOutboundAdapter() {
return new WebSocketOutboundMessageHandler(serverWebSocketContainer());
}
#Bean
public ServerWebSocketContainer serverWebSocketContainer() {
return new ServerWebSocketContainer("/websocket-integration-example").setAllowedOrigins("*").withSockJs();
}
#Bean
IntegrationFlow updateToBrowser() {
return f -> {
Function<Message , Object> splitter = m -> serverWebSocketContainer()
.getSessions()
.keySet()
.stream()
.map(s -> MessageBuilder.fromMessage(m)
.setHeader(SimpMessageHeaderAccessor.SESSION_ID_HEADER, s)
.build())
.collect(Collectors.toList());
f.split( Message.class, splitter)
.channel(c -> c.executor(Executors.newCachedThreadPool()))
.handle(webSocketOutboundAdapter());
};
}
When i run this code i get a lot of the following stacktraces.
org.springframework.expression.spel.SpelEvaluationException: EL1004E:(pos 8): Method call: Method configure(java.lang.String) cannot be found on com.favendo.assettracking.FlowTrackerIngestApplication$$Lambda$12/1054035701 type
at org.springframework.expression.spel.ast.MethodReference.findAccessorForMethod(MethodReference.java:211)
at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:125)
at org.springframework.expression.spel.ast.MethodReference.access$000(MethodReference.java:49)
at org.springframework.expression.spel.ast.MethodReference$MethodValueRef.getValue(MethodReference.java:347)
at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:88)
at org.springframework.expression.spel.ast.SpelNodeImpl.getTypedValue(SpelNodeImpl.java:131)
at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:330)
at org.springframework.integration.util.AbstractExpressionEvaluator.evaluateExpression(AbstractExpressionEvaluator.java:169)
at org.springframework.integration.util.MessagingMethodInvokerHelper.processInternal(MessagingMethodInvokerHelper.java:317)
at org.springframework.integration.util.MessagingMethodInvokerHelper.process(MessagingMethodInvokerHelper.java:155)
at org.springframework.integration.handler.MethodInvokingMessageProcessor.processMessage(MethodInvokingMessageProcessor.java:93)
at org.springframework.integration.handler.ServiceActivatingHandler.handleRequestMessage(ServiceActivatingHandler.java:89)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:109)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127)
at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116)
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:148)
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:121)
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:423)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:373)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:115)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:45)
at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:105)
at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutput(AbstractMessageProducingHandler.java:292)
at org.springframework.integration.handler.AbstractMessageProducingHandler.produceOutput(AbstractMessageProducingHandler.java:212)
at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutputs(AbstractMessageProducingHandler.java:129)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:115)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127)
at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116)
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:148)
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:121)
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:423)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:373)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:115)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:45)
at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:105)
at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutput(AbstractMessageProducingHandler.java:292)
at org.springframework.integration.handler.AbstractMessageProducingHandler.produceOutput(AbstractMessageProducingHandler.java:212)
at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutputs(AbstractMessageProducingHandler.java:129)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:115)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127)
at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116)
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:148)
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:121)
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:423)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:373)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:115)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:45)
at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:105)
at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutput(AbstractMessageProducingHandler.java:292)
at org.springframework.integration.handler.AbstractMessageProducingHandler.produceOutput(AbstractMessageProducingHandler.java:212)
at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutputs(AbstractMessageProducingHandler.java:129)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:115)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127)
at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116)
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:148)
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:121)
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:423)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:373)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:115)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:45)
at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:105)
at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutput(AbstractMessageProducingHandler.java:292)
at org.springframework.integration.handler.AbstractMessageProducingHandler.produceOutput(AbstractMessageProducingHandler.java:212)
at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutputs(AbstractMessageProducingHandler.java:129)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:115)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127)
at org.springframework.integration.dispatcher.BroadcastingDispatcher.invokeHandler(BroadcastingDispatcher.java:236)
at org.springframework.integration.dispatcher.BroadcastingDispatcher.access$000(BroadcastingDispatcher.java:53)
at org.springframework.integration.dispatcher.BroadcastingDispatcher$2.run(BroadcastingDispatcher.java:216)
at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:55)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
This...
.handle(updateToBrowser());
is wrong.
handle methods don't take a flow; they take a message handler of some kind. The framework is treating the updateToBrowser bean as a POJO and trying to find a method to invoke with the message.
Use
.channel("updateToBrowser.input")
instead.
EDIT
You can explicitly define the bean if you prefer
#Bean(name="updateToBrowser.input")
public MessageChannel uTBChannel() {
return new DirectChannel();
}
Then use
.channel(uTBChannel()).
The flow only registers a channel if it doesn't already exist.
This is a simple activity which takes the message from user and displays it in the second activity. From nowhere I am getting a java.lang Null pointer exception.
The data in the file is as follows :
// activity_main.xml
// This is the xml file for the main activity
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="29dp"
android:text="Enter the message"
android:textSize="18dp" />
<EditText
android:id="#+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/textView1"
android:layout_marginTop="38dp"
android:ems="10" >
<requestFocus />
</EditText>
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/editText1"
android:layout_centerHorizontal="true"
android:layout_marginTop="96dp"
android:text="send"
android:onClick="sendmessage" />
</RelativeLayout>
// MainActivity.java
// this is the code for the main activity which creates an intent and pass the value entered to the display activity
package com.example.simpleactivity;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
public class MainActivity extends Activity {
public final static String EXTRA_MESSAGE = "com.example.simpleactivity.MESSAGE";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void sendmessage(View view) {
EditText textmessage = (EditText) findViewById(R.id.editText1);
String message = textmessage.getText().toString();
Intent intent = new Intent(this, DisplayMessageActivity.class);
intent.putExtra(EXTRA_MESSAGE, message);
startActivity(intent);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
// activity_display_message.xml
// this is the xml file for the display activity
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".DisplayMessageActivity" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="58dp"
android:layout_marginTop="110dp"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>
// DisplayMessageActivity.java
// this is the display activity which gets and intent and displays the extra message
package com.example.simpleactivity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.widget.TextView;
public class DisplayMessageActivity extends Activity {
TextView tv;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_display_message);
Intent intent = getIntent();
String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
tv = (TextView) findViewById(R.id.textView2);
tv.setText(message);
setContentView(tv);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.display_message, menu);
return true;
}
}
// The logcat is as follows:
08-09 18:23:08.812: I/Choreographer(1520): Skipped 37 frames! The application may be doing too much work on its main thread.
08-09 18:23:08.942: D/gralloc_goldfish(1520): Emulator without GPU emulation detected.
08-09 18:23:13.262: D/AndroidRuntime(1520): Shutting down VM
08-09 18:23:13.262: W/dalvikvm(1520): threadid=1: thread exiting with uncaught exception
(group=0x414c4700)
08-09 18:23:13.402: E/AndroidRuntime(1520): FATAL EXCEPTION: main
08-09 18:23:13.402: E/AndroidRuntime(1520): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.simpleactivity/com.example.simpleactivity.DisplayMessageActivity}: java.lang.NullPointerException
08-09 18:23:13.402: E/AndroidRuntime(1520): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
08-09 18:23:13.402: E/AndroidRuntime(1520): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
08-09 18:23:13.402: E/AndroidRuntime(1520): at android.app.ActivityThread.access$600(ActivityThread.java:141)
08-09 18:23:13.402: E/AndroidRuntime(1520): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
08-09 18:23:13.402: E/AndroidRuntime(1520): at android.os.Handler.dispatchMessage(Handler.java:99)
08-09 18:23:13.402: E/AndroidRuntime(1520): at android.os.Looper.loop(Looper.java:137)
08-09 18:23:13.402: E/AndroidRuntime(1520): at android.app.ActivityThread.main(ActivityThread.java:5103)
08-09 18:23:13.402: E/AndroidRuntime(1520): at java.lang.reflect.Method.invokeNative(Native Method)
08-09 18:23:13.402: E/AndroidRuntime(1520): at java.lang.reflect.Method.invoke(Method.java:525)
08-09 18:23:13.402: E/AndroidRuntime(1520): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
08-09 18:23:13.402: E/AndroidRuntime(1520): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
08-09 18:23:13.402: E/AndroidRuntime(1520): at dalvik.system.NativeStart.main(Native Method)
08-09 18:23:13.402: E/AndroidRuntime(1520): Caused by: java.lang.NullPointerException
08-09 18:23:13.402: E/AndroidRuntime(1520): at com.example.simpleactivity.DisplayMessageActivity.onCreate(DisplayMessageActivity.java:20)
08-09 18:23:13.402: E/AndroidRuntime(1520): at android.app.Activity.performCreate(Activity.java:5133)
08-09 18:23:13.402: E/AndroidRuntime(1520): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
08-09 18:23:13.402: E/AndroidRuntime(1520): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
08-09 18:23:13.402: E/AndroidRuntime(1520): ... 11 more
08-09 18:23:17.812: I/Process(1520): Sending signal. PID: 1520 SIG: 9
In your DisplayMessageActivity onCreate() method :
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_display_message);
Intent intent = getIntent();
String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
tv = (TextView) findViewById(R.id.textView2);
tv.setText(message);
setContentView(tv);
}
uncomment first setContentView() and comment last setContentView() like below :
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_display_message);
Intent intent = getIntent();
String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
tv = (TextView) findViewById(R.id.textView2);
tv.setText(message);
//setContentView(tv);
}
I have an app with flipper and animation of images on each page of Flipper...
App works on HTC Desire, Desire S, Samsung Galaxy tab 1 (7')... But when I try to run it on Samsung Galaxy Tab 10.1 - this error occures...
flipper = (ViewFlipper) findViewById(R.id.flipper);
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
int layouts[] = new int[]{ R.layout.first, R.layout.second, R.layout.third, R.layout.fourth,
R.layout.fifth, R.layout.sixth, R.layout.seventh, R.layout.eighth, R.layout.nineth, R.layout.tenth,
R.layout.eleventh, R.layout.twelveth, R.layout.thirteen, R.layout.fourteenth };
for (int layout : layouts)
flipper.addView(inflater.inflate(layout, null));
02-16 09:33:44.129: E/AndroidRuntime(1733): FATAL EXCEPTION: main
02-16 09:33:44.129: E/AndroidRuntime(1733): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.home/com.home.Main}: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1751)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1767)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.app.ActivityThread.access$1500(ActivityThread.java:122)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1005)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.os.Handler.dispatchMessage(Handler.java:99)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.os.Looper.loop(Looper.java:132)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.app.ActivityThread.main(ActivityThread.java:4028)
02-16 09:33:44.129: E/AndroidRuntime(1733): at java.lang.reflect.Method.invokeNative(Native Method)
02-16 09:33:44.129: E/AndroidRuntime(1733): at java.lang.reflect.Method.invoke(Method.java:491)
02-16 09:33:44.129: E/AndroidRuntime(1733): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
02-16 09:33:44.129: E/AndroidRuntime(1733): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
02-16 09:33:44.129: E/AndroidRuntime(1733): at dalvik.system.NativeStart.main(Native Method)
02-16 09:33:44.129: E/AndroidRuntime(1733): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.view.LayoutInflater.createView(LayoutInflater.java:596)
02-16 09:33:44.129: E/AndroidRuntime(1733): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:644)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:669)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.view.LayoutInflater.inflate(LayoutInflater.java:457)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.view.LayoutInflater.inflate(LayoutInflater.java:391)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.view.LayoutInflater.inflate(LayoutInflater.java:347)
02-16 09:33:44.129: E/AndroidRuntime(1733): at com.home.Main.onCreate(Main.java:98)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1715)
02-16 09:33:44.129: E/AndroidRuntime(1733): ... 11 more
02-16 09:33:44.129: E/AndroidRuntime(1733): Caused by: java.lang.reflect.InvocationTargetException
02-16 09:33:44.129: E/AndroidRuntime(1733): at java.lang.reflect.Constructor.constructNative(Native Method)
02-16 09:33:44.129: E/AndroidRuntime(1733): at java.lang.reflect.Constructor.newInstance(Constructor.java:416)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.view.LayoutInflater.createView(LayoutInflater.java:576)
02-16 09:33:44.129: E/AndroidRuntime(1733): ... 20 more
02-16 09:33:44.129: E/AndroidRuntime(1733): Caused by: java.lang.OutOfMemoryError
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:577)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:445)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:738)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.content.res.Resources.loadDrawable(Resources.java:1869)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.view.View.<init>(View.java:2462)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.view.View.<init>(View.java:2401)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.view.ViewGroup.<init>(ViewGroup.java:359)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.widget.RelativeLayout.<init>(RelativeLayout.java:173)
02-16 09:33:44.129: E/AndroidRuntime(1733): ... 23 more
As I understand after googling this error is because of Manifest, any ideas?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.home"
android:installLocation="preferExternal"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:anyDensity="true"/>
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".Main"
android:label="#string/app_name"
android:screenOrientation="landscape"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
No, this is because of OutOfMemoryError exception. You're trying to load some heavy enough bitmap from your resources:
02-16 09:33:44.129: E/AndroidRuntime(1733): Caused by: java.lang.OutOfMemoryError
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:577)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:445)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:738)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.content.res.Resources.loadDrawable(Resources.java:1869)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.view.View.<init>(View.java:2462)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.view.View.<init>(View.java:2401)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.view.ViewGroup.<init>(ViewGroup.java:359)
02-16 09:33:44.129: E/AndroidRuntime(1733): at android.widget.RelativeLayout.<init>(RelativeLayout.java:173)
02-16 09:33:44.129: E/AndroidRuntime(1733): ... 23 more