Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 59688 invoked from network); 27 Sep 2005 17:38:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 27 Sep 2005 17:38:21 -0000 Received: (qmail 99602 invoked by uid 500); 27 Sep 2005 17:38:20 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 99478 invoked by uid 500); 27 Sep 2005 17:38:19 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 99465 invoked by uid 99); 27 Sep 2005 17:38:19 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Sep 2005 10:38:19 -0700 X-ASF-Spam-Status: No, hits=0.4 required=10.0 tests=HTML_50_60,HTML_MESSAGE,HTML_TAG_EXIST_TBODY,RCVD_BY_IP,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of jeffgbutler@gmail.com designates 64.233.162.200 as permitted sender) Received: from [64.233.162.200] (HELO zproxy.gmail.com) (64.233.162.200) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Sep 2005 10:38:26 -0700 Received: by zproxy.gmail.com with SMTP id z6so441747nzd for ; Tue, 27 Sep 2005 10:37:58 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:references; b=Map1BLQN7Cm53i0q5x0PjOWsz0j46FYE3K6nptmTwdR9Wa37ZYOAZsh2hJCTnnExmWXkSGcs46XMILpVltmnd8dKNcvpMYJMEsiQW5pyUyjzTKZvB6o2fPvj8PYhR1Z10axuy/QfdiApGie/uzhNdiCWwP7Tcm6PpmcxhNPO2ak= Received: by 10.36.96.3 with SMTP id t3mr1552904nzb; Tue, 27 Sep 2005 10:37:57 -0700 (PDT) Received: by 10.36.252.49 with HTTP; Tue, 27 Sep 2005 10:37:54 -0700 (PDT) Message-ID: Date: Tue, 27 Sep 2005 12:37:54 -0500 From: Jeff Butler Reply-To: Jeff Butler To: user-java@ibatis.apache.org, Carlos de la Flor Egiluz Subject: Re: the systems cannot load the resource files In-Reply-To: <549b4e7b05092707305aa583d4@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_2377_11886143.1127842674957" References: <549b4e7b05092707305aa583d4@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_2377_11886143.1127842674957 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline No helper class is needed. Larry's post is correct - getResourceAsReader reads from the classpath. If you do this: Resources.getResourceAsReader("resources/daoConfig.xml"); Then make sure that this file exists: .../web-inf/classes/resources/daoConfig.xml. Jeff Butler On 9/27/05, Carlos de la Flor Egiluz wrote: > > bufff! i dont know how to make it. > i never have been made one help class. > can you help me? > is one normal class? what returns this class. > can you help me please? > thanks > > 2005/9/27, Priyesh Mashelkar : > > > > There is one solution. > > You will need a helper class in the resource package which will read th= e > > file using the following code: > > this.getClass().getResource("daoConfig.xml") > > The helper class has to exist in the same package as the xml file to be > > able to find the xml file. > > Regards, > > Priyesh > > > > ------------------------------ > > *From:* Carlos de la Flor Egiluz [mailto:c.delaflor@gmail.com] > > *Sent: *Tuesday, September 27, 2005 7:48 PM > > *To:* lmeadors@apache.org > > *Cc:* user-java@ibatis.apache.org > > *Subject:* Re: the systems cannot load the resource files > > > > But i have one great problem. > > i am using WSAD for develop the application. > > i must to build one ear file for deploy it into the WAS. > > i dont know the absolute path into the server for oput it into my xml > > files. > > do you know any solution? > > > > 2005/9/27, Larry Meadors : > > > > > > This line is wrong: > > > > > > Resources.getResourceAsReader("../../resources/daoConfig.xml"); > > > > > > Resources are absolute names based on the classpath. So, if you put > > > your daoConfig.xml file in a resources package, you would use this > > > instead: > > > > > > Resources.getResourceAsReader("/resources/daoConfig.xml"); > > > > > > Larry > > > > > > > > > On 9/27/05, Carlos de la Flor Egiluz wrote: > > > > > > > > > > > > Hello i am new using ibatis. > > > > I am working, making, one j2ee applicaction. > > > > the packeages are: > > > > com.domain.resources > > > > com.domain.ibatis.sqlmapdao > > > > > > > > in the sqlmapdao package i have one class, DaoConfig.java with this= . > > > > > > > > public static DaoManager getDaoManager(){ > > > > DaoManager daoManager=3Dnull; > > > > try{ > > > > Reader reader =3D > > > > Resources.getResourceAsReader("../../resources/daoConfig.xml"); > > > > daoManager =3D DaoManagerBuilder.buildDaoManager (reader); > > > > } > > > > .... > > > > > > > > in the resources package i have: > > > > the xqlmapconfig, iwth the configuration to the db and with the > > > includes for > > > > the sql xml files. > > > > > > > > i cannot deploy my application into one was server. > > > > the server log says me the the resource file has been begin with on= e > > > / > > > > > > > > how must i to load the resource files? > > > > this is correct? > > > > Reader reader =3D > > > > Resources.getResourceAsReader ("../../resources/daoConfig.xml"); > > > > > > > > my application goes into one ear file for deploy into other > > > platform, i dont > > > > know the absolute path to the conf files, resource files. > > > > and the properties files go into the ear. afte the deploy i cannot > > > change. > > > > > > > > how can i solve this problem? > > > > thanks > > > > > > > > > > > > > > > > > > ------=_Part_2377_11886143.1127842674957 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
No helper class is needed.  Larry's post is correct - getResource= AsReader reads from the classpath.  If you do this:
 
Resources.getResourceAsReader("resources/= daoConfig.xml");
 
Then make sure that this file exists:
 
.../web-inf/classes/resources/daoConfig.xml.

Jeff Butler
 
On 9/27/05, = Carlos de la Flor Egiluz <c.= delaflor@gmail.com> wrote:
bufff! i dont know how to make it.
i never have been made one help class.
can you help me?
is one normal class? what returns this class.
can you help me please?
thanks

 
2005/9/27, Priyesh Mashelkar <priyeshm@mastek.com>:=20
There is one solution.
You will need a helper class in the resource package wh= ich will read the file using the following code:
this.getClass().getResource(&qu= ot;daoConfig.xml")
The helper class has to exist in the same package as th= e xml file to be able to find the xml file.
 
Regards,
Priyesh
 


From: Carlos de la Flor Egiluz [mai= lto:c.delaflor@gmail.com]
<= b>Sent:=20 Tuesday, September 27, 2005 7:48 PM
To: lmeadors@apache.org
Cc: user-java@ibatis.apache.org
Subject: Re: the systems cannot l= oad the resource files

 
But i have one great problem.
i am using WSAD for develop the application.
i must to build one ear file for deploy it into the WAS.
i dont know the absolute path into the server for oput it into my xml = files.
 =
do you know any solution?

 
2005/9/27, Larry Meadors <larry.meadors@gmail.com>:=20
This line is wrong:

Resou= rces.getResourceAsReader("../../resources/daoConfig.xml");
Resources are absolute names based on the classpath. So, if you put
your= daoConfig.xml file in a resources package, you would use this
instead:<= br>
Resources.getResourceAsReader("/resources/daoConfig.xml");= =20

Larry


On 9/27/05, Carlos de la Flor Egiluz <c.delaflor@gmail.com> wrote:
><= br> >
> Hello i am new using ibatis.
> I am working, making, one= j2ee applicaction.
> the packeages are:
> com.domain.resource= s
> com.domain.ibatis.sqlmapdao
>
> in the sqlmapdao pack= age i have one class,=20 DaoConfig.java with this.
>
> public static DaoManager getDaoMa= nager(){
> DaoManager daoManager=3Dnull;
> try{
> Reader= reader =3D
> Resources.getResourceAsReader("../../resources/dao= Config.xml");=20
> daoManager =3D DaoManagerBuilder.buildDaoManager (reader);
>= }
> ....
>
> in the resources package i have:
> th= e xqlmapconfig, iwth the configuration to the db and with the includes for= =20
> the sql xml files.
>
> i cannot deploy my application = into one was server.
> the server log says me the the resource file = has been begin with one /
>
> how must i to load the resource f= iles?=20
> this is correct?
> Reader reader =3D
> Resources.getRe= sourceAsReader ("../../resources/daoConfig.xml");
>
>= my application goes into one ear file for deploy into other platform, i do= nt=20
> know the absolute path to the conf files, resource files.
> = and the properties files go into the ear. afte the deploy i cannot change. =
>
> how can i solve this problem?
> thanks
>






------=_Part_2377_11886143.1127842674957--