Support Topics Documentation Slack YouTube Blog

Custom Business Logic works perfect in debug but fails in deployed mode

(Samuel Castro) #1

Hi to all,

I’ve been trying to set the custom bussines logic for my app, it works perfect when is in debug mode but it fails when I deploy it and I try to get a response (from de Backendless console or my app) I always get the following error:

400 - Type:"java.lang.NoClassDefFoundError", Description:"org/apache/commons/logging/LogFactory", ExceptionClass:"ServiceException" {Msg:"none", Cause:"none"}

My theory is that I am overload the space available for the custom service code(by the way I am also confuse about this limit: In the docs says: 2 mb, in the pricing plans says:5 mb) and part of the code to deploy isn’t uploading correctly.

Pd. My libs folder size is 3 mb and my class files is 250kb

Thanks for your support.

(Mark Piller) #2

Hi Samuel,

Do you see any warnings about the deployment size on the Manage > Billing screen? (make sure to click the “show current usage” link.


(Samuel Castro) #3

Hi Mark,

No warnings(I attach the screen). Any ideas ?


(Oleg Vyalyh) #4
  1. Could you provide your appId, and the archive with code. (You can send your code on with link on this topic.)

  2. All your libraries and are in the one zip archive?

(Samuel Castro) #5

Hi Oleg,

1)I already send the proyect to support (The issue of the mail is the same of this topic), my appId is also in the mail.

2)I didn’t understand you. Did you mean I had to put all my third-part libraries in one zip before uploading to production? with the command “./”. I review this proyect of Mark and he didn´t do that:


(Oleg Vyalyh) #6

When i invoke method deleteMerchantCard in DEBUG mode, i receive this error message:

400 - Type:"java.lang.NoClassDefFoundError", 
 Description:"Could not initialize class$TLSContext", 
ExceptionClass:"ServiceException" {Msg:"none", Cause:"none"} 

Have you such error?

(Samuel Castro) #7

I was trying the method “addCardToMerchant” and the error was:

400 - Type:"java.lang.NoClassDefFoundError", Description:"org/apache/commons/logging/LogFactory", ExceptionClass:"ServiceException" {Msg:"none", Cause:"none"}

…but only in Deploy mode, when I call it in debug mode I don’t get any error with any method.


(Oleg Vyalyh) #8

It strange, because i just took your project, built it and deployed to my app. And i receive error about$TLSContext also in debug mode.
Did you change anything in security.policy file ?

(Samuel Castro) #9

No, I didn’t change nothing about the security.policy file. In fact I’m using this api because I don’t have troubles about that kind of things(like other libraries I tried to used) and I could use it from my app and from the console of backendless(at least in the debug mode) .

I’m going to create a complete new proyect(from the sample code downloaded from Backendless) and copy all the code to review if this solves the problem, I’ll inform you the result.


(Oleg Vyalyh) #10

Hi, Samuel. Due to limitations on running code the behaviour on the server side may differ from that you see during local launching.
Just add apache commons logging to your lib folder.

(Samuel Castro) #11

Hi Oleg,

Thank you for your support. Adding commons logging jar to my libs folder works.
Then I got another issue at execute time in Deploy mode:

400 - Type:"java.lang.NoSuchFieldError", Description:"INSTANCE" 

This was caused because I had two versions of the http-core library(4.7 and 4.2) so I delete 4.2 and now all is working in deploy mode.

Just to clarify the issue why in debug mode I didn`t get the error(if the commons logging lib was missing too)?

Thank you once again.

(Sergey Kukurudzyak) #12

Hello, Samuel

it is possible that in debug mode jar with logging was include in some other way not clear for code runner.