Lithosphere The Lithium Community

%3CLINGO-SUB%20id%3D%22lingo-sub-310070%22%20slang%3D%22en-US%22%3EComponent%20parse%20failure%20when%20using%20%40liaAddScript%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-310070%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20getting%20the%20following%20error%20thrown%20when%20submitting%20a%20plugin%20to%20staging%20via%20the%20SDK....%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFailure%20Code%3A%20COMPONENT_PARSE_FAILURE%3CBR%20%2F%3EFailure%20Rule%3A%20CUSTOM_RULE%3CBR%20%2F%3EFailure%20Message%3A%20A%20component%20file%20in%20the%20plugin%20has%20a%20possible%20issue.%3CBR%20%2F%3EFailure%20Details%3A%20Detailed%20error%20is%3A%20No%20object%20of%20type%20lithium.web.javascript.tapestry.services.LithiumJavaScriptSupport%20is%20available%20from%20the%20Environment..%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20is%20happening%20for%20every%20component%20that%20uses%20the%26nbsp%3B%40liaAddScript%20directive.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDoes%20anybody%20have%20any%20idea%20what%20could%20be%20causing%20this%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20help%20is%20much%20appreciated!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3CP%3EJames%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EEDIT%3A%26nbsp%3B%3C%2FSTRONG%3ESorry%2C%20here%20is%20an%20example%20code%20snippet%20that%20is%20failing%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%26lt%3B%40liaAddScript%26gt%3B%3CBR%20%2F%3E%3B(function(%24)%7B%3CBR%20%2F%3EsetTimeout(function()%20%7B%3CBR%20%2F%3E%3CBR%20%2F%3E%20jQuery('.lia-category-community-management').after('%26lt%3Bli%20class%3D%22board-dropdown-item%20community-admin-link%22%26gt%3B%26lt%3Ba%20href%3D%22%2Ft5%2Fbizapps%2Fbizappspage%2Ftab%2Fcommunity%253Aadmin%22%20id%3D%22communityAdmin%22%20class%3D%22lia-link-navigation%20lia-component-admin-widget-admin%22%26gt%3BCommunity%20Admin%26lt%3B%2Fa%26gt%3B%26lt%3B%2Fli%26gt%3B%26lt%3Bli%20class%3D%22board-dropdown-item%20plugin-editor-link%22%26gt%3B%26lt%3Ba%20href%3D%22%2Ft5%2Fbizapps%2Fbizappspage%2Ftab%2Fcommunity%253Astudio%22%20id%3D%22lithiumStudio%22%20class%3D%22lia-link-navigation%20lia-component-lithiumstudio-action-lithium-studio%22%26gt%3BStudio%26lt%3B%2Fa%26gt%3B%26lt%3B%2Fli%26gt%3B')%3B%3CBR%20%2F%3E%7D%2C1000)%3B%3CBR%20%2F%3E%7D)(LITHIUM.jQuery)%3B%3CBR%20%2F%3E%26lt%3B%2F%40liaAddScript%26gt%3B%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-310222%22%20slang%3D%22en-US%22%3ERe%3A%20Component%20parse%20failure%20when%20using%20%40liaAddScript%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-310222%22%20slang%3D%22en-US%22%3E%3CP%3EEpic%2C%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGlad%20it's%20sorted%20for%20you%20%3CIMG%20class%3D%22emoticon%20emoticon-smileyhappy%22%20id%3D%22smileyhappy%22%20src%3D%22https%3A%2F%2Fcommunity.lithium.com%2Fi%2Fsmilies%2F16x16_smiley-happy.png%22%20alt%3D%22Smiley%20Happy%22%20title%3D%22Smiley%20Happy%22%20%2F%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-310221%22%20slang%3D%22en-US%22%3ERe%3A%20Component%20parse%20failure%20when%20using%20%40liaAddScript%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-310221%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.lithium.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F4904%22%20target%3D%22_blank%22%3E%40RobertT%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20managed%20to%20get%20it%20working%20and%20live%20on%20production.%20Thanks%20very%20much%20for%20your%20help%2C%20I%20will%20accept%20your%20suggestion%20to%20modify%20the%20server.conf.json%20as%20the%20solution.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJames%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-310220%22%20slang%3D%22en-US%22%3ERe%3A%20Component%20parse%20failure%20when%20using%20%40liaAddScript%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-310220%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.lithium.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F69765%22%20target%3D%22_blank%22%3E%40james_whiteley%3C%2FA%3E%2C%20it%20shouldn't%20fail%20if%20you%20know%20the%20code%20has%20run%20before.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20you%20may%20want%20to%20do%20is%20create%20the%20component%20in%20Studio%20first%20and%20test%20it%20with%20the%20same%20code%2C%20Studio%20will%20always%20override%20the%20SDK%2C%20but%20if%20you%20create%20the%20same%20component%20in%20Studio%20and%20paste%20in%20the%20code%20to%20test%20it%20should%20confirm%20if%20there%20is%20a%20problem%20with%20validation.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-310209%22%20slang%3D%22en-US%22%3ERe%3A%20Component%20parse%20failure%20when%20using%20%40liaAddScript%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-310209%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.lithium.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F4904%22%20target%3D%22_blank%22%3E%40RobertT%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20again%20for%20your%20reply.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20will%20still%20fail%20validation%20on%20production%20though%2C%20I%20would%20have%20thought.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJames%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-310113%22%20slang%3D%22en-US%22%3ERe%3A%20Component%20parse%20failure%20when%20using%20%40liaAddScript%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-310113%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.lithium.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F69765%22%20target%3D%22_blank%22%3E%40james_whiteley%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThere%20is%20one%20more%20thing%20you%20can%20try%2C%20it%20involves%20modifying%20the%20%3CSTRONG%3Eserver.conf.json%3C%2FSTRONG%3E%20file%20in%20the%20root%20of%20your%20SDK%20folder%20to%20change%20the%20following%20lines%20or%20add%20them%26nbsp%3Bif%20they%20are%26nbsp%3Bmissing.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%22strictMode%22%3A%20false%2C%3CBR%20%2F%3E%22skipTemplateValidation%22%3A%20true%3C%2FPRE%3E%3CP%3EThis%20needs%20to%20be%20added%20before%20the%20closing%20%7D%20in%20the%20file.%20What%20you're%20doing%20is%20effectively%20turning%20off%20validation%20on%20files%20before%20uploading%20them%20to%20studio.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-310102%22%20slang%3D%22en-US%22%3ERe%3A%20Component%20parse%20failure%20when%20using%20%40liaAddScript%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-310102%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.lithium.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F4904%22%20target%3D%22_blank%22%3E%40RobertT%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20your%20reply!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20fails%20even%20if%20I%20take%20that%20line%20out%20unfortunately.%20There's%209%20components%20in%20total%20that%20contain%20a%26nbsp%3B%40liaAddScript%20directive%20and%20each%20of%20them%20are%20failing%20with%20the%20same%20error.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20your%20help%3C%2FP%3E%3CP%3EJames%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-310090%22%20slang%3D%22en-US%22%3ERe%3A%20Component%20parse%20failure%20when%20using%20%40liaAddScript%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-310090%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.lithium.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F69765%22%20target%3D%22_blank%22%3E%40james_whiteley%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20might%20be%20a%20long%20shot%20but%20the%20namespace%20for%20JQuery%20is%20already%20mapped%20to%20%24%20so%20you%20could%20try%20modifying%20the%20line%20beginning%20jQuery%20as%20follows%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%26lt%3B%40liaAddScript%26gt%3B%0A%3B(function(%24)%7B%0AsetTimeout(function()%20%7B%0A%0A%24('.lia-category-community-management').after('%26lt%3Bli%20class%3D%22board-dropdown-item%20community-admin-link%22%26gt%3B%26lt%3Ba%20href%3D%22%2Ft5%2Fbizapps%2Fbizappspage%2Ftab%2Fcommunity%253Aadmin%22%20id%3D%22communityAdmin%22%20class%3D%22lia-link-navigation%20lia-component-admin-widget-admin%22%26gt%3BCommunity%20Admin%26lt%3B%2Fa%26gt%3B%26lt%3B%2Fli%26gt%3B%26lt%3Bli%20class%3D%22board-dropdown-item%20plugin-editor-link%22%26gt%3B%26lt%3Ba%20href%3D%22%2Ft5%2Fbizapps%2Fbizappspage%2Ftab%2Fcommunity%253Astudio%22%20id%3D%22lithiumStudio%22%20class%3D%22lia-link-navigation%20lia-component-lithiumstudio-action-lithium-studio%22%26gt%3BStudio%26lt%3B%2Fa%26gt%3B%26lt%3B%2Fli%26gt%3B')%3B%0A%7D%2C1000)%3B%0A%7D)(LITHIUM.jQuery)%3B%0A%26lt%3B%2F%40liaAddScript%26gt%3B%3C%2FPRE%3E%3CP%3ELet%20us%20know%20if%20this%20works.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Advisor
Occasional Advisor

Component parse failure when using @liaAddScript

Jump to solution

Hi,

 

I am getting the following error thrown when submitting a plugin to staging via the SDK....

 

Failure Code: COMPONENT_PARSE_FAILURE
Failure Rule: CUSTOM_RULE
Failure Message: A component file in the plugin has a possible issue.
Failure Details: Detailed error is: No object of type lithium.web.javascript.tapestry.services.LithiumJavaScriptSupport is available from the Environment..

 

This is happening for every component that uses the @liaAddScript directive.

 

Does anybody have any idea what could be causing this?

 

Any help is much appreciated!

 

Thanks

James

 

EDIT: Sorry, here is an example code snippet that is failing

 

<@liaAddScript>
;(function($){
setTimeout(function() {

jQuery('.lia-category-community-management').after('<li class="board-dropdown-item community-admin-link"><a href="/t5/bizapps/bizappspage/tab/community%3Aadmin" id="communityAdmin" class="lia-link-navigation lia-component-admin-widget-admin">Community Admin</a></li><li class="board-dropdown-item plugin-editor-link"><a href="/t5/bizapps/bizappspage/tab/community%3Astudio" id="lithiumStudio" class="lia-link-navigation lia-component-lithiumstudio-action-lithium-studio">Studio</a></li>');
},1000);
})(LITHIUM.jQuery);
</@liaAddScript>

 

0 Kudos
7 Replies
Honored Contributor Honored Contributor
Honored Contributor

Re: Component parse failure when using @liaAddScript

Jump to solution

@james_whiteley

 

This might be a long shot but the namespace for JQuery is already mapped to $ so you could try modifying the line beginning jQuery as follows:

 

<@liaAddScript>
;(function($){
setTimeout(function() {

$('.lia-category-community-management').after('<li class="board-dropdown-item community-admin-link"><a href="/t5/bizapps/bizappspage/tab/community%3Aadmin" id="communityAdmin" class="lia-link-navigation lia-component-admin-widget-admin">Community Admin</a></li><li class="board-dropdown-item plugin-editor-link"><a href="/t5/bizapps/bizappspage/tab/community%3Astudio" id="lithiumStudio" class="lia-link-navigation lia-component-lithiumstudio-action-lithium-studio">Studio</a></li>');
},1000);
})(LITHIUM.jQuery);
</@liaAddScript>

Let us know if this works.

Robert
Lithium Certified Developer

Click the Kudos button below if you find my posts helpful. If I've answered your query please click the Mark Solution button to help others find the same answer.
0 Kudos
Reply
Loading...
Occasional Advisor
Occasional Advisor

Re: Component parse failure when using @liaAddScript

Jump to solution

Hi @RobertT,

 

Thanks for your reply!

 

It fails even if I take that line out unfortunately. There's 9 components in total that contain a @liaAddScript directive and each of them are failing with the same error.

 

Thanks for your help

James

0 Kudos
Reply
Loading...
Highlighted
Honored Contributor Honored Contributor
Honored Contributor

Re: Component parse failure when using @liaAddScript

Jump to solution

@james_whiteley,

 

There is one more thing you can try, it involves modifying the server.conf.json file in the root of your SDK folder to change the following lines or add them if they are missing.

 

"strictMode": false,
"skipTemplateValidation": true

This needs to be added before the closing } in the file. What you're doing is effectively turning off validation on files before uploading them to studio. 

 

 

 

Robert
Lithium Certified Developer

Click the Kudos button below if you find my posts helpful. If I've answered your query please click the Mark Solution button to help others find the same answer.
0 Kudos
Reply
Loading...
Occasional Advisor
Occasional Advisor

Re: Component parse failure when using @liaAddScript

Jump to solution

Hi @RobertT,

 

Thanks again for your reply.

 

It will still fail validation on production though, I would have thought.

 

James

0 Kudos
Reply
Loading...
Honored Contributor Honored Contributor
Honored Contributor

Re: Component parse failure when using @liaAddScript

Jump to solution

@james_whiteley, it shouldn't fail if you know the code has run before.

 

What you may want to do is create the component in Studio first and test it with the same code, Studio will always override the SDK, but if you create the same component in Studio and paste in the code to test it should confirm if there is a problem with validation.

Robert
Lithium Certified Developer

Click the Kudos button below if you find my posts helpful. If I've answered your query please click the Mark Solution button to help others find the same answer.
0 Kudos
Reply
Loading...
Occasional Advisor
Occasional Advisor

Re: Component parse failure when using @liaAddScript

Jump to solution

Hi @RobertT,

 

I've managed to get it working and live on production. Thanks very much for your help, I will accept your suggestion to modify the server.conf.json as the solution.

 

James

0 Kudos
Reply
Loading...
Honored Contributor Honored Contributor
Honored Contributor

Re: Component parse failure when using @liaAddScript

Jump to solution

Epic, 

 

Glad it's sorted for you Smiley Happy

Robert
Lithium Certified Developer

Click the Kudos button below if you find my posts helpful. If I've answered your query please click the Mark Solution button to help others find the same answer.
0 Kudos
Reply
Loading...