Server code only running in debug mode

Hi

I created server buisness logic, but it only running if I start it in DEBUG mode. If I deploy it to server, code is not running and timed out by 5 seconds delay.

What is wrong there?

Hi, Marat.

Can I look at your code?
And… you use Windows operation system?

Regards,
Kate.

[reply user_id=76][h4]Катя Максименко wrote:[/h4]Hi, Marat.

Can I look at your code?
And… you use Windows operation system?

Regards,
Kate.[/reply]Hi Kate.
Sure, here it is:


    @Override
public void beforeCreate(RunnerContext context, Bid bid) throws Exception {

System.out.println("Before get order");        Order existingOrder = Order.findById(bid.getOrder().getObjectId());
        System.out.println("Got order " + existingOrder.getObjectId());
        if(bid.getOrder().getBidWinner()==null) {
            PushUtil.sendPush(bid.getDriver().getObjectId(), Const.TYPE_ACCEPT, bid.getDeviceId(), existingOrder);
        } else {
            PushUtil.sendPush(bid.getDriver().getObjectId(), Const.TYPE_DENY, bid.getDeviceId(), existingOrder);
        }
}
public class PushUtil {


    public static void sendPush(String userId, String type, String deviceId, Order order)
    {
        DeliveryOptions deliveryOptions = new DeliveryOptions();
        deliveryOptions.setPushPolicy(PushPolicyEnum.ONLY);
        deliveryOptions.addPushSinglecast(deviceId);
        PublishOptions publishOptions = new PublishOptions();
        publishOptions.putHeader("type", type);
        publishOptions.putHeader("order", order.getObjectId());
        if(type.equals(Const.TYPE_ACCEPT)) {
            order.setBidWinner(Users.findById(userId));
            order.save();
        } else if (type.equals(Const.TYPE_DENY)) {
        } else if (type.equals(Const.TYPE_PROPOSE)) {
        }
        System.out.println("Send push to " + deviceId);
        MessageStatus status = Backendless.Messaging.publish("new_message", publishOptions, deliveryOptions );
    }
}

Used Mac OS while testing.

Regards
Marat

Can you try to deploy code again?
And please send us your Bootstrap.java
(attach here or send to kateryna.maksimenko@gmail.com)

Regards,
Kate.

Now on debug still works fine, after deploy server responce me with “Connection refused” error in about 3 seconds.

Bootstrap.java sent to provided email.

Thanks
Marat

Could you check again?
We made some changes.

Regards,
Kate.

Now server reply me “Version is disabled or provided wrong application info (application id or secret key)”
In debug mode still works fine.

Regards
Marat

Hi, Marat!

Please, could you check again this issue?

Regards,

Kate.

Same “Version is disabled or provided wrong application info (application id or secret key)”

Regards
Marat

You added the same appid and secret key in Bootstarap.java and in runner. properties file?

Yes, sure. And as before, in debug mode it works fine.

Regards
Marat

This issue is already resolved.
Write us if you encounter problems.

Regards,
Kate.