Hi all,
Finally I have developed and put in production my first B4J web app following the instructions of the different B4J tutorials .
Some features:
- Use MsSQL database to report work requests daily.
- Use ABMaterial framework
- Login page with initial generic password.
- Reset password page at first login.
- Work request details page including images and GPS location to report.
- Send websocket message to mobile devices (with B4A app) to notify a new request created.
- Requests list with state to edit or show details from that
- Other ...
The app is running for one month receiving almost 100 daily requests with very good speed and performance.
If someone wants to know specific details of how to implement some of the mentioned features , feel free to ask.
Likewise as in any new application there are some errors that require correction. If someone know how to solve them or have any idea, your suggestions are welcome.
Work request screen shot ...
Some errors to solve ....
1. Threads interrupted..
When this error appears, I have to restart the app because the database access is interrupted (the error is shown several times):
2. When restart app...
3. Related to mobile websockets module...
The following error are showing from I has implemented a module to send messages to B4A android mobile app using websockets.
(The error appears ay time when I am not sending remote mesagges to device):
Regards
Finally I have developed and put in production my first B4J web app following the instructions of the different B4J tutorials .
Some features:
- Use MsSQL database to report work requests daily.
- Use ABMaterial framework
- Login page with initial generic password.
- Reset password page at first login.
- Work request details page including images and GPS location to report.
- Send websocket message to mobile devices (with B4A app) to notify a new request created.
- Requests list with state to edit or show details from that
- Other ...
The app is running for one month receiving almost 100 daily requests with very good speed and performance.
If someone wants to know specific details of how to implement some of the mentioned features , feel free to ask.
Likewise as in any new application there are some errors that require correction. If someone know how to solve them or have any idea, your suggestions are welcome.
Work request screen shot ...
Some errors to solve ....
1. Threads interrupted..
When this error appears, I have to restart the app because the database access is interrupted (the error is shown several times):
WARNING: Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@7fc54e6a is interrupting all Threads waiting on a resource to checkout. Will try again in response to new client requests.Sep 21, 2016 7:46:19 AM com.mchange.v2.resourcepool.BasicResourcePool forceKillAcquires
WARNING: Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@7fc54e6a is interrupting all Threads waiting on a resource to checkout. Will try again in response to new client requests.Sep 21, 2016 7:46:20 AM com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask run
WARNING: com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@259c3fd4 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:java.sql.SQLException: Network error IOException: Address already in use: connect at net.sourceforge.jtds.jdbc.JtdsConnection.<init>(JtdsConnection.java:436) at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184) at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:146) at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:195) at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:184) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:200) at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1086) at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1073) at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:44) at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1810) at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:648)Caused by: java.net.BindException: Address already in use: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) at java.net.AbstractPlainSocketImpl.connect(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at net.sourceforge.jtds.jdbc.SharedSocket.createSocketForJDBC3(SharedSocket.java:288) at net.sourceforge.jtds.jdbc.SharedSocket.<init>(SharedSocket.java:251) at net.sourceforge.jtds.jdbc.JtdsConnection.<init>(JtdsConnection.java:331) ... 10 moreSep 21, 2016 7:46:20 AM com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask run
2. When restart app...
c:\SMAC0434_WEB>java -jar STs.jarGZipping HTML, JavaScript and CSS files...Optimizing new and updated PNG files...2016-09-21 08:04:34.731:INFO::main: Logging initialized @29219ms2016-09-21 08:04:35.059:INFOejs.Server:main: jetty-9.3.z-SNAPSHOT2016-09-21 08:04:35.809:INFOejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@20398b7c{/,file:///C:/SMAC0434_WEB/www/,AVAILABLE}2016-09-21 08:04:35.809:INFOejs.AbstractNCSARequestLog:main: Opened C:\SMAC0434_WEB\logs\b4j-2016_09_21.request.log2016-09-21 08:04:35.903:INFOejs.ServerConnector:main: Started ServerConnector@22000e7b{HTTP/1.1,[http/1.1]}{0.0.0.0:40434}2016-09-21 08:04:35.903:INFOejs.Server:main: Started @30386msjava.lang.RuntimeException: org.eclipse.jetty.websocket.api.WebSocketException:RemoteEndpoint unavailable, current state [CLOSED], expecting [OPEN or CONNECTED] at anywheresoftware.b4j.object.WebSocket.setEvents(WebSocket.java:378) at anywheresoftware.b4j.object.WebSocketModule$Adapter$ThreadHandler.run(WebSocketModule.java:190) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)Caused by: org.eclipse.jetty.websocket.api.WebSocketException: RemoteEndpoint unavailable, current state [CLOSED], expecting [OPEN or CONNECTED] at org.eclipse.jetty.websocket.common.WebSocketSession.getRemote(WebSocketSession.java:299) at anywheresoftware.b4j.object.WebSocket.sendText(WebSocket.java:107) at anywheresoftware.b4j.object.WebSocket.setEvents(WebSocket.java:375) ... 6 more2016-09-21 08:04:39.689:WARNejwc.Parser:qtp1395089624-26rg.eclipse.jetty.websocket.api.ProtocolException: Unknown opcode: 7 at org.eclipse.jetty.websocket.common.Parser.parseFrame(Parser.java:325) at org.eclipse.jetty.websocket.common.Parser.parse(Parser.java:252) at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.readParse(AbstractWebSocketConnection.java:663) at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.onFillable(AbstractWebSocketConnection.java:493) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:261) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95) at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:75) at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:213) at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:147) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572) at java.lang.Thread.run(Unknown Source)org.eclipse.jetty.websocket.api.ProtocolException: Unknown opcode: 7 at org.eclipse.jetty.websocket.common.Parser.parseFrame(Parser.java:325) at org.eclipse.jetty.websocket.common.Parser.parse(Parser.java:252) at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.readParse(AbstractWebSocketConnection.java:663) at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.onFillable(AbstractWebSocketConnection.java:493) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:261) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95) at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:75) at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:213) at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:147) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572) at java.lang.Thread.run(Unknown Source)
3. Related to mobile websockets module...
The following error are showing from I has implemented a module to send messages to B4A android mobile app using websockets.
(The error appears ay time when I am not sending remote mesagges to device):
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeExcepti
on: java.lang.NullPointerException
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:114)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
at anywheresoftware.b4j.object.WebSocketModule$Adapter$1.run(WebSocketMo
dule.java:126)
at anywheresoftware.b4a.keywords.SimpleMessageLoop.runMessageLoop(Simple
MessageLoop.java:30)
at anywheresoftware.b4a.StandardBA.startMessageLoop(StandardBA.java:26)
at anywheresoftware.b4j.object.WebSocketModule$Adapter$ThreadHandler.run
(WebSocketModule.java:195)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.Nul
lPointerException
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:471)
at anywheresoftware.b4a.keywords.Common.CallSubNew(Common.java:409)
at sts.sismac.net.st_edit._page_parseevent(st_edit.java:1625)
at sun.reflect.GeneratedMethodAccessor97.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
... 10 more
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:114)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:462)
... 16 more
Caused by: java.lang.NullPointerException
at sts.sismac.net.abmshared._connectnavigationbar(abmshared.java:610)
at sts.sismac.net.st_edit._connectpage(st_edit.java:660)
at sts.sismac.net.st_edit._page_ready(st_edit.java:1659)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
... 17 moreThank you in advance,
Regards