You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Vit Rozkovec <ro...@email.cz> on 2014/03/05 16:41:18 UTC

Unable to open resource stream (status=500)

Hi,
I came across interesting problem:

I have one project which is packaged as .jar file along with all 
required assets. The behavior inside this project is defined like this:

public class NprogressBehavior extends Behavior
{

      @Override
     public void renderHead(Component component, IHeaderResponse response)
     {
         super.renderHead(component, response);

         response.render(JavaScriptHeaderItem.forReference(new 
JavaScriptResourceReference(
             NprogressBehavior.class, "nprogress.js")));
         response.render(JavaScriptHeaderItem.forReference(new 
JavaScriptResourceReference(
             NprogressBehavior.class, "nprogress-init.js")));
         response.render(CssHeaderItem.forReference(new 
CssResourceReference(
             NprogressBehavior.class, "nprogress.css")));
     }
}


Other project has defined the first project as dependency and in one 
page I simply add the NprogressBehavior behavior in onInitialize() method.

However this does not work and when using on my server throws following 
error:



WARN  - PackageResource            - resource [path = 
cz/newforms/wicket/behaviors/nprogress.js, style = null, variation = 
null, locale = null]: Unable to open resource stream (status=500)


Is this intended behavior, eg. I cannot use resources like this - 
packaging behaviors with their according js and css files into one 
project, referencing this project in another project and using this 
behavior there?

Does all resources have to reside in the actual project where there are 
used? Seems strange to me. What am I doing wrong?

Thanks for any advice.
Vit


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Unable to open resource stream (status=500)

Posted by Martin Grigorov <mg...@apache.org>.
Try to reproduce it in a quickstart and attach it to Jira.

Martin Grigorov
Wicket Training and Consulting


On Wed, Mar 5, 2014 at 7:13 PM, Vit Rozkovec <ro...@email.cz> wrote:

> Yes it is.
>
> The file is in the package, checked the war and also the dir where war
> contents are unpacked. Running on linux with Jetty webserver and Apache as
> a proxy.
>
> Also when inspecting page with firebug, it does not have altered name with
> version number included as other resources have, such as
> ....../wicket/resource/name.berries.projects.kaplickyprize.references.
> KaplickyCssResourceReference/file-upload-ver-
> ECB4619F0CA76E0EE037BD81A9515B42.css
>
> the address is
> ....../wicket/resource/cz.newforms.wicket.behaviors.
> NprogressBehavior/nprogress.js
>
> but I guess it is because it could not be found.
>
>
>
>
> On 5.3.2014 16:48, Martin Grigorov wrote:
>
>> Hi,
>>
>> This should work fine.
>> Check that the .js file is properly packed in the .jar file next to
>> NprogressBehavior.class.
>>
>>
>> On Wed, Mar 5, 2014 at 5:41 PM, Vit Rozkovec <ro...@email.cz>
>> wrote:
>>
>>  Hi,
>>> I came across interesting problem:
>>>
>>> I have one project which is packaged as .jar file along with all required
>>> assets. The behavior inside this project is defined like this:
>>>
>>> public class NprogressBehavior extends Behavior
>>> {
>>>
>>>       @Override
>>>      public void renderHead(Component component, IHeaderResponse
>>> response)
>>>      {
>>>          super.renderHead(component, response);
>>>
>>>          response.render(JavaScriptHeaderItem.forReference(new
>>> JavaScriptResourceReference(
>>>              NprogressBehavior.class, "nprogress.js")));
>>>          response.render(JavaScriptHeaderItem.forReference(new
>>> JavaScriptResourceReference(
>>>              NprogressBehavior.class, "nprogress-init.js")));
>>>          response.render(CssHeaderItem.forReference(new
>>> CssResourceReference(
>>>              NprogressBehavior.class, "nprogress.css")));
>>>      }
>>> }
>>>
>>>
>>> Other project has defined the first project as dependency and in one page
>>> I simply add the NprogressBehavior behavior in onInitialize() method.
>>>
>>> However this does not work and when using on my server throws following
>>> error:
>>>
>>>
>>>
>>> WARN  - PackageResource            - resource [path =
>>> cz/newforms/wicket/behaviors/nprogress.js, style = null, variation =
>>> null, locale = null]: Unable to open resource
>>>
>> stream (status=500)
>>
>>>
>>> Is this intended behavior, eg. I cannot use resources like this -
>>> packaging behaviors with their according js and css files into one
>>> project,
>>> referencing this project in another project and using this behavior
>>> there?
>>>
>>> Does all resources have to reside in the actual project where there are
>>> used? Seems strange to me. What am I doing wrong?
>>>
>>> Thanks for any advice.
>>> Vit
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Unable to open resource stream (status=500)

Posted by Vit Rozkovec <ro...@email.cz>.
Yes it is.

The file is in the package, checked the war and also the dir where war 
contents are unpacked. Running on linux with Jetty webserver and Apache 
as a proxy.

Also when inspecting page with firebug, it does not have altered name 
with version number included as other resources have, such as
....../wicket/resource/name.berries.projects.kaplickyprize.references.KaplickyCssResourceReference/file-upload-ver-ECB4619F0CA76E0EE037BD81A9515B42.css

the address is
....../wicket/resource/cz.newforms.wicket.behaviors.NprogressBehavior/nprogress.js

but I guess it is because it could not be found.



On 5.3.2014 16:48, Martin Grigorov wrote:
> Hi,
>
> This should work fine.
> Check that the .js file is properly packed in the .jar file next to
> NprogressBehavior.class.
>
>
> On Wed, Mar 5, 2014 at 5:41 PM, Vit Rozkovec <ro...@email.cz> wrote:
>
>> Hi,
>> I came across interesting problem:
>>
>> I have one project which is packaged as .jar file along with all required
>> assets. The behavior inside this project is defined like this:
>>
>> public class NprogressBehavior extends Behavior
>> {
>>
>>       @Override
>>      public void renderHead(Component component, IHeaderResponse response)
>>      {
>>          super.renderHead(component, response);
>>
>>          response.render(JavaScriptHeaderItem.forReference(new
>> JavaScriptResourceReference(
>>              NprogressBehavior.class, "nprogress.js")));
>>          response.render(JavaScriptHeaderItem.forReference(new
>> JavaScriptResourceReference(
>>              NprogressBehavior.class, "nprogress-init.js")));
>>          response.render(CssHeaderItem.forReference(new
>> CssResourceReference(
>>              NprogressBehavior.class, "nprogress.css")));
>>      }
>> }
>>
>>
>> Other project has defined the first project as dependency and in one page
>> I simply add the NprogressBehavior behavior in onInitialize() method.
>>
>> However this does not work and when using on my server throws following
>> error:
>>
>>
>>
>> WARN  - PackageResource            - resource [path =
>> cz/newforms/wicket/behaviors/nprogress.js, style = null, variation =
>> null, locale = null]: Unable to open resource
> stream (status=500)
>>
>> Is this intended behavior, eg. I cannot use resources like this -
>> packaging behaviors with their according js and css files into one project,
>> referencing this project in another project and using this behavior there?
>>
>> Does all resources have to reside in the actual project where there are
>> used? Seems strange to me. What am I doing wrong?
>>
>> Thanks for any advice.
>> Vit
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Unable to open resource stream (status=500)

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

This should work fine.
Check that the .js file is properly packed in the .jar file next to
NprogressBehavior.class.


On Wed, Mar 5, 2014 at 5:41 PM, Vit Rozkovec <ro...@email.cz> wrote:

> Hi,
> I came across interesting problem:
>
> I have one project which is packaged as .jar file along with all required
> assets. The behavior inside this project is defined like this:
>
> public class NprogressBehavior extends Behavior
> {
>
>      @Override
>     public void renderHead(Component component, IHeaderResponse response)
>     {
>         super.renderHead(component, response);
>
>         response.render(JavaScriptHeaderItem.forReference(new
> JavaScriptResourceReference(
>             NprogressBehavior.class, "nprogress.js")));
>         response.render(JavaScriptHeaderItem.forReference(new
> JavaScriptResourceReference(
>             NprogressBehavior.class, "nprogress-init.js")));
>         response.render(CssHeaderItem.forReference(new
> CssResourceReference(
>             NprogressBehavior.class, "nprogress.css")));
>     }
> }
>
>
> Other project has defined the first project as dependency and in one page
> I simply add the NprogressBehavior behavior in onInitialize() method.
>
> However this does not work and when using on my server throws following
> error:
>
>
>
> WARN  - PackageResource            - resource [path =
> cz/newforms/wicket/behaviors/nprogress.js, style = null, variation =
> null, locale = null]: Unable to open resource

stream (status=500)
>
>
> Is this intended behavior, eg. I cannot use resources like this -
> packaging behaviors with their according js and css files into one project,
> referencing this project in another project and using this behavior there?
>
> Does all resources have to reside in the actual project where there are
> used? Seems strange to me. What am I doing wrong?
>
> Thanks for any advice.
> Vit
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>