0

Preview Fatal error

Hi,
I get this error when I try to preview my app

Debug Messages:

Fatal Exception: java.lang.ClassCastException: ModuleEnvelope

by
19 Replies
  • Hi,

    would you be able to post a link to your application so we can take a look?

    Thanks,

    Tom
    Yahoo! Developer Network
    0
  • http://apps.yahoo.com/-geDzhp6s

    It happens on developer preview, on live it just does not show anything.
    0
  • After a little rooting around we think this is caused by some invalid CSS.

    For example

    CODE
    .cat {
    color: meow;
    }


    would throw an error because "meow" is not a valid color.
    0
  • QUOTE (sh1mmer @ Jan 5 2009, 12:01 PM) <{POST_SNAPBACK}>
    After a little rooting around we think this is caused by some invalid CSS.

    For example

    CODE
    .cat {
    color: meow;
    }


    would throw an error because "meow" is not a valid color.


    You were right, I removed all the css and it works. Is there any way to pinpoint the problematic css?

    Thanks.
    0
  • Right now I don't think our platform pinpoints the issue.

    You could try running it through W3C validator http://jigsaw.w3.org/css-validator/ which should give you an indication.
    0
  • QUOTE (sh1mmer @ Jan 5 2009, 12:01 PM) <{POST_SNAPBACK}>
    After a little rooting around we think this is caused by some invalid CSS.

    For example

    CODE
    .cat {
    color: meow;
    }


    would throw an error because "meow" is not a valid color.


    This could also be caused by malformed JS code.

    Make sure you're not leaving commas in literals or have unclosed braces of any type, {}, [] or ().
    For example:

    CODE
    var myObj = { foo: { bar: '1' }, { baz: '2' }; // tricky to catch when skimming over code

    var myfunc = function()
    {

    } // should have a semicolon here


    There are more cases, but that's the general idea. Make sure your JS/CSS have proper syntax.
    0
  • The css validates fine on w3c and it is definitely that as when I remove it it works.
    0
  • I narrowed down the problem to this css:

    .buttons td{
    padding: 4px 8px;
    border:1px #898989 solid;
    background-color:#F1F1F1;
    color:#333333;
    font-family:Verdana 12px;
    text-align:center;

    }
    .buttons td a{
    color:#333333;
    font-family:Verdana 10px;
    font-weight:bold;
    }
    .buttons td:hover{
    padding: 4px 8px;
    border:1px #898989 solid;
    background-color:#1D4999;
    color:#333333;
    font-family:Verdana 12px;
    text-align:center;

    }
    .buttons td:hover a{
    color:#ffffff;
    font-family:Verdana 10px;
    font-weight:bold;
    text-decoration:none;
    }

    .buttonselected {
    padding: 4px 8px;
    border:1px #898989 solid;
    background-color:#1D4999;
    color:#333333;
    font-family:Verdana 12px;
    text-align:center;

    }
    .buttonselected a{
    color:#ffffff;
    font-family:Verdana 10px;
    font-weight:bold;
    }

    any ideas how to replace it with something that works ?
    0
  • Hi kramaleygames,

    Here's your modified CSS - this will work with Caja. A few takeaways here:
    - I changed font-family to font and re-ordered to the standard "fontsize fontfamily" order
    - I reordered your border specs to the standard "bordersize bordertype bordercolor" order

    CODE
    .buttons td{
    padding: 4px 8px;
    border:1px solid #898989;
    background-color:#F1F1F1;
    color:#333333;
    font:12px verdana;
    text-align:center;

    }
    .buttons td a{
    color:#333333;
    font:10px Verdana;
    font-weight:bold;
    }
    .buttons td:hover{
    padding: 4px 8px;
    border:1px solid #898989;
    background-color:#1D4999;
    color:#333333;
    font:12px verdana;
    text-align:center;

    }
    .buttons td:hover a{
    color:#ffffff;
    font:10px verdana;
    font-weight:bold;
    text-decoration:none;
    }

    .buttonselected {
    padding: 4px 8px;
    border:1px solid #898989;
    background-color:#1D4999;
    color:#333333;
    font:12px verdana;
    text-align:center;

    }
    .buttonselected a{
    color:#ffffff;
    font:10px verdana;
    font-weight:bold;
    }


    Jonathan LeBlanc
    Senior Software Engineer
    Yahoo! Developer Network
    0
  • Thank you very much it works great!

    By the way sorry to be out of topic but is there a callback when someone invites their friends to use the app?

    Kind Regards,

    Kramaley Games.
    0
  • No problem, glad to help. If you make a custom invite using yml:message you can use the params field to pass query parameters (e.g. ?param1=test&param2=test2) to pass values to the same page (or another "view") to build callback functionality based on the params posted. That's one method of doing that...but if there is something more specific let me know.

    - Jon

    QUOTE (kramaleygames @ Jan 5 2009, 02:24 PM) <{POST_SNAPBACK}>
    Thank you very much it works great!

    By the way sorry to be out of topic but is there a callback when someone invites their friends to use the app?

    Kind Regards,

    Kramaley Games.
    0
  • I have another question about Iframes not allowed. We have offers for players to get reward points for use within our game and it is provided by myofferpal.com
    that needs to include an iframe to work. Any ideas or alternative ways to do that without an iframe ?

    Thanks :)
    0
  • To be honest I haven't worked with myofferpal before. When lookign at their site it appears that they do not have integration for signup within YAP yet.

    Regarding the iframe, it really depends on the code that you are trying to work with. What will probably need to happen is that the integration code that you will implement will need to conform to Caja's javascript / standards specs without the iframe, maybe a flash implementation, or something like that.

    In other words, it really depends on the avenue that myofferpal wishes to pursue.

    - Jon

    QUOTE (kramaleygames @ Jan 6 2009, 10:01 AM) <{POST_SNAPBACK}>
    I have another question about Iframes not allowed. We have offers for players to get reward points for use within our game and it is provided by myofferpal.com
    that needs to include an iframe to work. Any ideas or alternative ways to do that without an iframe ?

    Thanks :)
    0
  • Hi again,

    Got the same error as in the first post when I try to use this function in JS.

    function update(){

    var out = '';
    var where = 0;
    var friends = 0;
    var frm = document.getElementById('form1');
    for(z=0; z<frm.length; z++){
    if(frm[z].type == 'checkbox'){
    if(document.getElementById('ids'+where).checked==1){
    var guid = document.getElementById('ids'+where).value;
    if(out!=''){
    var out += ','+guid;
    }else{
    var out += guid;
    }
    }
    }
    }

    document.getElementById('to').value = out;

    }
    0
  • Looking into it, I'll run a few tests and get back to you shortly.

    - Jon

    QUOTE (Kramaley G @ Jan 16 2009, 06:12 AM) <{POST_SNAPBACK}>
    Hi again,

    Got the same error as in the first post when I try to use this function in JS.
    0
  • Upon looking at the sample a little closer and running a verification test, it appears the issue that you are running into here is caused by this block:
    CODE
    if(out!=''){
    var out += ','+guid;
    }else{
    var out += guid;
    }


    Since you are declaring the variable "out" at the top of the function, the parser is throwing an error because you are attempting to re-declare the same variable. If you change that piece of the code to the following you should no longer see that message:
    CODE
    if(out!=''){
    out += ','+guid;
    }else{
    out += guid;
    }


    Working on a better error reporting system is high on the priority list here, so know that these messages will not always remain so cryptic :) }
    0
  • thanks for the superb support :)
    0
  • Another quick question, is there anyway to use ajax and if yes what libs/methods work ?
    0
  • The best functionality I've found for making ajax requests is to use the OpenSocial gadgets.io.makeRequest method. On the apps I've worked on I've seen that it has been a solid method on YAP.

    - Jon

    QUOTE (Kramaley G @ Jan 21 2009, 03:03 AM) <{POST_SNAPBACK}>
    Another quick question, is there anyway to use ajax and if yes what libs/methods work ?
    0
  • Hi again,

    I try to use the following code to make an ajax request and I get back an error on firefox error console
    "Error: Cannot read property "protocol" from undefined
    Source File: http://l.yimg.com/kj/yap/combo?/caja/js/ca...vR3E7lJbH0g-.js
    Line: 1"

    function makeRequest(url, postdata) {
    var params = {};
    postdata = gadgets.io.encodeValues(postdata);
    params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.POST;
    params[gadgets.io.RequestParameters.POST_DATA]= postdata;
    gadgets.io.makeRequest(url, response, params);
    }

    function response(obj) {
    document.getElementById('interact').setTextValue('Populated!');
    document.getElementById('population').setInnerHTML(obj.text);
    }



    function giveYoung(id){

    document.getElementById('interact').setTextValue('Populating...');

    var data = {
    action : \"giveYoung\",
    id : id
    };

    makeRequest(\"ajax.php\", data);


    }

    Thank you :)
    0
  • Hi Kramaley,

    I sometimes receive that undefined message when running makeRequest as well. In my case what was happening was that I was using the ajax request to call an intermediate helper file which instantiated a 3-legged OAuth session and reset the small view / collected user data. For my case, the replacement of the makeRequest function with yml:a solved the issue. Does this sound similar to the problem that you are experiencing (re. the 3-legged OAuth instantiation)?

    Jonathan LeBlanc
    Senior Software Engineer
    Yahoo! Developer Network

    QUOTE (Kramaley G @ Jan 29 2009, 06:22 AM) <{POST_SNAPBACK}>
    Hi again,

    I try to use the following code to make an ajax request and I get back an error on firefox error console
    "Error: Cannot read property "protocol" from undefined
    Source File: http://l.yimg.com/kj/yap/combo?/caja/js/ca...vR3E7lJbH0g-.js
    Line: 1"

    function makeRequest(url, postdata) {
    var params = {};
    postdata = gadgets.io.encodeValues(postdata);
    params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.POST;
    params[gadgets.io.RequestParameters.POST_DATA]= postdata;
    gadgets.io.makeRequest(url, response, params);
    }

    function response(obj) {
    document.getElementById('interact').setTextValue('Populated!');
    document.getElementById('population').setInnerHTML(obj.text);
    }



    function giveYoung(id){

    document.getElementById('interact').setTextValue('Populating...');

    var data = {
    action : \"giveYoung\",
    id : id
    };

    makeRequest(\"ajax.php\", data);


    }

    Thank you :)
    0
  • Hi Jon,

    I get this error when the page loads I do not even get the chance to run the makerequest. Unfortunately yml:a does not help in the current situation.


    QUOTE (Jon @ Jan 29 2009, 08:50 AM) <{POST_SNAPBACK}>
    Hi Kramaley,

    I sometimes receive that undefined message when running makeRequest as well. In my case what was happening was that I was using the ajax request to call an intermediate helper file which instantiated a 3-legged OAuth session and reset the small view / collected user data. For my case, the replacement of the makeRequest function with yml:a solved the issue. Does this sound similar to the problem that you are experiencing (re. the 3-legged OAuth instantiation)?

    Jonathan LeBlanc
    Senior Software Engineer
    Yahoo! Developer Network
    0
  • Ok, I managed to get the function to start working but when the callback is called nothing is returned and nothing is done although I made sure some string is always returned for testing purposes.
    0
  • makerequest returns error 400 any idea what it means ?

    Thanks,
    0
  • Hi Kramaley,

    I posted a response to the probably reason for the 404 on your other thread here: http://developer.yahoo.net/forum/index.php?showtopic=700

    - Jon

    QUOTE (Kramaley G @ Jan 29 2009, 01:38 PM) <{POST_SNAPBACK}>
    makerequest returns error 400 any idea what it means ?

    Thanks,
    0
  • Hello,

    I'm getting the same ModuleEnvelope error as the first post. I'm getting the fatal exception even when I use the sample code posted by Yahoo for their OpenSocial examples:

    http://developer.yahoo.com/yap/guide/opens...l-examples.html

    In the meantime while you guys are working to improve the error messages, if you can post common code snippets that cause the Caja parser to choke that would be very helpful.

    Thanks.
    0
  • Hi dolamitem,

    I'll take a look at the samples on that page to see what the problem may be. Regarding the code snippits for caja, we are currently working on creating samples for some of the more common tasks. Stay tuned for those.

    - Jon

    QUOTE (dolamitem @ Feb 9 2009, 03:21 PM) <{POST_SNAPBACK}>
    Hello,

    I'm getting the same ModuleEnvelope error as the first post. I'm getting the fatal exception even when I use the sample code posted by Yahoo for their OpenSocial examples:

    http://developer.yahoo.com/yap/guide/opens...l-examples.html

    In the meantime while you guys are working to improve the error messages, if you can post common code snippets that cause the Caja parser to choke that would be very helpful.

    Thanks.
    0
  • here's a link to my opensocial app (which is working on Myspace) but not working on yahoo:

    http://www.experienceproject.com/platform_...vecats_test.php

    any help would be greatly appreciated!
    0
  • Hi dolamitem,

    It looks like the activities demo issue is the same one talked about here: http://developer.yahoo.net/forum/index.php?showtopic=314. I ran the code sample with those changes and it works well. I'll try to get that changed to function well on the current platform.

    Let me know if you run into any other issues with it.

    Jonathan LeBlanc
    Senior Software Engineer
    Yahoo! Developer Network

    QUOTE (dolamitem @ Feb 9 2009, 04:59 PM) <{POST_SNAPBACK}>
    here's a link to my opensocial app (which is working on Myspace) but not working on yahoo:

    http://www.experienceproject.com/platform_...vecats_test.php

    any help would be greatly appreciated!
    0
  • Recent Posts

    in YAP