1

Am using Spring, Maven, Hibernate , MVC project. After building the project and installing the dependencies I got this exception. It seems strange. All test units sucseed and no indicator that Database configuration are incorrect.

Am using ojdbc6 driver with Tomcat7 JRE 1.7. So what's the problem ?

Note: There is no problem with the code itself. Because it is working fine with my friends. So don't tell me to change somthing related to classes or models. The project is tested fully. It seems a strange problem.

Apr 28, 2013 10:40:56 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class    com.nortal.web.listener.VersionListener
org.hibernate.MappingException: Unknown entity: com.me.personal.model.metadata.SchemaInfo
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:691)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:92)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:1090)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:1005)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:998)
at com.nortal.persistence.hibernate.dao.HibernateGenericDao.getById(HibernateGenericDao.java:90)
at com.nortal.service.impl.GenericServiceImpl.getById(GenericServiceImpl.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at sun.proxy.$Proxy19.getById(Unknown Source)
at com.nortal.web.listener.VersionListener.obtainSchemaVersion(VersionListener.java:88)
at com.nortal.web.listener.VersionListener.contextInitialized(VersionListener.java:32)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:655)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1628)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)

*.xml.hbm file

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.me.personal.metadata">
<class name="SchemaInfo" table="schema_info">
    <id name="id" type="long" column="id" />
    <property name="version" column="schema_version" type="integer" />
</class>

tereško
  • 58,060
  • 25
  • 98
  • 150
Hatem
  • 109
  • 1
  • 3
  • 10

1 Answers1

1

You have defined your hibernate XML file as *xml.hbm. This is not correct as hibernate mapping files end in *hbm.xml. Once this is resolved, you may find that Spring will be able to then load the mapping file for the POJO.

blackpanther
  • 10,998
  • 11
  • 48
  • 78
  • How are you using spring to get include the hbm.xml mapping files, because this will really be the critical issue here. – blackpanther Apr 28 '13 at 08:45