私は休止状態が初めてで、コマンドライン(Windows)から SchemaExport hdm2ddl ツールを次のように実行しようとしています。
java -cp "lib/*" org.hibernate.tool.hbm2ddl.SchemaExport --config=src/hibernate.cfg.xml --create src/hello/Message.hbm.xml
私のディレクトリ構造は次のとおりです。
- HelloWorld
- bin
- lib (all of the required jars - list omitted for brevity)
- src
- hello (HelloWorld.java, Message.java & Message.hbm.xml)
- persistence (HibernateUtil.java)
- hibernate.cfg.xml
- log4j.properties
コマンドを実行しようとすると、次のエラーが発生します。
log4j:WARN No appenders could be found for logger (org.jboss.logging).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
org.hibernate.internal.util.config.ConfigurationException: Could not locate cfg.xml resource [src/hibernate.cfg.xml]
at org.hibernate.boot.cfgxml.internal.ConfigLoader.loadConfigXmlResource(ConfigLoader.java:53)
at org.hibernate.boot.registry.StandardServiceRegistryBuilder.configure(StandardServiceRegistryBuilder.java:163)
at org.hibernate.tool.hbm2ddl.SchemaExport.buildStandardServiceRegistry(SchemaExport.java:579)
at org.hibernate.tool.hbm2ddl.SchemaExport.main(SchemaExport.java:546)
これまでの私の研究:
- コマンドが hibernate.cfg.xml ファイルを見つけることができません。コマンド内のファイルのスペルを間違ったスペルに変更すると、同じエラーが発生します。
- cfg.xml ファイルをクラスパス (lib) と HelloWorld ディレクトリの両方にコピーしました。エラーが続きました。
これは基本的に「Java Persistence with Hibernate」の例ですが、ant を使用する代わりにコマンドラインから実行しています。