Hi all.
I hope you can help be resolve a problem with including mappings from one jar in another project.
I am using Hibernate v2.1.8 for a project consisting of two separate project strctures:
- one containing a framework with a number of classes persisted using hibernate and
- service structure which also persists a number of classes using hibernate and
relies on the mappings in the framework.
I have tried to include the mappings from the framework.jar by using the
Code:
<mapping jar="framework.jar"/>
tag in the hibernate configuration of the service project. However it throws a NulPointerException inside Configuration.addJar(String) - the problem is cause by getResource("framework.jar") called on the context class loader returning null.
(I have also tried with both relative and full path to framework.jar - but nothing seems to work.)
I know for a fact that framework.jar is in the classpath as other parts of the service project can access classes in the framework.jar without problems.
If I use the following code when configuring the HibernateSessionFactory
Code:
final File jar = new File( "/home/user/lib/framework.jar" );
factory = new Configuration()
.addJar( jar )
.configure( "service.cfg.xml" )
.buildSessionFactory();
it works fine, however specifying the full path to framework.jar is not acceptable :o(
/eiler