You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Enrique Ferreyra <ef...@gmail.com> on 2006/04/06 18:12:09 UTC

config files, where ?

Hi, this is kind of newbie question...

I have an application in serveral JARs, i would like to all share the 
ibatis files (sql maps)  but i dont know how, currently this apps are 
NetBeans project, and i put the files in the Project/Build/Classes 
because i reference the file whitout path, the problem is if i do clean 
project NetBeans delete that dir, also if i run the generated jar the 
app cant find the files...

Where is the best place to put this files in this situation, and how 
reference to it ?

Thanks

-- 
  A.U.S. Enrique Ferreyra
    Centro de Cómputos
 Red Megatone - Red Confina


Re: config files, where ?

Posted by Larry Meadors <lm...@apache.org>.
On 4/6/06, Enrique Ferreyra <ef...@gmail.com> wrote:
> ok, thanks anyway, my problem is the first / in the resource path.
>
> newbie problem...

Heh, not always - I have had similar problems with needing (or not
needing) that leading slash - I think it varies by classloader. :-/

Larry

Re: config files, where ?

Posted by Enrique Ferreyra <ef...@gmail.com>.
ok, thanks anyway, my problem is the first / in the resource path.

newbie problem...


Ted Schrader escribió:

>Hi Enrique,
>
>Hmm.  Well, my project is a web site, so in my case I'm using:
>
>"/WEB-INF/classes/com/mycompany/myapp/sqlmaps/sql-map-config.xml"
>
>If your project isn't a web site, I'm not sure about the resource path.
>
>Ted
>
>
>On 06/04/06, Enrique Ferreyra <ef...@gmail.com> wrote:
>  
>
>>ok, i like that but how do you reference the sqlmap.xml ?
>>
>>I try put in package com.ccem.comun, and reference  like this:
>>
>>                String resource = "/com/ccem/comun/SqlMap.xml";
>>                Reader reader = Resources.getResourceAsReader(resource);
>>                sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
>>
>>But i get:
>>
>>java.io.IOException: Could not find resource
>>/com/ccem/comun/SqlMapConfig.xml
>>
>>help...
>>thanks!
>>
>>Ted Schrader escribió:
>>
>>    
>>
>>>Hello,
>>>
>>>For my project I'm keeping the SQLMaps under a java package, like this:
>>>
>>>com.mycompany.myapp.sqlmaps
>>>
>>>Because this implies that the SQLMaps as part of the source, my build
>>>process includes them in the jar/war/ear.
>>>
>>>Ted
>>>
>>>On 06/04/06, Cimballi <ci...@gmail.com> wrote:
>>>
>>>
>>>      
>>>
>>>>Hi,
>>>>
>>>>I use a separate folder for configuration files and I put this folder
>>>>in the classpath.
>>>>Maybe there are better solutions...
>>>>
>>>>Cimballi
>>>>
>>>>
>>>>On 4/6/06, Enrique Ferreyra <ef...@gmail.com> wrote:
>>>>
>>>>
>>>>        
>>>>
>>>>>Hi, this is kind of newbie question...
>>>>>
>>>>>I have an application in serveral JARs, i would like to all share the
>>>>>ibatis files (sql maps)  but i dont know how, currently this apps are
>>>>>NetBeans project, and i put the files in the Project/Build/Classes
>>>>>because i reference the file whitout path, the problem is if i do clean
>>>>>project NetBeans delete that dir, also if i run the generated jar the
>>>>>app cant find the files...
>>>>>
>>>>>Where is the best place to put this files in this situation, and how
>>>>>reference to it ?
>>>>>
>>>>>Thanks
>>>>>
>>>>>--
>>>>> A.U.S. Enrique Ferreyra
>>>>>   Centro de Cómputos
>>>>>Red Megatone - Red Confina
>>>>>
>>>>>
>>>>>          
>>>>>
>>>
>>>      
>>>
>>--
>>  A.U.S. Enrique Ferreyra
>>    Centro de Cómputos
>> Red Megatone - Red Confina
>>
>>
>>    
>>
>
>  
>

-- 
  A.U.S. Enrique Ferreyra
    Centro de Cómputos
 Red Megatone - Red Confina


Re: config files, where ?

Posted by Ted Schrader <ts...@gmail.com>.
Hi Enrique,

Hmm.  Well, my project is a web site, so in my case I'm using:

"/WEB-INF/classes/com/mycompany/myapp/sqlmaps/sql-map-config.xml"

If your project isn't a web site, I'm not sure about the resource path.

Ted


On 06/04/06, Enrique Ferreyra <ef...@gmail.com> wrote:
> ok, i like that but how do you reference the sqlmap.xml ?
>
> I try put in package com.ccem.comun, and reference  like this:
>
>                 String resource = "/com/ccem/comun/SqlMap.xml";
>                 Reader reader = Resources.getResourceAsReader(resource);
>                 sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
>
> But i get:
>
> java.io.IOException: Could not find resource
> /com/ccem/comun/SqlMapConfig.xml
>
> help...
> thanks!
>
> Ted Schrader escribió:
>
> >Hello,
> >
> >For my project I'm keeping the SQLMaps under a java package, like this:
> >
> >com.mycompany.myapp.sqlmaps
> >
> >Because this implies that the SQLMaps as part of the source, my build
> >process includes them in the jar/war/ear.
> >
> >Ted
> >
> >On 06/04/06, Cimballi <ci...@gmail.com> wrote:
> >
> >
> >>Hi,
> >>
> >>I use a separate folder for configuration files and I put this folder
> >>in the classpath.
> >>Maybe there are better solutions...
> >>
> >>Cimballi
> >>
> >>
> >>On 4/6/06, Enrique Ferreyra <ef...@gmail.com> wrote:
> >>
> >>
> >>>Hi, this is kind of newbie question...
> >>>
> >>>I have an application in serveral JARs, i would like to all share the
> >>>ibatis files (sql maps)  but i dont know how, currently this apps are
> >>>NetBeans project, and i put the files in the Project/Build/Classes
> >>>because i reference the file whitout path, the problem is if i do clean
> >>>project NetBeans delete that dir, also if i run the generated jar the
> >>>app cant find the files...
> >>>
> >>>Where is the best place to put this files in this situation, and how
> >>>reference to it ?
> >>>
> >>>Thanks
> >>>
> >>>--
> >>>  A.U.S. Enrique Ferreyra
> >>>    Centro de Cómputos
> >>> Red Megatone - Red Confina
> >>>
> >>>
> >
> >
> >
>
> --
>   A.U.S. Enrique Ferreyra
>     Centro de Cómputos
>  Red Megatone - Red Confina
>
>

Re: config files, where ?

Posted by Enrique Ferreyra <ef...@gmail.com>.
ok, i like that but how do you reference the sqlmap.xml ?

I try put in package com.ccem.comun, and reference  like this:

                String resource = "/com/ccem/comun/SqlMap.xml";
                Reader reader = Resources.getResourceAsReader(resource);
                sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);

But i get:

java.io.IOException: Could not find resource 
/com/ccem/comun/SqlMapConfig.xml

help...
thanks!

Ted Schrader escribió:

>Hello,
>
>For my project I'm keeping the SQLMaps under a java package, like this:
>
>com.mycompany.myapp.sqlmaps
>
>Because this implies that the SQLMaps as part of the source, my build
>process includes them in the jar/war/ear.
>
>Ted
>
>On 06/04/06, Cimballi <ci...@gmail.com> wrote:
>  
>
>>Hi,
>>
>>I use a separate folder for configuration files and I put this folder
>>in the classpath.
>>Maybe there are better solutions...
>>
>>Cimballi
>>
>>
>>On 4/6/06, Enrique Ferreyra <ef...@gmail.com> wrote:
>>    
>>
>>>Hi, this is kind of newbie question...
>>>
>>>I have an application in serveral JARs, i would like to all share the
>>>ibatis files (sql maps)  but i dont know how, currently this apps are
>>>NetBeans project, and i put the files in the Project/Build/Classes
>>>because i reference the file whitout path, the problem is if i do clean
>>>project NetBeans delete that dir, also if i run the generated jar the
>>>app cant find the files...
>>>
>>>Where is the best place to put this files in this situation, and how
>>>reference to it ?
>>>
>>>Thanks
>>>
>>>--
>>>  A.U.S. Enrique Ferreyra
>>>    Centro de Cómputos
>>> Red Megatone - Red Confina
>>>      
>>>
>
>  
>

-- 
  A.U.S. Enrique Ferreyra
    Centro de Cómputos
 Red Megatone - Red Confina


Re: config files, where ?

Posted by Ted Schrader <ts...@gmail.com>.
Hello,

For my project I'm keeping the SQLMaps under a java package, like this:

com.mycompany.myapp.sqlmaps

Because this implies that the SQLMaps as part of the source, my build
process includes them in the jar/war/ear.

Ted

On 06/04/06, Cimballi <ci...@gmail.com> wrote:
> Hi,
>
> I use a separate folder for configuration files and I put this folder
> in the classpath.
> Maybe there are better solutions...
>
> Cimballi
>
>
> On 4/6/06, Enrique Ferreyra <ef...@gmail.com> wrote:
> > Hi, this is kind of newbie question...
> >
> > I have an application in serveral JARs, i would like to all share the
> > ibatis files (sql maps)  but i dont know how, currently this apps are
> > NetBeans project, and i put the files in the Project/Build/Classes
> > because i reference the file whitout path, the problem is if i do clean
> > project NetBeans delete that dir, also if i run the generated jar the
> > app cant find the files...
> >
> > Where is the best place to put this files in this situation, and how
> > reference to it ?
> >
> > Thanks
> >
> > --
> >   A.U.S. Enrique Ferreyra
> >     Centro de Cómputos
> >  Red Megatone - Red Confina
>

Re: config files, where ?

Posted by Cimballi <ci...@gmail.com>.
Hi,

I use a separate folder for configuration files and I put this folder
in the classpath.
Maybe there are better solutions...

Cimballi


On 4/6/06, Enrique Ferreyra <ef...@gmail.com> wrote:
> Hi, this is kind of newbie question...
>
> I have an application in serveral JARs, i would like to all share the
> ibatis files (sql maps)  but i dont know how, currently this apps are
> NetBeans project, and i put the files in the Project/Build/Classes
> because i reference the file whitout path, the problem is if i do clean
> project NetBeans delete that dir, also if i run the generated jar the
> app cant find the files...
>
> Where is the best place to put this files in this situation, and how
> reference to it ?
>
> Thanks
>
> --
>   A.U.S. Enrique Ferreyra
>     Centro de Cómputos
>  Red Megatone - Red Confina