IOException when connecting to DevCloud from real device

24 views
Skip to first unread message

Jaap van Hengstum

unread,
Sep 20, 2012, 1:34:07 PM9/20/12
to openmobs...@googlegroups.com
Hi Sohil,

I am using the Development mode with the Android emulator and this works perfectly. But when I put the Dev Cloud Manager on a real device (Samsung Galaxy Tab 10.1) and activate, I get these errors on the server:

ERROR - org.openmobster.core.dataService.server.ServerHandler@43afebc9
java.io.IOException: Connection reset by peer
at sun.nio.ch.FileDispatcher.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:21)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:198)
at sun.nio.ch.IOUtil.read(IOUtil.java:171)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:245)
at org.apache.mina.transport.socket.nio.SocketIoProcessor.read(SocketIoProcessor.java:218)
at org.apache.mina.transport.socket.nio.SocketIoProcessor.process(SocketIoProcessor.java:198)
at org.apache.mina.transport.socket.nio.SocketIoProcessor.access$400(SocketIoProcessor.java:45)
at org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(SocketIoProcessor.java:485)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
at java.lang.Thread.run(Thread.java:680)

So far I've tried two different Wifi networks but on both networks I get these errors. Though the server component registers the device activation, it seems that no data is synced to the device. If it helps, I'm running the Dev Cloud Server on a Mac OS X 10.8 no firewall.

Would switching to the production Cloud Server and/or Cloud Manager help in this case?

--

Another question:

It seems that when the MobileBean on the server contains a NULL value, and in the App you do mobileBean.getValue(...) on that field, I get a NullPointerException from MobileBean.java. Is this a bug?

---
This just happened when I was writing this post. Now I'm getting the following exception from the server, which is strange because (to my knowledge) I didn't change anything and it was working before.

This happens when syncing from the emulator. Now even the emulator doesn't work anymore )-:  
Could this be because of some bug in my implementation?

ERROR - class org.openmobster.core.synchronizer.server.workflow.Utilities
java.lang.NullPointerException
at org.openmobster.core.synchronizer.server.engine.ServerSyncEngineImpl.processBootSync(ServerSyncEngineImpl.java:509)
at org.openmobster.core.synchronizer.server.workflow.EnterBootSync.execute(EnterBootSync.java:74)
at org.jbpm.graph.def.Action.execute(Action.java:129)
at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:284)
at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:241)
at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:213)
at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:196)
at org.jbpm.graph.def.Node.enter(Node.java:371)
at org.jbpm.graph.def.Transition.take(Transition.java:167)
at org.jbpm.graph.def.Node.leave(Node.java:479)
at org.jbpm.graph.exe.ExecutionContext.leaveNode(ExecutionContext.java:155)
at org.jbpm.graph.node.Decision.execute(Decision.java:194)
at org.jbpm.graph.def.Node.enter(Node.java:390)
at org.jbpm.graph.def.Transition.take(Transition.java:167)
at org.jbpm.graph.def.Node.leave(Node.java:479)
at org.jbpm.graph.exe.Token.signal(Token.java:223)
at org.jbpm.graph.exe.Token.signal(Token.java:150)
at org.openmobster.core.synchronizer.server.SyncJBPMServerAdapter.process(SyncJBPMServerAdapter.java:224)
at org.openmobster.core.synchronizer.server.SyncJBPMServerAdapter.service(SyncJBPMServerAdapter.java:154)
at org.openmobster.core.dataService.processor.SyncProcessor.process(SyncProcessor.java:84)
at org.openmobster.core.dataService.server.ProcessorController.processMessage(ProcessorController.java:89)
at org.openmobster.core.dataService.server.ProcessorController.execute(ProcessorController.java:47)
at org.openmobster.core.dataService.server.ServerHandler.messageReceived(ServerHandler.java:121)
at org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageReceived(AbstractIoFilterChain.java:570)
at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299)
at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53)
at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648)
at org.openmobster.core.dataService.server.AuthenticationFilter.messageReceived(AuthenticationFilter.java:81)
at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299)
at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53)
at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648)
at org.openmobster.core.dataService.server.TransactionFilter.messageReceived(TransactionFilter.java:37)
at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299)
at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53)
at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648)
at org.openmobster.core.dataService.server.RequestConstructionFilter.messageReceived(RequestConstructionFilter.java:47)
at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299)
at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53)
at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648)
at org.openmobster.core.dataService.server.PayloadFilter.messageReceived(PayloadFilter.java:37)
at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299)
at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53)
at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648)
at org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:220)
at org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(ExecutorFilter.java:264)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)

Sohil Shah

unread,
Sep 20, 2012, 2:17:09 PM9/20/12
to openmobs...@googlegroups.com
Hi Jaap,

Responses are inline

On Thu, Sep 20, 2012 at 12:34 PM, Jaap van Hengstum <jaap.van...@gmail.com> wrote:
Hi Sohil,

I am using the Development mode with the Android emulator and this works perfectly. But when I put the Dev Cloud Manager on a real device (Samsung Galaxy Tab 10.1) and activate, I get these errors on the server:

ERROR - org.openmobster.core.dataService.server.ServerHandler@43afebc9
java.io.IOException: Connection reset by peer
at sun.nio.ch.FileDispatcher.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:21)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:198)
at sun.nio.ch.IOUtil.read(IOUtil.java:171)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:245)
at org.apache.mina.transport.socket.nio.SocketIoProcessor.read(SocketIoProcessor.java:218)
at org.apache.mina.transport.socket.nio.SocketIoProcessor.process(SocketIoProcessor.java:198)
at org.apache.mina.transport.socket.nio.SocketIoProcessor.access$400(SocketIoProcessor.java:45)
at org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(SocketIoProcessor.java:485)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
at java.lang.Thread.run(Thread.java:680)

So far I've tried two different Wifi networks but on both networks I get these errors. Though the server component registers the device activation, it seems that no data is synced to the device. If it helps, I'm running the Dev Cloud Server on a Mac OS X 10.8 no firewall.

Would switching to the production Cloud Server and/or Cloud Manager help in this case?

This error is a socket error and is not harmful. In the latest code this error is not shown in the console anymore. As long as you are able to connect and execute the code, I wouldn't worry about it. As far as sync goes, have you launched the app one time for the sync channel to be registered with the CloudManager app? There are a couple of things you can do

* Launch your app and see if the boot sync occurs.

* In the CloudManager App go to Manual Sync and Manually sync the channel and see if that works.

* In the app's moblet-app.xml check and make sure the Sync Channel is specified and it corresponds to the one registered with the Cloud Server


 

--

Another question:

It seems that when the MobileBean on the server contains a NULL value, and in the App you do mobileBean.getValue(...) on that field, I get a NullPointerException from MobileBean.java. Is this a bug?

Yes this is a bug. You should get a "Null" value back instead of a NullPointerException. I will fix this in the next release coming out Oct 1. In the meantime you can catch the NullPointerException...I agree that it will make the client code ugly. 
Looking at this stack trace, it looks like your SyncChannel is not registered with the server or the SyncChannel registered with the app in moblet-app.xml is different value than the name of the SyncChannel registered on the Server. You may have to investigate a bit to get to the bottom of this issue. You should see a message from the ChannelDaemon in your server log at startup.

Keep me posted on the progress with these issues. 

Thanks
Sohil

Jaap van Hengstum

unread,
Sep 20, 2012, 3:45:38 PM9/20/12
to openmobs...@googlegroups.com
The good thing is, everything seems to be working now both on the emulator and the device. 

The bad thing is, I still don't know what went wrong. I checked the moblet-app.xml and it did have the correct channel name. So I did a full rebuild of everything and reinstalled the apps on the emulator, and it worked.

As for the device, I changed the app to use the BaseCloudActivity instead of the screens and I didn't put in the bit where it waits for the bootup to complete. So my guess is, I didn't see any data because the bootup hadn't completed yet and when I saw all those socket errors on the server I assumed that it wasn't working because of that.

Sohil Shah

unread,
Sep 20, 2012, 5:39:00 PM9/20/12
to openmobs...@googlegroups.com
Hi Jaap,

From your stacktrace when I look at the code it comes down to the Sync Channel not deployed on the server. Are you in JBoss mode or AppCreator Dev Mode of the Cloud Server? If you are in DevMode Cloud Server you should see SyncML xml in your console when the sync starts. Did you see these messages?

In JBoss mode this can happen if you forget to copy your app's moblet jar file to the "deploy" directory. Not being near the machine where things went wrong it is hard to tell what could have gone wrong.

From a best practices standpoint you are doing the right thing by using a BaseCloudActivity instead of screens. Screens is something I quickly hacked together to help me build sample apps. I don't recommend using this framework for your production level development. Another reason screens are not recommended is because they do not support multiple activities in an App. A production app will have many Activities.

As per the boot sync goes, you should display some message if the data is not ready. You may not wait but it is good for the user to know that the data is not ready yet. I personally prefer a busy wait for a few seconds and then a message to restart the app. Just a suggestion. Its up to the App's user experience requirements.

Thanks
Sohil
Reply all
Reply to author
Forward
0 new messages