Any changes in Java HTTP Box naming in the last couple of months?

9 views
Skip to first unread message

Joel Hughes

unread,
Dec 14, 2017, 11:27:21 AM12/14/17
to foam-framework-discuss
Can anyone recall changes to Java HTTPBox naming in the past couple of months?
Scanned the commit logs, but nothing jumped out. 

Upgrading/Updating an app last deployed in September with the last foam and getting the following on my requests to java running on Google App Engine.

{"class":"foam.box.Message","attributes":{},"object":{"class":"foam.box.NoSuchNameException","name":""}}

Request:
  1. {class: "foam.box.Message", attributes: {replyBox: {class: "foam.box.HTTPReplyBox"}},…}
    1. class:"foam.box.Message"
    2. object:{class: "foam.box.SubBoxMessage", name: "Configuration", attributes: {},…}
      1. attributes:{}
      2. class:"foam.box.SubBoxMessage"
      3. name:"Configuration"

This example is on a package/class: com.serviceecho.workorder.schedule.Configuration

Assuming I need some additional configuration. 

Thanks for any info.
Joel

Joel Hughes

unread,
Dec 14, 2017, 3:36:22 PM12/14/17
to foam-framework-discuss
Adam
Can you point me to a java servlet example so I can verify against my implemenetation?
Thanks
Joel

            ((BoxRegistryBox)x.get(BoxRegistryBox.class.getSimpleName())).send(msg);



Joel Hughes

unread,
Dec 14, 2017, 9:38:17 PM12/14/17
to Adam Van Ymeren, foam-framework-discuss
Hi Adam
So my servlet is modelled after origintrials.servlets.APIServlet, is this style still supported?
I've been using this particular Servlet for probably close to a year now, something in the underlying box/registry in last couple of months has changed.  I'm ok with refactoring as you do, but I've got nothing to go on. 

Thanks for any ideas.
Joel 

On Thu, Dec 14, 2017 at 6:00 PM, Adam Van Ymeren <ad...@vany.ca> wrote:
The payload you posted has a subbox messages named 'Configuration' inside an additional subbox message also named 'Configuration' but I doubt that matches the server configuration.

I would investigate why it's being decorated twice.

I'm away from my computer at the moment so I can't point you to any examples but will try to do so later.

Most of our modern box stuff is in foam/nanos, but nanos doesn't currently use a box registry.

Joel Hughes

unread,
Dec 19, 2017, 3:10:16 PM12/19/17
to foam-framework-discuss
LocalBoxRegistry failing with ClassNotFoundException on what I believe is this cast to 'Registration'. 
I can't find reference to Registration elsewhere so suspect something was removed/changed and this was missed. 

LocalBoxRegistry.doLookup

      javaCode: `
Object registration = getRegistry_().get(name);
if ( registration == null ) {
  throw new RuntimeException("No such name");
}
return ((Registration)registration).getExportBox();
`
    },



In my call LocalBoxRegistry.register I'm not requesting anything name Registration, hence I believe it's the cast above.  The stack trace doesn't line exactly with the  `` code blocks. 


INFO: namespace: namespace, model:


        com.serviceecho.ui.map.RouteConfiguration, class: class com.serviceecho.ui.map.RouteConfiguration


Dec 19, 2017 7:56:48 PM com.serviceecho.api.APIContext build


SEVERE: java.lang.RuntimeException: java.lang.ClassNotFoundException: Registration


java.lang.RuntimeException: java.lang.RuntimeException: java.lang.ClassNotFoundException: Registration


        at foam.core.SimpleFacetManager.create(SimpleFacetManager.java:65)


        at foam.core.AbstractX.create(EmptyX.java:63)


        at foam.core.AbstractX.create(EmptyX.java:59)


        at foam.box.LocalBoxRegistry.register(LocalBoxRegistry.java:106)

Joel Hughes

unread,
Dec 19, 2017, 3:29:46 PM12/19/17
to Adam Van Ymeren, foam-framework-discuss
Yes it does. 

  public static class Registration extends foam.core.AbstractFObject {

Joel

On Tue, Dec 19, 2017 at 3:24 PM, Adam Van Ymeren <ad...@vany.ca> wrote:
Joel Hughes <joel.l...@gmail.com> writes:

> LocalBoxRegistry failing with ClassNotFoundException on what I believe is this cast to 'Registration'.
> I can't find reference to Registration elsewhere so suspect something
> was removed/changed and this was missed.

Does your generated LocalBoxRegistry.java contain the Registration inner class?

public static class Registration extends foam.core.AbstractFObject {

>
> LocalBoxRegistry.doLookup
>
> javaCode: `
> Object registration = getRegistry_().get(name);
> if ( registration == null ) {
> throw new RuntimeException("No such name");
> }
> return ((Registration)registration).getExportBox();
> `
> },
>
> In my call LocalBoxRegistry.register I'm not requesting anything name Registration, hence I believe it's the cast above. The stack trace doesn't line exactly with the `` code blocks.
>
> INFO: namespace: namespace, model:
>
> com.serviceecho.ui.map.RouteConfiguration, class: class com.serviceecho.ui.map.RouteConfiguration
>
> Dec 19, 2017 7:56:48 PM com.serviceecho.api.APIContext build
>
> SEVERE: java.lang.RuntimeException: java.lang.ClassNotFoundException: Registration
>
> java.lang.RuntimeException: java.lang.RuntimeException: java.lang.ClassNotFoundException: Registration
>
> at foam.core.SimpleFacetManager.create(SimpleFacetManager.java:65)
>
> at foam.core.AbstractX.create(EmptyX.java:63)
>
> at foam.core.AbstractX.create(EmptyX.java:59)
>
> at foam.box.LocalBoxRegistry.register(LocalBoxRegistry.java:106)
>
> On Thursday, December 14, 2017 at 9:38:17 PM UTC-5, Joel Hughes wrote:
>
>  Hi Adam
>  So my servlet is modelled after origintrials.servlets.APIServlet, is this style still supported?
>  I've been using this particular Servlet for probably close to a year now, something in the underlying box/registry in last couple of months has changed. I'm ok with refactoring as you do, but I've got nothing to go on.
>
>  Thanks for any ideas.
>  Joel
>
>  On Thu, Dec 14, 2017 at 6:00 PM, Adam Van Ymeren <ad...@vany.ca> wrote:
>
>  On December 14, 2017 3:36:22 PM EST, Joel Hughes <joel.l...@gmail.com> wrote:
>
>  Adam
>  Can you point me to a java servlet example so I can verify against my implemenetation?
>  Thanks
>  Joel
>
>  ((BoxRegistryBox)x.get(BoxRegistryBox.class.getSimpleName())).send(msg);
>
>  On Thursday, December 14, 2017 at 11:27:21 AM UTC-5, Joel Hughes wrote:
>
>  Can anyone recall changes to Java HTTPBox naming in the past couple of months?
>  Scanned the commit logs, but nothing jumped out.
>
>  Upgrading/Updating an app last deployed in September with the last foam and getting the following on my requests to java running on Google App Engine.
>
>  {"class":"foam.box.Message","attributes":{},"object":{"class":"foam.box.NoSuchNameException","name":""}}
>
>  Request:
>
>  1 {class: "foam.box.Message", attributes: {replyBox: {class: "foam.box.HTTPReplyBox"}},…}
>
>  1 attributes:{replyBox: {class: "foam.box.HTTPReplyBox"}}
>  2 class:"foam.box.Message"
>  3 object:{class: "foam.box.SubBoxMessage", name: "Configuration", attributes: {},…}
>
>  1 attributes:{}
>  2 class:"foam.box.SubBoxMessage"
>  3 name:"Configuration"
>  4 object:{class: "foam.box.RPCMessage", name: "select_", args: [null, null, 0, 9007199254740991, null, null],…}

Joel Hughes

unread,
Dec 19, 2017, 4:05:44 PM12/19/17
to Adam Van Ymeren, foam-framework-discuss
Hi Adam
Registration is now found. 
Thanks

So now back to the original issue. I'll provide an update later. 
Joel 

On Tue, Dec 19, 2017 at 3:38 PM, Adam Van Ymeren <ad...@vany.ca> wrote:
Joel Hughes <joel.l...@gmail.com> writes:

> Yes it does.
>
> public static class Registration extends foam.core.AbstractFObject {

Hmm, I probably can't use the context to create an inner class like
that.  Can you pull and try again when you get a chance?

Joel Hughes

unread,
Dec 19, 2017, 8:02:41 PM12/19/17
to Adam Van Ymeren, foam-framework-discuss
Found it.  I have a local modification to DatastoreDAO to support long strings - store String as type Text.  I hadn't committed the change to my fork and it got lost when I was updating everything recently. 
There was a short discussion about this on forum about a year ago, but nothing came of it, as we are all a little too busy.  

So I'm back running on the lastest FOAM against GAE. 
Thanks
Joel 

[jhughes@woodchuck foam2 (se_master)]$ git diff src/foam/dao/DatastoreDAO.java DatastoreDAO.java

diff --git a/src/foam/dao/DatastoreDAO.java b/src/foam/dao/DatastoreDAO.java

index 942064f5e..20dc3d84a 100644

--- a/src/foam/dao/DatastoreDAO.java

+++ b/src/foam/dao/DatastoreDAO.java

@@ -95,7 +95,10 @@ public class DatastoreDAO

           serialize(subEntity, (FObject) value);

           value = subEntity;

         }

-

+        if (value != null &&

+          value.getClass().equals(String.class)) {

+          value = new Text((String)value);

+        }

         target.setProperty(prop.getName(), value);

       }


@@ -130,7 +133,10 @@ public class DatastoreDAO

         if ( value instanceof EmbeddedEntity ) {

           value = deserialize((EmbeddedEntity) value);

         }

-

+        if (value != null &&

+          value.getClass().equals(Text.class)) {

+          value = ((Text)value).getValue();

+        }

         prop.set(obj, value);

       } 



On Tue, Dec 19, 2017 at 5:00 PM, Adam Van Ymeren <ad...@vany.ca> wrote:
Joel Hughes <joel.l...@gmail.com> writes:

> Hi Adam
> Registration is now found.
> Thanks
>
> So now back to the original issue. I'll provide an update later.

What was the original issue?
Reply all
Reply to author
Forward
0 new messages