-
1. Re: Why the deployment of application in Wildfly can't access the web root directory?
ctomc Sep 24, 2013 5:54 AM (in response to kobe_fans)1 of 1 people found this helpfulHi,
so you are claiming that WebUtils.getRealPath() does not work properly.
I really don't know what that code does, the proper way of doing it is what you did for "manual" parsing it.
so real question is does servletContext.getRealPath("/config-data/TESTDEV") return proper path?
also you could use servletContext.getResourceAsStream(path) to directly get inputStream to that file.
--
tomaz
-
2. Re: Why the deployment of application in Wildfly can't access the web root directory?
ctomc Sep 24, 2013 5:58 AM (in response to ctomc)also can you try with WildFly nighly build (we are currently just before beta1 release)
https://community.jboss.org/thread/224262
there ware some changes in this area and i am not sure if it will help your problem.
-
3. Re: Why the deployment of application in Wildfly can't access the web root directory?
kobe_fans Sep 24, 2013 6:42 AM (in response to ctomc)
yes, as you said , The basic question is that servletContext.getRealPath("/config-data/TESTDEV") can not return proper path , but when i deployed web application in websphere or tomcat , it can get the proper path . there are some code pictures :when i start up the wildfly and visit the servlet , get the answer as following:
it can't get the true path , it returns null , but in tomcat , the same web application , get answer as following :
So ....
No matter how, I really appreciate your answer !
-
4. Re: Why the deployment of application in Wildfly can't access the web root directory?
ctomc Sep 24, 2013 7:57 AM (in response to kobe_fans)Can you try with WildFly nightly build?
I think it should be fixed there
-
5. Re: Why the deployment of application in Wildfly can't access the web root directory?
kobe_fans Sep 25, 2013 5:26 AM (in response to ctomc)
Thank you very much ! If you could give me an example that is better for me ! -
6. Re: Why the deployment of application in Wildfly can't access the web root directory?
jaikiran Sep 25, 2013 7:51 AM (in response to kobe_fans)1 of 1 people found this helpfulThe WildFly nightly build that Tomaz mentions is available here WildFly nightly builds available. Just download the binary like you would do with any released version and start using it with your applications.
-
7. Re: Why the deployment of application in Wildfly can't access the web root directory?
kobe_fans Sep 25, 2013 8:55 PM (in response to jaikiran)ok , thank you !
-
8. Re: Why the deployment of application in Wildfly can't access the web root directory?
ctomc Oct 1, 2013 8:40 AM (in response to kobe_fans)Did it work for you with nightly build?
-
9. Re: Why the deployment of application in Wildfly can't access the web root directory?
kobe_fans Oct 8, 2013 6:21 AM (in response to ctomc)No , It doesn't work . Though i use the latest version of wildfly-8.0.0.Beta1 , it also can not parse "/config-data" in windows . That is to say , It can't parse the backslash followed by a string . but in linux/unix is ok .
-
10. Re: Why the deployment of application in Wildfly can't access the web root directory?
sfcoy Oct 10, 2013 4:39 AM (in response to kobe_fans)Make sure that you're aware that this method is not required to return anything useful at all. A portable application should not rely upon it. Many JavaEE implementations explode deployments onto the file system, but they're not required to do that.
That said, if it does return anything then it should be a path consistent with the platform on which the application is running. Windows paths should use "\" separators. It's a bug if it's not doing that.
-
11. Re: Why the deployment of application in Wildfly can't access the web root directory?
kobe_fans Oct 10, 2013 6:08 AM (in response to sfcoy)First , Thanks for your answer .
The question is that I had been to deploy applications on wildfly server of Linux environment . It can run normally . But when i try to deploy the same application on windows , The application can't be deployed , After i look for reasons carefully , I found the line of code error is "WebUtils.getRealPath(config-data/TESTDEV)" .
In the application , The function of this method is expected to return a true path string according to i specified virtual path "config-data/TESTDEV" and then according to the returned string to create the corresponding local directory when the server start up . However , In the Windows environment ,When i deployed the application on Wildfly , The method of "WebUtils.getRealPath(config-data/TESTDEV)" can not work correctly . Error message appears when the server start up . As followings :
"Caused by: java.io.FileNotFoundException: ServletContext resource [/config-data/TESTDEV] cannot be resolved to absolute file path - web application archive not expanded"
-
12. Re: Why the deployment of application in Wildfly can't access the web root directory?
ctomc Oct 10, 2013 6:14 AM (in response to kobe_fans)Your code is just fine.
It is a bug in undertow, that should be addressed properly now.
You can try it by building undertow from github and replacing it in wildfly distro.
-
13. Re: Why the deployment of application in Wildfly can't access the web root directory?
kobe_fans Oct 11, 2013 9:48 PM (in response to ctomc)Yes , I'm trying do it . If i have any questions , I'll describe in the community . Thanks !
-
14. Re: Why the deployment of application in Wildfly can't access the web root directory?
kobe_fans Oct 17, 2013 11:50 PM (in response to ctomc)Hi , Tomaz .
I'm sorry so long to reply to you , According to what you said, In these days , I download the undetow from https://github.com/undertow-io/undertow and rebuild it again and again .
Util now , Even though I deployed my peoject on wildfly-8.0.0.Beta2-SNAPSHOT , This method "WebUtils.getRealPath(/config-data)" also can not be resolved correctly . In addition , I replaced the undertow in wildfly-8.0.0.Beta2-SNAPSHOT with rebuild undertow from github , The problem still exist .
I'm not sure whether i do is correct or not, But I just think ,under the undertow-core , The class of FileResourceManager whtin io.undertow.server.handlers.resource , there is a method of getResource() in FileResourceManager , The logic of if conditional has some problems , Here attached two artwork :