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>

7
  • 1
    Somehow the class is not getting mapping by hibernate. Only showing the error doesn't give enough info. Please show the hibernate configuration. And relevant code. Commented Apr 28, 2013 at 6:51
  • @Bart ok , I will do ! Commented Apr 28, 2013 at 6:52
  • 1
    Please dont shout on us.we done nothing to your code Commented Apr 28, 2013 at 6:54
  • @Baadshah :) I want to see the real reasons. Because I think it is not code issue. It is enviroment issue or something like this ! Commented Apr 28, 2013 at 6:57
  • Is your hibernate.hbm.xml including all required *.hbm.xml ? Is SchemaInfo the first declared in your hibernate.hbm.xml ? Commented Apr 28, 2013 at 7:07

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

How are you using spring to get include the hbm.xml mapping files, because this will really be the critical issue here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.