Backendless Support
 
Answered

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

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:

  1. 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.

Leave a Comment

Comments (11)

photo
1

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.

Regards,

Mark

photo
1

Hi Mark,

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

Regards,

photo
1

1) Could you provide your appId, and the archive with code. (You can send your code on support@backendless.com with link on this topic.)

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

photo
1

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 "./Deploy.sh". I review this proyect of Mark and he didn´t do that:

https://www.dropbox.com/s/oz9bll9vypaistd/SupportAppDemo.zip?dl=0

Regards,

photo
1

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

  1. 400 - Type:"java.lang.NoClassDefFoundError",
  2. Description:"Could not initialize class
  3. sun.security.ssl.SSLContextImpl$TLSContext",
  4. ExceptionClass:"ServiceException" {Msg:"none", Cause:"none"}

Have you such error?

photo
1

I was trying the method "addCardToMerchant" and the error was:

  1. 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.

Regards,

photo
1

It strange, because i just took your project, built it and deployed to my app. And i receive error about sun.security.ssl.SSLContextImpl$TLSContext also in debug mode.

Did you change anything in security.policy file ?

photo
1

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.

Regards,

photo
1

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.

http://mvnrepository.com/artifact/commons-logging/commons-logging/1.2

photo
1

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:

  1. 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.

Regards,

photo
1

Hello, Samuel

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

photo