Support Topics Documentation Slack YouTube Blog

custom business logic issue


(gil Versokler) #1

Dear Backendless,

I would like to know my options to to implement custom business logic within back endless timer with another thread except WSDL or AWS etc…?

Workflow

Create timer running each 60 sec and importing XML data and adding to Backendless4.0 cloud.(I’v already done it!)

I got error when i’m doing http request within timer.

Datajava.security.AccessControlException: You have no permission to create thread in CodeRunner secure group.
at com.backendless.coderunner.runtime.security.CodeRunnerSecurityManager.checkAccess(CodeRunnerSecurityManager.java:59)
at java.lang.ThreadGroup.checkAccess(ThreadGroup.java:315)
at java.lang.ThreadGroup.getParent(ThreadGroup.java:167)
at sun.net.www.http.KeepAliveCache$1.run(KeepAliveCache.java:102)
at sun.net.www.http.KeepAliveCache$1.run(KeepAliveCache.java:96)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.http.KeepAliveCache.put(KeepAliveCache.java:95)
at sun.net.www.protocol.https.HttpsClient.putInKeepAliveCache(HttpsClient.java:659)
at sun.net.www.http.HttpClient.finished(HttpClient.java:395)
at sun.net.www.http.KeepAliveStream.close(KeepAliveStream.java:97)
at sun.net.www.MeteredStream.justRead(MeteredStream.java:93)
at sun.net.www.MeteredStream.read(MeteredStream.java:135)
at java.io.FilterInputStream.read(FilterInputStream.java:133)
at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:3375)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager$RewindableInputStream.read(XMLEntityManager.java:2919)
at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader.java:302)
at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1895)
at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.skipChar(XMLEntityScanner.java:1551)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2821)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121)
at com.letzcheerdb.models.gameXmlParserData.getXmlData(gameXmlParserData.java:66)
at com.letzcheerdb.timers.LiveGameImporterTimer.execute(LiveGameImporterTimer.java:28)
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 com.backendless.coderunner.runtime.task.TimerInvocationTask.runImpl(TimerInvocationTask.java:52)
at com.backendless.coderunner.runtime.executor.ExtendedRunnable.run(ExtendedRunnable.java:39)
at java.lang.Thread.run(Thread.java:748)

getXmlData:You have no permission to create thread in CodeRunner secure group.

Please your right advice if i need to buy some package.


(Mark Piller) #2

Hi Gil,

Is the timer itself running in the Backendless 3.x or the 4.0 environment?

Regards,
Mark


(gil Versokler) #3

Hi Mark,

Backendless 4.0

gil


(Mark Piller) #4

Hi Gil,

The error is strange since Backendless 4 Beta allows the creation of additional threads. All apps are on the Cloud99 plan while in beta where up to 5 threads are allowed.

Could you please check what version of coderunner you are using?
Does the error happen when the timer is deployed and runs on our servers or in the debug mode?

Regards,
Mark


(gil Versokler) #5

Hi Mark

CodeRunner Version: 4.0.b18

The error happening debug mode, should i need to deploy?

Note:
The process going outside BackendLess for import data and add to Backendless, it’s might impossible?

Based on your last remark bellow link
http://support.backendless.com/t/how-to-add-custom-jar-file-on-backendless-server-code

Thanks,
Gil


(Mark Piller) #6

Hi Gil,

I just tested it with 4.0b18. CodeRunner allows to create up to 5 threads. If you’re getting an exception, it means the code (or any of the dependencies you are using) has allocated the threads and you’re exceeding the limit.

You can either refactor the logic to remove the dependencies which spawn extra threads or wait until 4.0 goes out of Beta when you will be able to purchase a function pack allowing additional threads.

Regards,
Mark


(gil Versokler) #7

Hi Mark,

Thank you for your assistance.

I’ll try according by your advice.

Does “Cloud Code scripts” is function pack ?

There is any predictable for release date for 4.0?

Regards,
Gil


(Mark Piller) #8

Function packs are not available for Backendless 4 yet. They will appear in Backendless Console when 4.0 is released from Beta (approximately in about a week).

Regards,
Mark


(gil Versokler) #9

Ok, Thank you. So i’ll wait then.

Regards,
Gil


(Samuel Castro) #10

Hi Mark,

Im just getting the same error, Im in free plan. So I have 2 questions:

Free plan allows 1 thread?
how many threads allows the developer plan?

Thanks


(Mark Piller) #11

Hi Samuel,

Both free and developer plans allow 1 thread.

Regards,
Mark


(Sergey Chupov) #12

Meanwhile, the function packs have already been added.