Hi, I am developing a web app and when i deploy on tomcat 7, it gives me this error in my template.xhtml:

Unknown attribute (contentType)

and in browser, it give me this:

exception

javax.servlet.ServletException: org.hibernate.exception.GenericJDBCException: Cannot open connection
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:321)
    com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:129)
    com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:77)
    org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
root cause

javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Cannot open connection
    org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1235)
    org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1168)
    org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:250)
    org.customerapp.dao.CustomerDAOImpl.findAllCustomers(CustomerDAOImpl.java:556)
    org.customerapp.dao.CustomerDAOImpl.findAllCustomers(CustomerDAOImpl.java:544)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
    org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    $Proxy26.findAllCustomers(Unknown Source)
    org.customerapp.service.CustomerServiceImpl.loadCustomers(CustomerServiceImpl.java:45)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
    org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    $Proxy27.loadCustomers(Unknown Source)
    org.customerapp.web.jsf.CustomerComponentImpl.listCustomers(CustomerComponentImpl.java:69)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
    org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    $Proxy29.listCustomers(Unknown Source)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
    org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
    org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    $Proxy10.listCustomers(Unknown Source)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    javax.el.BeanELResolver.invokeMethod(BeanELResolver.java:737)
    javax.el.BeanELResolver.invoke(BeanELResolver.java:467)
    javax.el.CompositeELResolver.invoke(CompositeELResolver.java:246)
    com.sun.el.parser.AstValue.getValue(AstValue.java:111)
    com.sun.el.parser.AstValue.getValue(AstValue.java:163)
    com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:219)
    com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:106)
    javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:190)
    javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:178)
    javax.faces.component.UIData.getValue(UIData.java:554)
    javax.faces.component.UIData.getDataModel(UIData.java:1278)
    javax.faces.component.UIData.getRowCount(UIData.java:339)
    org.primefaces.component.datatable.DataTableRenderer.getNumberOfRowsToRender(DataTableRenderer.java:690)
    org.primefaces.component.datatable.DataTableRenderer.encodeTable(DataTableRenderer.java:562)
    org.primefaces.component.datatable.DataTableRenderer.encodeMarkup(DataTableRenderer.java:492)
    org.primefaces.component.datatable.DataTableRenderer.encodeEnd(DataTableRenderer.java:273)
    javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:879)
    javax.faces.component.UIComponent.encodeAll(UIComponent.java:1650)
    javax.faces.render.Renderer.encodeChildren(Renderer.java:164)
    javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:849)
    javax.faces.component.UIComponent.encodeAll(UIComponent.java:1643)
    javax.faces.component.UIComponent.encodeAll(UIComponent.java:1646)
    javax.faces.component.UIComponent.encodeAll(UIComponent.java:1646)
    com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:389)
    com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:127)
    com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:117)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
    com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:135)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:309)
    com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:129)
    com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:77)
    org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

and my template.xhtml:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.prime.com.tr/ui">

    <f:view contentType="text/html">

        <h:head>
            <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
        <link type="text/css" rel="stylesheet" href="#{request.contextPath}/css/jsfdefault.css" />
        <link type="text/css" rel="stylesheet" href="#{request.contextPath}/themes/sam/skin.css" />
    <style type="text/css"> 
        .save {
            background-image: url(#{request.contextPath}/images/icons/edit.gif) !important;
        }
        .back {
            background-image: url(#{request.contextPath}/images/icons/back.gif) !important;
        }
        .delete {
            background-image: url(#{request.contextPath}/images/icons/delete.gif) !important;
        }
        .edit {
            background-image: url(#{request.contextPath}/images/icons/edit.gif) !important;
        }
        .new {
            background-image: url(#{request.contextPath}/images/icons/new.gif) !important;
        }
        .view {
            background-image: url(#{request.contextPath}/images/icons/view.gif) !important;
        }
    </style>             
            <ui:insert name="head"></ui:insert>
        </h:head>
        <h:body>
            <div class="outer-container">
                <div class="inner-container">
                    <div class="main">

                        <div class="content" >
                            <ui:insert name="content">
                            </ui:insert>
                        </div>

                        <div class="clearer"></div>

                    </div>           
                </div></div>
        </h:body>
    </f:view>
   </html>

I would be glad if someone can help me plz. the same program i was running and all was working fine. Suddenly I start to get this error without making any change in the program.
Thanks in advance :)

Problem solved. forgot to start Myeclipse Derby (virtual database)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.