Resource not loading - 404 Error

classic Classic list List threaded Threaded
69 messages Options
1234
Reply | Threaded
Open this post in threaded view
|

Resource not loading - 404 Error

psangani
Hi There,

We are upgrading Orbeon Forms from 3.9 to 2016.03. I've changed Orbeon.war, made changes to web.xml.

At run time in JSP, getting 404 error while loading auto_resources.xml at below line. Orbeon.war and my application war are in the same JVM container.  


xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"

<xforms:instance id="my instance id" xxforms:readonly="true"
                xxforms:cache="true" src="/resources/auto_resources.xml" />


Got invalid return code while loading URI: http://localhost:9080/FormsServer/resources/auto_resources.xml, 404



Wondering if we need to change namespace URLs in JSP that supports new Orbeon Forms. Appreciate your help for resolving this issue.

Many thanks,
psangani
Reply | Threaded
Open this post in threaded view
|

Re: Resource not loading - 404 Error

Alessandro  Vernet
Administrator
Hi Prashant,

And auto_resources.xml is one of your files, right? Where did you put it?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Resource not loading - 404 Error

psangani
Hi Alex,
Yes, it is our application specific xml and resides under /resources/ directory of the original application called FormsServer. Forms Server makes a servlet call to Orbeon Forms. It was working in 3.9 but does not load resource files of FormsServer.

Thanks
Prashant
Reply | Threaded
Open this post in threaded view
|

Re: Resource not loading - 404 Error

psangani
Hi Alex, Is there anything else that we should provide you in order to help on troubleshooting the issue? Pl let us know. Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: Resource not loading - 404 Error

Alessandro  Vernet
Administrator
Hi Prashant,

Sorry for the delay: I didn't see your messages, as you were not subscribed to the list, and thus the messages you posted on discuss.orbeon.com didn't go through. I now subscribed you, and everyone should immediately get any subsequent message you post.

Are you saying that your file was in resources/auto_resources.xml? Or was it in WEB-INF/resources/auto_resources.xml? In the second case, I can't picture how it could have worked with 3.9. In the first case, it would mean that the file was served directly by the app server, not the Orbeon Forms servlet. Maybe you had a special config in your web.xml for that? Also, can I ask why you have an XML file that you want to load from the browser, as this is somewhat unusual?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Resource not loading - 404 Error

opavlova
This post was updated on .
In reply to this post by psangani
Hi Alex, I continue working on this issue on behalf of Prashant.

Below is the application structure template which works with Orbeon 3.9.
Here “FormsServerRoot” is the root project for the application.

 

Please find details for every module
Orbeon: This module is responsible to create orbeon.war(3.9)
FormsServer: This module contains application specific .jsp(highlighted in red box) in xforms folder and its required resource(highlighted in blue color) are in resources folder. This module is responsible to create formsServer.war.
FormsServerEAR: This module is responsible to create application ear which contains both orbeon war and formsServer war.

Our target to delete above Orbeon module from this application and use updated orbeon.war as dependency in application ear.

Above auto.jsp(highlighted in red box) is trying to load auto_resources.xml(highlighted in blue color) from below code snippet which leads 404 error.

xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"

<xforms:instance id="my instance id" xxforms:readonly="true"
                xxforms:cache="true" src="/resources/auto_resources.xml" />


We can’t ignore auto_resources.xml as it’s contain all data mapping related configuration.
We don’t have any special config in our web.xml for the auto_resources.xml.

Thank you,
Olena
Reply | Threaded
Open this post in threaded view
|

Re: Resource not loading - 404 Error

hahalim
In reply to this post by Alessandro Vernet
Hi Alex,

Me with Olena are working on this issue on behalf of Prashant.

Appreciate if you could let us know the update please.

Please Let us know if you need any more details in order to help on troubleshooting the issue.

Thank you
Hasim
Reply | Threaded
Open this post in threaded view
|

Re: Resource not loading - 404 Error

Alessandro  Vernet
Administrator
In reply to this post by opavlova
Hi Olena,

Got it. In the <xforms:instance>, could you try

replacing:
    src="/resources/auto_resources.xml"
with:
    src="oxf:/auto_resources.xml"

This will load the file through the resource manager, instead of going through an HTTP request served by the page flow, and thus should avoid any issue with the page flow. You'll let me know if this helps.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Resource not loading - 404 Error

hahalim
Hi Alex,

Still getting same issue

Please find details error below

Reply | Threaded
Open this post in threaded view
|

Re: Resource not loading - 404 Error

Alessandro  Vernet
Administrator
Hi Olena,

I suspect that you're either not changing the correct file, or that there is another reference, because the oxf:/ scheme should not make an HTTP request capable of answering with a 404.

Could you change oxf:/auto_resources.xml → oxf:/gaga.xml. Now what error are you getting? If still an error for auto_resources.xml, then you have another reference to that file. If an error for gaga.xml, can you attach the orbeon.log you're getting right after the error happened?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Resource not loading - 404 Error

hahalim
Hi Alex,

Sorry for the delay response.

I have renamed above auto_resources.xml file  to NewAuto_resources.xml and provide below xforms instance in auto.jsp

<xforms:instance id="resources-inst" xxforms:readonly="true"
                xxforms:cache="false" src="oxf:/NewAuto_resources.xml" />

But received below errors in browser and Orbeon log

 

Error in Orbeon log

2017-05-15 08:20:53,483 INFO  ProcessorService  - Context listener - Context initialized.
2017-05-15 08:21:05,589 INFO  ProcessorService  - Servlet initialized.
2017-05-15 08:21:05,627 INFO  ProcessorService  - Session listener - Session created.
2017-05-15 08:21:05,661 WARN  auth  - not setting auth headers because username is missing
2017-05-15 08:21:05,772 INFO  lifecycle  - event: {"request": "1", "session": "7IYCdeCreg66oF6VywvOtJq", "source": "service", "message": "start: handle", "path": "/xforms-renderer", "method": "GET"}
2017-05-15 08:21:05,774 INFO  ProcessorService  - /xforms-renderer - Received request
2017-05-15 08:21:15,691 WARN  Version  - Feature is not enabled in this version of the product: cached XForms instance
2017-05-15 08:21:18,099 WARN  XFormsServer  - unknown id {id: "fr-number"}
2017-05-15 08:21:18,105 WARN  XFormsServer  - observer attribute present but does not refer to at least one valid id, ignoring event handler {element: "<xf:action type="javascript" target="#observer" observer="fr-number" event="DOMFocusOut" id="xf-3078">[...]</xf:action>"}
2017-05-15 08:21:18,105 WARN  XFormsServer  - target attribute present but does not refer to at least one valid id, ignoring event handler {element: "<xf:action type="javascript" target="#observer" observer="fr-number" event="DOMFocusOut" id="xf-3078">[...]</xf:action>"}
2017-05-15 08:21:19,662 INFO  lifecycle  - event: {"request": "1", "session": "7IYCdeCreg66oF6VywvOtJq", "source": "xforms", "message": "new form session", "uuid": "c23868512b81d0718d55c931d87f4bfa4e5385ab"}
2017-05-15 08:21:20,334 INFO  PageFlowControllerProcessor  - not found {controller: "oxf:/ops/xforms/xforms-renderer-page-flow.xml", method: "GET", path: "/xforms-renderer", resource: "/NewAuto_resources.xml"}
2017-05-15 08:21:21,257 INFO  ProcessorService  - /xforms-renderer - Timing: 15470
2017-05-15 08:21:21,263 INFO  lifecycle  - event: {"request": "1", "session": "7IYCdeCreg66oF6VywvOtJq", "source": "service", "message": "end: handle", "time": "15,520 ms"}
Reply | Threaded
Open this post in threaded view
|

Re: Resource not loading - 404 Error

hahalim
In reply to this post by Alessandro Vernet
Hi Alex,

Below information might help you to troubleshoot the error.

I have used only below orbeon war in our application

\orbeon-2016.3.201612302139-CE.zip\orbeon-2016.3.201612302139-CE\orbeon.war
 but not
\orbeon-2016.3.201612302139-CE.zip\orbeon-2016.3.201612302139-CE\orbeon-auth.war
\orbeon-2016.3.201612302139-CE.zip\orbeon-2016.3.201612302139-CE\orbeon-xforms-filter.war

Please find below pom configuration where we are using above orbeon.war in our application ear


Reply | Threaded
Open this post in threaded view
|

Re: Resource not loading - 404 Error

Alessandro  Vernet
Administrator
Hi Hasim,

Indeed, I see in the log the error for the page flow not finding NewAuto_resources.xml. But since you're using the `oxf:/` scheme, this should go directly to the resource manager, without hitting the page flow.

So let's try to reproduce this in case that is as simple as possible. I'm taking the Orbeon Forms 2016.3 war, uncompressing it, and:

1. Changing xforms-jsp/guess-the-number/index.jsp to have <xf:instance src="oxf:/number.xml"/>, instead of the inline instance.
2. Creating a file WEB-INF/resources/number.xml, with:

<number>
    <answer>42</answer>
    <guess/>
</number>

With this, if I go to http://localhost:8080/orbeon/xforms-jsp/guess-the-number/, and click on "I'm a cheater", I see 42 as expected. Could you try this, and see if it works for you? If it does, but you're doing something slightly different, can you do a variation on what I did that shows the problem?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Resource not loading - 404 Error

hahalim
This post was updated on .
Hi Alex,

Today I am able to find out the cause of the issue.

Please find below application ear structure again.



Here we have two "war" inside the application "ear"

One is Orbeon.war which is nothing but \orbeon-2016.3.201612302139-CE.zip\orbeon-2016.3.201612302139-CE\orbeon.war 

And another is  FormsServer.war which we have all business logic related codebase.
 
The below code snippet is a part of auto.jsp file which is also inside the FormsServer.war

<xforms:instance id="resources-inst" xxforms:readonly="true"
                xxforms:cache="false" src="oxf:/auto_resources.xml" />

The above auto_resources.xml file is also present in "FormsServerEAR.ear\FormsServer.war\resources" folder but not in "FormsServerEAR.ear\FormsServer.war\WEB-INF\resources" folder.

Scenario 1:
We run the auto.jsp page without any change in codebase and we are getting  below exception
2017-05-18 06:08:43,571 INFO  PageFlowControllerProcessor  - not found {controller: "oxf:/ops/xforms/xforms-renderer-page-flow.xml", method: "GET", path: "/xforms-renderer", resource: "/auto_resources.xml"}

Scenario 2:
We move auto_resources.xml file from "FormsServerEAR.ear\FormsServer.war\resources" to "FormsServerEAR.ear\FormsServer.war\WEB-INF\resources" and run the auto.jsp page. Still we are getting above exception

Scenario 3:
We move auto_resources.xml file from "FormsServerEAR.ear\FormsServer.war\resources" to "FormsServerEAR.ear\Orbeon.war\WEB-INF\resources" and run the auto.jsp page. Now the page are coming as expected.

Now my questions are:
1. Why the auto.jsp (which is present in FormsServer.war) file try to search the auto_resources.xml in Orbeon.war but not in FormsServer.war?
2. What should be the solution for such issue?
Reply | Threaded
Open this post in threaded view
|

Re: Resource not loading - 404 Error

hahalim
This post was updated on .
Hi Alex,
Could you please let us know the solution of our query? Is there anything else that we should provide you in order to help on troubleshooting the issue? Pl let us know. Thanks for your help.

Regards,
Hasim
Reply | Threaded
Open this post in threaded view
|

Re: Resource not loading - 404 Error

Alessandro  Vernet
Administrator
Hi Hasim,

I'm glad you resolved this. And you're correct: the file should go in the Orbeon Forms' `WEB-INF/resources`. This is because it is Orbeon Forms that interprets your XForms, that URLs that start with the `oxf:` scheme are resolved by Orbeon Forms through its resource managers (see the page linked below for more on this), and that, typically, custom resources for your application are placed in the `WEB-INF/resources`.

https://doc.orbeon.com/xml-platform/resources/resource-managers.html

Does this make a bit more sense?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Resource not loading - 404 Error

hahalim
Hi Alex,
couple of things

1. As I told you earlier, we are using whole orbeon.war in our application. That "war" should be present in nexus. The application only call the orbeon.war as dependency direct from nexus. we can't change anything frequently inside the orbeon.war.

2. The auto_resources.xml is our application specific resource which will be changes frequently according business logic. So we can't put these type of resource direct to orbeon.war.

3. Our aim to put these resource xml inside application specific FormsServer.war.

Here my question is,
Which steps we should follow to fulfill above scenarios? Please suggest. Thanks.

Regards,
Hasim



Reply | Threaded
Open this post in threaded view
|

Re: Resource not loading - 404 Error

Alessandro  Vernet
Administrator
Hi Hasim,

What is the piece you are referring to as "nexus"? Is that the name of your application, deployed as a separate war? And what is `FormsServers.war`?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Resource not loading - 404 Error

hahalim
Hi Alex,

We are doing the code changes in Orbeon.war itself. Thanks a lot for your help.

Regards,

Hasim
Reply | Threaded
Open this post in threaded view
|

Re: Resource not loading - 404 Error

Alessandro  Vernet
Administrator
Hi Hasim,

Very good then, and I'm glad that doing this change in the Orbeon Forms war isn't a problem in this case. And of course, just let us know if there is anything else we can do to help.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
1234