tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Winnall <st...@winnall.ch>
Subject Re: WebdavServlet + custom DirContext = unexpected behaviour
Date Fri, 13 Feb 2009 22:49:02 GMT
Can anyone help me with this? I'm completely stuck!

I have a Tomcat 6.0.18 installation with WebdavServlet enabled. If I  
use the following <Context> file, WebDAV works OK:

<Context>
    <Resource name="jdbc/xwdb" auth="Container"
          type="javax.sql.DataSource"  
driverClassName="org.postgresql.Driver"
          url="..."
          username="..." password="..." maxActive="20" maxIdle="10"  
maxWait="-1"/>
</Context>

However, I want to use WebDAV to access a database, so I've written my  
own DirContext. I declare the DirContext as a <Resources> handler in  
the <Context> file as follows:

<Context>
    <Resources className="org.vimia.xw.db.dircontext.DBDirContext" />
    <Resource name="jdbc/xwdb" auth="Container"
          type="javax.sql.DataSource"  
driverClassName="org.postgresql.Driver"
          url="..."
          username="..." password="..." maxActive="20" maxIdle="10"  
maxWait="-1"/>
</Context>

But when I do this, WebdavServlet is ignored and HTTP sessions are  
created with HttpServlet / DefaultServlet, which fail, of course,  
because they know nothing about WebDAV. The <Resources> handler seems  
effectively to make WebdavServlet invisible...

I've googled for just about every combination of dirContext,  
classloader, Tomcat 6, resources, context.xml, WebdavServlet. There  
are 2 people who have asked before about how to access a database from  
WebdavServlet, but no answers.

I guess I'm missing something dead simple, but I don't know what to  
look for.

Steve


On 13 Feb 2009, at 13:33, Stephen Winnall wrote:

> Thanks for your feedback.
>
> On 13 Feb 2009, at 05:04, Caldarale, Charles R wrote:
>
>>> From: Stephen Winnall [mailto:steve@winnall.ch]
>>> Subject: WebdavServlet + custom DirContext = unexpected behaviour
>>>
>>> My Tomcat is as installed by NetBeans 6.5, that is
>>> with a separate CATALINA_HOME and CATALINA_BASE.
>>
>> I'd strongly recommend that you first learn how to run Tomcat  
>> directly, outside of any IDE, before muddying the picture with an  
>> extra layer of obfuscation.  Problem solving will be much simpler.
>
> Fair comment. So I have now installed Tomcat 6.0.18 from scratch.
>
>>
>>
>>> I modified $CATALINA_BASE/conf/catalina.properties to make
>>> common.loader look also in $CATALINA_BASE/common/lib and I
>>> put DBDirContext and supporting cast into there.
>>
>> Now you've already gone off the deep end; that's not something you  
>> should have to (or want to) do.  By default, there is no common/lib  
>> in Tomcat 6.0, and you don't need to resurrect the past.  Any jars  
>> or classes Tomcat needs access to should be in Tomcat's lib  
>> directory, nowhere else.  If you provide a replacement for the  
>> default <Resources> handler, it must go into Tomcat's lib  
>> directory, since it's used by Tomcat, not the webapp.
>
> I did originally put everything into $CATALINA_HOME/lib. However, I  
> like to keep my stuff separate from the base product, which is why I  
> had created a separate folder.
>
> However, with my new installation I put DBDirContext and friends  
> into $CATALINA_HOME/lib as you suggest.
>
> When I started up the new installation, I got exactly the same  
> behaviour as before.
>
>>
>>
>>> The Tomcat documentation suggests that changing the
>>> <Resources .../> to something other than the filesystem
>>> results in Tomcat not being able to read files it needs:
>>
>> Not true - it says the *webapp* won't be able to access the file  
>> system; it says nothing about Tomcat's ability to do so.
>
> Thanks, that has cleared up an uncertainty for me.
>
>>
>>
>>> do I have to make a hybrid DBDirContext that gets the
>>> files Tomcat needs from the filesystem and the data I
>>> want from the database?
>>
>> I don't think so.  Start over with a clean Tomat install (not the  
>> one bundled with the IDE) and go from there.
>
> Done that and there's no change in behaviour. When I switch on the  
> <Resources> handler, the OPTIONS request is apparently handled out  
> of HttpServlet; when I switch it off, it is handled out of  
> WebdavServlet.
>
> Steve
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


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


Mime
View raw message