Classpath problem with mybatis generator 1.3.5

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Classpath problem with mybatis generator 1.3.5

Carsten Langsdorf
Hello everyone,

I'm just trying to take first steps with mybatis - seems a very promising approach. Thus, I created a nice configuration file for the generator:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
        PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
        "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">

<generatorConfiguration>

   
<properties resource="database.properties"/>

   
<classPathEntry location="${driver.path}"/>

   
<context id="ODDloot" targetRuntime="MyBatis3">

       
<jdbcConnection driverClass="${driver.class}" connectionURL="${database.url}">
           
<property name="userId" value="${database.username}"/>
           
<property name="password" value="${database.password}"/>
       
</jdbcConnection>

       
<javaTypeResolver>
           
<property name="forceBigDecimals" value="false"/>
       
</javaTypeResolver>

       
<javaModelGenerator targetPackage="db.batis" targetProject="\ODDloot\src">
           
<property name="enableSubPackages" value="true"/>
           
<property name="trimStrings" value="true"/>
       
</javaModelGenerator>

       
<sqlMapGenerator targetPackage="db.batis" targetProject="\ODDloot\src">
           
<property name="enableSubPackages" value="true"/>
       
</sqlMapGenerator>

       
<javaClientGenerator type="ANNOTATEDMAPPER" targetPackage="db.batis" targetProject="\ODDloot\src">
           
<property name="enableSubPackages" value="true"/>
       
</javaClientGenerator>

       
<table schema="BASE" tableName="SERVER">
           
<property name="useActualColumnNames" value="true"/>
       
</table>

   
</context>

</generatorConfiguration>

It's basically set up just like the example given here: http://www.mybatis.org/generator/configreference/xmlconfig.html

However, I am trying to use a seperate roperties file to store the database and driver information, as you can see in this line:

<properties resource="database.properties"/>

And now, I am trying to run the generator from the command line (Win10 64 bit), also just as suggested here: http://www.mybatis.org/generator/quickstart.html

And this is what I get as a result:

<properties> resource database.properties does not exist

The properties file resides in the same directory as the configuration file, as well as a copy of the generator itself - since this is just supposed to be a first test.

Here is what I already tried:
  • Specifying the classpath via -cp
  • Using full and relative paths in the configuration file to point to the property file
  • Even using a full URL in the configuration file
Whatever I try as a workaround, the properties file cannot be located, although the error message reflects the exact location given in the configuration file.

Any idea what I might be missing or doing wrong? Any help greatly appreciated.

Cheers,
Carsten

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Classpath problem with mybatis generator 1.3.5

Carsten Langsdorf
P.S.: Well, I assume it's a classpath problem. Additional information: I am running on jdk1.8.0_121.

Am Freitag, 10. Februar 2017 00:29:30 UTC+1 schrieb Carsten Langsdorf:
Hello everyone,

I'm just trying to take first steps with mybatis - seems a very promising approach. Thus, I created a nice configuration file for the generator:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
        PUBLIC "-//<a href="http://mybatis.org//DTD" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmybatis.org%2F%2FDTD\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHjp-E8UL0TmmS7A0V54yMfbtfEkA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmybatis.org%2F%2FDTD\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHjp-E8UL0TmmS7A0V54yMfbtfEkA&#39;;return true;">mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
        "<a href="http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmybatis.org%2Fdtd%2Fmybatis-generator-config_1_0.dtd\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGbQhQcAyMHnIvI65x3b69_l8vDOQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmybatis.org%2Fdtd%2Fmybatis-generator-config_1_0.dtd\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGbQhQcAyMHnIvI65x3b69_l8vDOQ&#39;;return true;">http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">

<generatorConfiguration>

   
<properties resource="database.properties"/>

   
<classPathEntry location="${driver.path}"/>

   
<context id="ODDloot" targetRuntime="MyBatis3">

       
<jdbcConnection driverClass="${driver.class}" connectionURL="${database.url}">
           
<property name="userId" value="${database.username}"/>
           
<property name="password" value="${database.password}"/>
       
</jdbcConnection>

       
<javaTypeResolver>
           
<property name="forceBigDecimals" value="false"/>
       
</javaTypeResolver>

       
<javaModelGenerator targetPackage="db.batis" targetProject="\ODDloot\src">
           
<property name="enableSubPackages" value="true"/>
           
<property name="trimStrings" value="true"/>
       
</javaModelGenerator>

       
<sqlMapGenerator targetPackage="db.batis" targetProject="\ODDloot\src">
           
<property name="enableSubPackages" value="true"/>
       
</sqlMapGenerator>

       
<javaClientGenerator type="ANNOTATEDMAPPER" targetPackage="db.batis" targetProject="\ODDloot\src">
           
<property name="enableSubPackages" value="true"/>
       
</javaClientGenerator>

       
<table schema="BASE" tableName="SERVER">
           
<property name="useActualColumnNames" value="true"/>
       
</table>

   
</context>

</generatorConfiguration>

It's basically set up just like the example given here: <a href="http://www.mybatis.org/generator/configreference/xmlconfig.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.mybatis.org%2Fgenerator%2Fconfigreference%2Fxmlconfig.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHP1kLeO4Igc5lSe_Gow4tKon1P0Q&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.mybatis.org%2Fgenerator%2Fconfigreference%2Fxmlconfig.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHP1kLeO4Igc5lSe_Gow4tKon1P0Q&#39;;return true;">http://www.mybatis.org/generator/configreference/xmlconfig.html

However, I am trying to use a seperate roperties file to store the database and driver information, as you can see in this line:

<properties resource="database.properties"/>

And now, I am trying to run the generator from the command line (Win10 64 bit), also just as suggested here: <a href="http://www.mybatis.org/generator/quickstart.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.mybatis.org%2Fgenerator%2Fquickstart.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHFefF5z7lQEjOrBtEXLoN-XuPGdw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.mybatis.org%2Fgenerator%2Fquickstart.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHFefF5z7lQEjOrBtEXLoN-XuPGdw&#39;;return true;">http://www.mybatis.org/generator/quickstart.html

And this is what I get as a result:

<properties> resource database.properties does not exist

The properties file resides in the same directory as the configuration file, as well as a copy of the generator itself - since this is just supposed to be a first test.

Here is what I already tried:
  • Specifying the classpath via -cp
  • Using full and relative paths in the configuration file to point to the property file
  • Even using a full URL in the configuration file
Whatever I try as a workaround, the properties file cannot be located, although the error message reflects the exact location given in the configuration file.

Any idea what I might be missing or doing wrong? Any help greatly appreciated.

Cheers,
Carsten

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Classpath problem with mybatis generator 1.3.5

Iwao AVE!
Hi Carsten,

URL should work.
Did you change the attribute name from 'resource' to 'url' when you tried?
I just did a quick test and the below worked on Win 10 (64 bit).
<properties url="file:///C:\...\database.properties"/>

'resource' may not work with command line execution as -cp is ignored when -jar is specified.

Hope this helps,
Iwao


2017-02-10 8:38 GMT+09:00 Carsten Langsdorf <[hidden email]>:
P.S.: Well, I assume it's a classpath problem. Additional information: I am running on jdk1.8.0_121.


Am Freitag, 10. Februar 2017 00:29:30 UTC+1 schrieb Carsten Langsdorf:
Hello everyone,

I'm just trying to take first steps with mybatis - seems a very promising approach. Thus, I created a nice configuration file for the generator:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
        PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
        "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">

<generatorConfiguration>

   
<properties resource="database.properties"/>

   
<classPathEntry location="${driver.path}"/>

   
<context id="ODDloot" targetRuntime="MyBatis3">

       
<jdbcConnection driverClass="${driver.class}" connectionURL="${database.url}">
           
<property name="userId" value="${database.username}"/>
           
<property name="password" value="${database.password}"/>
       
</jdbcConnection>

       
<javaTypeResolver>
           
<property name="forceBigDecimals" value="false"/>
       
</javaTypeResolver>

       
<javaModelGenerator targetPackage="db.batis" targetProject="\ODDloot\src">
           
<property name="enableSubPackages" value="true"/>
           
<property name="trimStrings" value="true"/>
       
</javaModelGenerator>

       
<sqlMapGenerator targetPackage="db.batis" targetProject="\ODDloot\src">
           
<property name="enableSubPackages" value="true"/>
       
</sqlMapGenerator>

       
<javaClientGenerator type="ANNOTATEDMAPPER" targetPackage="db.batis" targetProject="\ODDloot\src">
           
<property name="enableSubPackages" value="true"/>
       
</javaClientGenerator>

       
<table schema="BASE" tableName="SERVER">
           
<property name="useActualColumnNames" value="true"/>
       
</table>

   
</context>

</generatorConfiguration>

It's basically set up just like the example given here: http://www.mybatis.org/generator/configreference/xmlconfig.html

However, I am trying to use a seperate roperties file to store the database and driver information, as you can see in this line:

<properties resource="database.properties"/>

And now, I am trying to run the generator from the command line (Win10 64 bit), also just as suggested here: http://www.mybatis.org/generator/quickstart.html

And this is what I get as a result:

<properties> resource database.properties does not exist

The properties file resides in the same directory as the configuration file, as well as a copy of the generator itself - since this is just supposed to be a first test.

Here is what I already tried:
  • Specifying the classpath via -cp
  • Using full and relative paths in the configuration file to point to the property file
  • Even using a full URL in the configuration file
Whatever I try as a workaround, the properties file cannot be located, although the error message reflects the exact location given in the configuration file.

Any idea what I might be missing or doing wrong? Any help greatly appreciated.

Cheers,
Carsten

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Classpath problem with mybatis generator 1.3.5

Carsten Langsdorf
Hi Iwao,

thanks for your help. Indeed, I had forgotten to change 'resource' to 'url' - my mistake, sorry. Using a full URL works now, although it's a bit awkward.

Considering that 16 year old issue you were linking (http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4459663): It was not confirmed as a bug, but classified as a RFE, and I'm really wondering if it's still working that way.

Anyway, thanks a lot again for your help,
Carsten

Am Freitag, 10. Februar 2017 06:02:56 UTC+1 schrieb Iwao AVE!:
Hi Carsten,

URL should work.
Did you change the attribute name from 'resource' to 'url' when you tried?
I just did a quick test and the below worked on Win 10 (64 bit).
<properties url="file:///C:\...\database.properties"/>

'resource' may not work with command line execution as -cp is ignored when -jar is specified.
<a href="http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4459663" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fbugs.java.com%2Fbugdatabase%2Fview_bug.do%3Fbug_id%3D4459663\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHWiIjsJKsFugB6kJTlg5nWEtiuxQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fbugs.java.com%2Fbugdatabase%2Fview_bug.do%3Fbug_id%3D4459663\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHWiIjsJKsFugB6kJTlg5nWEtiuxQ&#39;;return true;">http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4459663

Hope this helps,
Iwao


2017-02-10 8:38 GMT+09:00 Carsten Langsdorf <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="fwS2dFNSBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">carsten....@...>:
P.S.: Well, I assume it's a classpath problem. Additional information: I am running on jdk1.8.0_121.


Am Freitag, 10. Februar 2017 00:29:30 UTC+1 schrieb Carsten Langsdorf:
Hello everyone,

I'm just trying to take first steps with mybatis - seems a very promising approach. Thus, I created a nice configuration file for the generator:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
        PUBLIC "-//<a href="http://mybatis.org//DTD" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmybatis.org%2F%2FDTD\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHjp-E8UL0TmmS7A0V54yMfbtfEkA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmybatis.org%2F%2FDTD\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHjp-E8UL0TmmS7A0V54yMfbtfEkA&#39;;return true;">mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
        "<a href="http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmybatis.org%2Fdtd%2Fmybatis-generator-config_1_0.dtd\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGbQhQcAyMHnIvI65x3b69_l8vDOQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmybatis.org%2Fdtd%2Fmybatis-generator-config_1_0.dtd\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGbQhQcAyMHnIvI65x3b69_l8vDOQ&#39;;return true;">http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">

<generatorConfiguration>

   
<properties resource="database.properties"/>

   
<classPathEntry location="${driver.path}"/>

   
<context id="ODDloot" targetRuntime="MyBatis3">

       
<jdbcConnection driverClass="${driver.class}" connectionURL="${database.url}">
           
<property name="userId" value="${database.username}"/>
           
<property name="password" value="${database.password}"/>
       
</jdbcConnection>

       
<javaTypeResolver>
           
<property name="forceBigDecimals" value="false"/>
       
</javaTypeResolver>

       
<javaModelGenerator targetPackage="db.batis" targetProject="\ODDloot\src">
           
<property name="enableSubPackages" value="true"/>
           
<property name="trimStrings" value="true"/>
       
</javaModelGenerator>

       
<sqlMapGenerator targetPackage="db.batis" targetProject="\ODDloot\src">
           
<property name="enableSubPackages" value="true"/>
       
</sqlMapGenerator>

       
<javaClientGenerator type="ANNOTATEDMAPPER" targetPackage="db.batis" targetProject="\ODDloot\src">
           
<property name="enableSubPackages" value="true"/>
       
</javaClientGenerator>

       
<table schema="BASE" tableName="SERVER">
           
<property name="useActualColumnNames" value="true"/>
       
</table>

   
</context>

</generatorConfiguration>

It's basically set up just like the example given here: <a href="http://www.mybatis.org/generator/configreference/xmlconfig.html" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.mybatis.org%2Fgenerator%2Fconfigreference%2Fxmlconfig.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHP1kLeO4Igc5lSe_Gow4tKon1P0Q&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.mybatis.org%2Fgenerator%2Fconfigreference%2Fxmlconfig.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHP1kLeO4Igc5lSe_Gow4tKon1P0Q&#39;;return true;">http://www.mybatis.org/generator/configreference/xmlconfig.html

However, I am trying to use a seperate roperties file to store the database and driver information, as you can see in this line:

<properties resource="database.properties"/>

And now, I am trying to run the generator from the command line (Win10 64 bit), also just as suggested here: <a href="http://www.mybatis.org/generator/quickstart.html" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.mybatis.org%2Fgenerator%2Fquickstart.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHFefF5z7lQEjOrBtEXLoN-XuPGdw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.mybatis.org%2Fgenerator%2Fquickstart.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHFefF5z7lQEjOrBtEXLoN-XuPGdw&#39;;return true;">http://www.mybatis.org/generator/quickstart.html

And this is what I get as a result:

<properties> resource database.properties does not exist

The properties file resides in the same directory as the configuration file, as well as a copy of the generator itself - since this is just supposed to be a first test.

Here is what I already tried:
  • Specifying the classpath via -cp
  • Using full and relative paths in the configuration file to point to the property file
  • Even using a full URL in the configuration file
Whatever I try as a workaround, the properties file cannot be located, although the error message reflects the exact location given in the configuration file.

Any idea what I might be missing or doing wrong? Any help greatly appreciated.

Cheers,
Carsten

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="fwS2dFNSBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">mybatis-user...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Classpath problem with mybatis generator 1.3.5

Iwao AVE!
Glad to know URL worked!

It still works the same way in Java 8, it seems.

> When you use the -jar option, the specified JAR file is the source of all user classes, and other class path settings are ignored.

// Iwao

2017-02-10 23:15 GMT+09:00 Carsten Langsdorf <[hidden email]>:
Hi Iwao,

thanks for your help. Indeed, I had forgotten to change 'resource' to 'url' - my mistake, sorry. Using a full URL works now, although it's a bit awkward.

Considering that 16 year old issue you were linking (http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4459663): It was not confirmed as a bug, but classified as a RFE, and I'm really wondering if it's still working that way.

Anyway, thanks a lot again for your help,
Carsten

Am Freitag, 10. Februar 2017 06:02:56 UTC+1 schrieb Iwao AVE!:
Hi Carsten,

URL should work.
Did you change the attribute name from 'resource' to 'url' when you tried?
I just did a quick test and the below worked on Win 10 (64 bit).
<properties url="file:///C:\...\database.properties"/>

'resource' may not work with command line execution as -cp is ignored when -jar is specified.

Hope this helps,
Iwao


2017-02-10 8:38 GMT+09:00 Carsten Langsdorf <[hidden email]>:
P.S.: Well, I assume it's a classpath problem. Additional information: I am running on jdk1.8.0_121.


Am Freitag, 10. Februar 2017 00:29:30 UTC+1 schrieb Carsten Langsdorf:
Hello everyone,

I'm just trying to take first steps with mybatis - seems a very promising approach. Thus, I created a nice configuration file for the generator:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
        PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
        "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">

<generatorConfiguration>

   
<properties resource="database.properties"/>

   
<classPathEntry location="${driver.path}"/>

   
<context id="ODDloot" targetRuntime="MyBatis3">

       
<jdbcConnection driverClass="${driver.class}" connectionURL="${database.url}">
           
<property name="userId" value="${database.username}"/>
           
<property name="password" value="${database.password}"/>
       
</jdbcConnection>

       
<javaTypeResolver>
           
<property name="forceBigDecimals" value="false"/>
       
</javaTypeResolver>

       
<javaModelGenerator targetPackage="db.batis" targetProject="\ODDloot\src">
           
<property name="enableSubPackages" value="true"/>
           
<property name="trimStrings" value="true"/>
       
</javaModelGenerator>

       
<sqlMapGenerator targetPackage="db.batis" targetProject="\ODDloot\src">
           
<property name="enableSubPackages" value="true"/>
       
</sqlMapGenerator>

       
<javaClientGenerator type="ANNOTATEDMAPPER" targetPackage="db.batis" targetProject="\ODDloot\src">
           
<property name="enableSubPackages" value="true"/>
       
</javaClientGenerator>

       
<table schema="BASE" tableName="SERVER">
           
<property name="useActualColumnNames" value="true"/>
       
</table>

   
</context>

</generatorConfiguration>

It's basically set up just like the example given here: http://www.mybatis.org/generator/configreference/xmlconfig.html

However, I am trying to use a seperate roperties file to store the database and driver information, as you can see in this line:

<properties resource="database.properties"/>

And now, I am trying to run the generator from the command line (Win10 64 bit), also just as suggested here: http://www.mybatis.org/generator/quickstart.html

And this is what I get as a result:

<properties> resource database.properties does not exist

The properties file resides in the same directory as the configuration file, as well as a copy of the generator itself - since this is just supposed to be a first test.

Here is what I already tried:
  • Specifying the classpath via -cp
  • Using full and relative paths in the configuration file to point to the property file
  • Even using a full URL in the configuration file
Whatever I try as a workaround, the properties file cannot be located, although the error message reflects the exact location given in the configuration file.

Any idea what I might be missing or doing wrong? Any help greatly appreciated.

Cheers,
Carsten

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]om.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Classpath problem with mybatis generator 1.3.5

Carsten Langsdorf
Hi Iwao,

thanks again for your help.

> When you use the -jar option, the specified JAR file is the source of all user classes, and other class path settings are ignored.

Good to know.

Cheers,
Carsten 

Am Samstag, 11. Februar 2017 10:16:07 UTC+1 schrieb Iwao AVE!:
Glad to know URL worked!

It still works the same way in Java 8, it seems.
<a href="https://docs.oracle.com/javase/8/docs/technotes/tools/unix/java.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fdocs.oracle.com%2Fjavase%2F8%2Fdocs%2Ftechnotes%2Ftools%2Funix%2Fjava.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGoGBFggf0OhWQYT6KAtBoqgdPk1A&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fdocs.oracle.com%2Fjavase%2F8%2Fdocs%2Ftechnotes%2Ftools%2Funix%2Fjava.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGoGBFggf0OhWQYT6KAtBoqgdPk1A&#39;;return true;">https://docs.oracle.com/javase/8/docs/technotes/tools/unix/java.html

> When you use the -jar option, the specified JAR file is the source of all user classes, and other class path settings are ignored.

// Iwao

2017-02-10 23:15 GMT+09:00 Carsten Langsdorf <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="Hlvc1biuBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">carsten....@...>:
Hi Iwao,

thanks for your help. Indeed, I had forgotten to change 'resource' to 'url' - my mistake, sorry. Using a full URL works now, although it's a bit awkward.

Considering that 16 year old issue you were linking (<a href="http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4459663" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fbugs.java.com%2Fbugdatabase%2Fview_bug.do%3Fbug_id%3D4459663\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHWiIjsJKsFugB6kJTlg5nWEtiuxQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fbugs.java.com%2Fbugdatabase%2Fview_bug.do%3Fbug_id%3D4459663\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHWiIjsJKsFugB6kJTlg5nWEtiuxQ&#39;;return true;">http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4459663): It was not confirmed as a bug, but classified as a RFE, and I'm really wondering if it's still working that way.

Anyway, thanks a lot again for your help,
Carsten

Am Freitag, 10. Februar 2017 06:02:56 UTC+1 schrieb Iwao AVE!:
Hi Carsten,

URL should work.
Did you change the attribute name from 'resource' to 'url' when you tried?
I just did a quick test and the below worked on Win 10 (64 bit).
<properties url="file:///C:\...\database.properties"/>

'resource' may not work with command line execution as -cp is ignored when -jar is specified.
<a href="http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4459663" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fbugs.java.com%2Fbugdatabase%2Fview_bug.do%3Fbug_id%3D4459663\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHWiIjsJKsFugB6kJTlg5nWEtiuxQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fbugs.java.com%2Fbugdatabase%2Fview_bug.do%3Fbug_id%3D4459663\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHWiIjsJKsFugB6kJTlg5nWEtiuxQ&#39;;return true;">http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4459663

Hope this helps,
Iwao


2017-02-10 8:38 GMT+09:00 Carsten Langsdorf <[hidden email]>:
P.S.: Well, I assume it's a classpath problem. Additional information: I am running on jdk1.8.0_121.


Am Freitag, 10. Februar 2017 00:29:30 UTC+1 schrieb Carsten Langsdorf:
Hello everyone,

I'm just trying to take first steps with mybatis - seems a very promising approach. Thus, I created a nice configuration file for the generator:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
        PUBLIC "-//<a href="http://mybatis.org//DTD" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmybatis.org%2F%2FDTD\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHjp-E8UL0TmmS7A0V54yMfbtfEkA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmybatis.org%2F%2FDTD\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHjp-E8UL0TmmS7A0V54yMfbtfEkA&#39;;return true;">mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
        "<a href="http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmybatis.org%2Fdtd%2Fmybatis-generator-config_1_0.dtd\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGbQhQcAyMHnIvI65x3b69_l8vDOQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmybatis.org%2Fdtd%2Fmybatis-generator-config_1_0.dtd\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGbQhQcAyMHnIvI65x3b69_l8vDOQ&#39;;return true;">http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">

<generatorConfiguration>

   
<properties resource="database.properties"/>

   
<classPathEntry location="${driver.path}"/>

   
<context id="ODDloot" targetRuntime="MyBatis3">

       
<jdbcConnection driverClass="${driver.class}" connectionURL="${database.url}">
           
<property name="userId" value="${database.username}"/>
           
<property name="password" value="${database.password}"/>
       
</jdbcConnection>

       
<javaTypeResolver>
           
<property name="forceBigDecimals" value="false"/>
       
</javaTypeResolver>

       
<javaModelGenerator targetPackage="db.batis" targetProject="\ODDloot\src">
           
<property name="enableSubPackages" value="true"/>
           
<property name="trimStrings" value="true"/>
       
</javaModelGenerator>

       
<sqlMapGenerator targetPackage="db.batis" targetProject="\ODDloot\src">
           
<property name="enableSubPackages" value="true"/>
       
</sqlMapGenerator>

       
<javaClientGenerator type="ANNOTATEDMAPPER" targetPackage="db.batis" targetProject="\ODDloot\src">
           
<property name="enableSubPackages" value="true"/>
       
</javaClientGenerator>

       
<table schema="BASE" tableName="SERVER">
           
<property name="useActualColumnNames" value="true"/>
       
</table>

   
</context>

</generatorConfiguration>

It's basically set up just like the example given here: <a href="http://www.mybatis.org/generator/configreference/xmlconfig.html" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.mybatis.org%2Fgenerator%2Fconfigreference%2Fxmlconfig.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHP1kLeO4Igc5lSe_Gow4tKon1P0Q&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.mybatis.org%2Fgenerator%2Fconfigreference%2Fxmlconfig.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHP1kLeO4Igc5lSe_Gow4tKon1P0Q&#39;;return true;">http://www.mybatis.org/generator/configreference/xmlconfig.html

However, I am trying to use a seperate roperties file to store the database and driver information, as you can see in this line:

<properties resource="database.properties"/>

And now, I am trying to run the generator from the command line (Win10 64 bit), also just as suggested here: <a href="http://www.mybatis.org/generator/quickstart.html" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.mybatis.org%2Fgenerator%2Fquickstart.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHFefF5z7lQEjOrBtEXLoN-XuPGdw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.mybatis.org%2Fgenerator%2Fquickstart.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHFefF5z7lQEjOrBtEXLoN-XuPGdw&#39;;return true;">http://www.mybatis.org/generator/quickstart.html

And this is what I get as a result:

<properties> resource database.properties does not exist

The properties file resides in the same directory as the configuration file, as well as a copy of the generator itself - since this is just supposed to be a first test.

Here is what I already tried:
  • Specifying the classpath via -cp
  • Using full and relative paths in the configuration file to point to the property file
  • Even using a full URL in the configuration file
Whatever I try as a workaround, the properties file cannot be located, although the error message reflects the exact location given in the configuration file.

Any idea what I might be missing or doing wrong? Any help greatly appreciated.

Cheers,
Carsten

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="Hlvc1biuBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">mybatis-user...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.