Skip to main content

unable to get working alternate docroots

17 replies [Last post]
andremat
Offline
Joined: 2008-02-10

Hello,

I followed the information posted at this blog:

http://blogs.sun.com/jluehe/entry/alternate_docroots_in_web_applications

and at this thread:

http://forums.java.net/jive/thread.jspa?messageID=253560

but I am still unable to get working this on my Glassfish (v2ur1-b09d-darwin) server running on Mac OS X 10.5.1

I entered in the admin console:

In the admin console, I selected tree node: Configuration -> HTTP-Service -> Virtual Server -> server
on the right panel, added a row to the property table,
property name: alternatedocroot_1
property value: from=/myimages/* dir=/images

but when I typed "http://localhost:8080/myimages/image1.jpg" I got the 404 error.

I can't figure it out why is not working. Thanks for any help!

-Andre

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jluehe
Offline
Joined: 2004-12-01

I've copied & pasted the blog info into the wiki. Thanks for your feedback, whartung!

whartung
Offline
Joined: 2003-06-13

Thanx Jan, I really appreciate you doing this.

ccagf
Offline
Joined: 2010-06-30

Hi

I am on [b]Solaris 10[/b] and [b]Sun GlassFish Enterprise Server v2.1 (9.1.1) (build b60e-fcs)[/b]
I am setting things up the exact way you specified, and it is not working.

I am getting: HTTP Status 404 - The requested resource () is not available.

I have a dir on my solaris server
/opt/app/img
with image files in them (ex abc.jpg)

I wanted to create a virtual dir.
so I added the following property to server virtual server.

[u]Now When I hit the URL:[/u]
http://hostname:port/localshare/images/abc.jpg
I get the error:[b] HTTP Status 404 - The requested resource () is not available[/b].

whartung
Offline
Joined: 2003-06-13

Can you move your article to the Wiki?

I appreciate the value of blogs et al, but, for whatever reason, blogs Go Away. I would consider something in the Wiki a little more "permanent". Also, items in the Wiki get will ideally be more visible to developers later so they can come back and clarify or correct them as the project moves forward. There's nothing better than hunting down an article on a blog that's 2 years old, but, alas, obsolete, especially when you as a user may not know the difference.

jluehe
Offline
Joined: 2004-12-01

ok, I've created this FAQ entry:

http://wiki.glassfish.java.net/Wiki.jsp?page=FaqAlternateDocrootResource...

which has a link to my blog.

whartung
Offline
Joined: 2003-06-13

Um...Thanx, but I don't think you got the gist of what I was asking.

My point is that blogs should not be considered part of "community", and especially not "official", documentation. The blogs information and availability are not tied in any way to the community.

For example, you may find another opportunity and leave Sun. As soon as you do that, your blog, most likely, simply vanishes. And there goes the information.

You may simply tire of Glassfish and app servers, moving on to another project. That's all well and good. That means you'll be even less motivated to maintain your blog entry should any changes happen to this area in the functionality.

If the entry were on the wiki, the community could maintain the information and keep it up to date. That relieves you of the burden of ever having to deal with it again, since anyone here can update or change the wiki. In fact, if it's on the wiki, the developers and documenters of the project can make a sweep through the wiki and use it as an inspiration for unit tests, or even fold it in to official documentation.

See, when the information is posted on the blog, it's YOUR information, not the communities. By posting it on to the wiki, then the community inherits it and can maintain it. It gains higher visibility within the community, and therefore becomes even more valuable to the community than it already is.

So. I'm just asking if you could post the entry to the wiki, because it's good information. I can't just go to your site and copy paste the text in to the wiki, that's not fair use of your copyright. But YOU can gift that information to the community, since it's your text.

But, by all means, leave the blog link.

Eduardo Pelegri-Llopart

Didn't we get a "Common Tasks" section started in the Wiki? Gail?

- eduard/o

glassfish@javadesktop.org wrote:
> Um...Thanx, but I don't think you got the gist of what I was asking.
>
> My point is that blogs should not be considered part of "community", and especially not "official", documentation. The blogs information and availability are not tied in any way to the community.
>
> For example, you may find another opportunity and leave Sun. As soon as you do that, your blog, most likely, simply vanishes. And there goes the information.
>
> You may simply tire of Glassfish and app servers, moving on to another project. That's all well and good. That means you'll be even less motivated to maintain your blog entry should any changes happen to this area in the functionality.
>
> If the entry were on the wiki, the community could maintain the information and keep it up to date. That relieves you of the burden of ever having to deal with it again, since anyone here can update or change the wiki. In fact, if it's on the wiki, the developers and documenters of the project can make a sweep through the wiki and use it as an inspiration for unit tests, or even fold it in to official documentation.
>
> See, when the information is posted on the blog, it's YOUR information, not the communities. By posting it on to the wiki, then the community inherits it and can maintain it. It gains higher visibility within the community, and therefore becomes even more valuable to the community than it already is.
>
> So. I'm just asking if you could post the entry to the wiki, because it's good information. I can't just go to your site and copy paste the text in to the wiki, that's not fair use of your copyright. But YOU can gift that information to the community, since it's your text.
>
> But, by all means, leave the blog link.
> [Message sent by forum member 'whartung' (whartung)]
>
> http://forums.java.net/jive/thread.jspa?messageID=259983
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

grisdal
Offline
Joined: 2007-07-30

No, there's no "Common Tasks" section in the wiki at this point. I'd like to add a "HowTo" section, though, which is probably the same thing.

Here's what I'm thinking:

- Create a main HowTo (or Common Tasks) page similar to the main GF User FAQ page and link to it from the left nav http://wiki.glassfish.java.net/Wiki.jsp?page=GlassFishUserFAQ

- The community contributes HowTos in the same way as FAQs, i.e., separate wiki pages with a common prefix linked to from the main HowTo page

What do others think about this? Does this sound like a good plan? Any thoughts or suggestions? Would this be a helpful resource?

Gail
+++++
GlassFish Documentation

whartung
Offline
Joined: 2003-06-13

I think more task oriented samples would be a good thing, as they can pull in disparate bits of the documentation.

The docroot thing is a prime example, so is web security.

Add in some screenshots, and you have some useful additions to the doc set.

grisdal
Offline
Joined: 2007-07-30

Great input - thanks! There's definitely a need for this type of documentation and you'll be pleased to know that task-based documentation is what's planned for GlassFish v3. The following blog entry describes the general approach: http://blogs.sun.com/appservwriters/entry/brainstorming_for_glassfish_v3...

And again, this type of task-based information can also be captured in a HowTo/Common Tasks section on the wiki.

Gail

jluehe
Offline
Joined: 2004-12-01

see also my response at

http://forums.java.net/jive/thread.jspa?messageID=252325&#252325

which should help.

going back to your example:

property name: alternatedocroot_1
property value: from=/myimages/* dir=/images
request url: "http://localhost:8080/myimages/image1.jpg"

i assume your webapp has been deployed at the root context "/"?

if so, the request's path info equals "/myimages/image1.jpg", meaning the target resource path is given as

"/images" (the dir component of your alternate docroot definition)
+ "/myimages/image1.jpg" (the request's path info)

resulting in

"/images/myimages/image1.jpg"

does this resource exist in your local filesystem?

andremat
Offline
Joined: 2008-02-10

Hi jluehe,

you just gave me the solution. The problem was in the path. I was missing the "myimages" inside the "images".

Now I have this in my filesystem: "/images/myimages/image1.jpg" instead of the wrong one "/images/image1.jpg"

Thanks a lot for your help. I was getting crazy here, but not anymore!!!

Andre

whartung
Offline
Joined: 2003-06-13

This is a chronic problem with this configuration. Semantically, we just "skip" the details in the example, where in hindsight it's obvious what is happening, but they really need to clarify this point on how the docroots work. It's a constant source of confusion.

jluehe
Offline
Joined: 2004-12-01

I will clarify this in my blog. Hopefully, this will avoid any confusion going forward. thanks!

jluehe
Offline
Joined: 2004-12-01

I've added a blog entry at:

http://blogs.sun.com/jluehe/entry/alternate_docroots_and_local_resource

I hope this addresses any misunderstandings.

Let me know.

Thanks,

Jan

rlstephens
Offline
Joined: 2007-08-22

absolutely baffled...cannot make this work. trying to do a simple virtual path, aka IIS virtual directory in an effort to use GF over IIS...

Using the admin GUI, I added a altneratedocroot to my virtual server...this is the resulting line in domain.xml:

I was expectivng to see "c:/temp/media/0.gif" when requesting http://localhost/media/0.gif...

Is there some log setting I can change to get more info? I set the root logger to FINEST, and saw nothing related...

This is a simple test case, as eventually I would need a UNC path to a SAN share...but, I thought the UNC's were causing problems.

Please help!

(BTW, this is GF 2UR1)

rlstephens
Offline
Joined: 2007-08-22

Ok, got it...though I still remain confused...I believe something was wrong in the deploy, causing shadowing (?), then lots of problems that required me to remove everything in the domain/generated dir...???

oh well...