qq_34565245 2017-04-25 03:49 采纳率: 0%
浏览 2896

ssh遇到jdbc4.MySQLSyntaxErrorException:

用SSH做了一个客户团队管理项目,放在tomcat启动之后就报错,网页也打不开,怎么办呢
下面放上代码。这个项目采用的是C3P0方式接入(失败),JDBC的方式倒是可以接入(别的
项目但是同是使用一个表,tomcat服务器把那个项目清空了,应该不是误读别的项目引起的)

这个是报错的代码段

Hibernate: 
    select
        sysconstan0_.id as id9_,
        sysconstan0_.sysname as sysname9_,
        sysconstan0_.systitle as systitle9_ 
    from
        customer.sysconstant sysconstan0_
[org.hibernate.util.JDBCExceptionReporter] - SQL Error: 1146, SQLState: 42S02
  [org.hibernate.util.JDBCExceptionReporter] - Table 'customer.sysconstant' doesn't exist
  四月 25, 2017 11:37:31 上午 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class com.j160425.listener.InitListener
org.hibernate.exception.SQLGrammarException: could not execute query
    at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90)
    at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
    at org.hibernate.loader.Loader.doList(Loader.java:2235)
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2129)
    at org.hibernate.loader.Loader.list(Loader.java:2124)
    at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)
    at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
    at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
    at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1149)
    at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
    at com.j160425.dao.AHibntBaseDao.getAll(AHibntBaseDao.java:57)
    at com.j160425.dao.AHibntBaseDao$$FastClassByCGLIB$$98b08f3a.invoke(<generated>)
    at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
    at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)
    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.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)
    at com.j160425.dao.SysconstantDAO$$EnhancerByCGLIB$$b18fa81b_2.getAll(<generated>)
    at com.j160425.listener.InitListener.contextInitialized(InitListener.java:43)
    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:618)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1100)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1618)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    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:744)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'customer.sysconstant' doesn't exist
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
    at com.mysql.jdbc.Util.getInstance(Util.java:386)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1053)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4096)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4028)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2490)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2651)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2734)
    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155)
    at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2322)
    at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
    at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
    at org.hibernate.loader.Loader.getResultSet(Loader.java:1812)
    at org.hibernate.loader.Loader.doQuery(Loader.java:697)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
    at org.hibernate.loader.Loader.doList(Loader.java:2232)
    ... 30 more

  • 写回答

2条回答 默认 最新

  • qq_34565245 2017-04-25 03:51
    关注

    这是db.properties的配置

    <!-- 引入配置文件 -->
        <bean id="propertyConfigurer"
            class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
            <property name="location" value="classpath:com/j160425/cof/jdbc.properties" />
        </bean>
        <!-- C3p0的配置 -->
        <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
            destroy-method="close">
            <property name="driverClass" value="${c3p0.driverClass}"></property>
            <property name="jdbcUrl" value="${c3p0.url}"></property>
            <property name="user" value="${c3p0.user}"></property>
            <property name="password" value="${c3p0.password}"></property>
            <property name="acquireIncrement" value="${c3p0.acquireIncrement}"></property>
            <property name="initialPoolSize" value="${c3p0.initialPoolSize}"></property>
            <property name="maxIdleTime" value="${c3p0.maxIdleTime}"></property>
            <property name="maxPoolSize" value="${c3p0.maxPoolSize}"></property>
            <property name="minPoolSize" value="${c3p0.minPoolSize}"></property>
            <property name="acquireRetryDelay" value="1000"></property>
            <property name="acquireRetryAttempts" value="60"></property>
            <property name="breakAfterAcquireFailure" value="false"></property>
        </bean>
        <bean id="sessionFactory"
            class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
            <property name="dataSource">
                <ref bean="dataSource" />
            </property>
            <property name="hibernateProperties">
                <props>
                    <prop key="hibernate.dialect">
                        org.hibernate.dialect.MySQLDialect
                    </prop>
                    <!-- <prop key="hibernate.hbm2ddl.auto">
                        update
                    </prop> -->
                    <prop key="hibernate.show_sql">
                        true
                    </prop>
                    <prop key="hibernate.format_sql">
                        true
                    </prop>
                </props>
            </property>
    
            <property name="mappingResources">
                <list>
                    <value>com/j160425/pojo/Customer.hbm.xml</value>
                    <value>com/j160425/pojo/Sysconstant.hbm.xml</value>
                    <value>com/j160425/pojo/Team.hbm.xml</value>
                    <value>com/j160425/pojo/User.hbm.xml</value>
                </list>
            </property>
        </bean>
    
    
    
    
    
        <bean id="UserDAO" class="com.j160425.dao.UserDAO">
            <property name="sessionFactory">
                <ref bean="sessionFactory" />
            </property>
        </bean>
        <bean id="SysconstantDAO" class="com.j160425.dao.SysconstantDAO">
            <property name="sessionFactory">
                <ref bean="sessionFactory" />
            </property>
        </bean>
        <bean id="CustomerDAO" class="com.j160425.dao.CustomerDAO">
            <property name="sessionFactory">
                <ref bean="sessionFactory" />
            </property>
        </bean>
        <bean id="TeamDAO" class="com.j160425.dao.TeamDAO">
            <property name="sessionFactory">
                <ref bean="sessionFactory" />
            </property>
        </bean>
    
    
        <!-- 启用元数据配置事务 -->
        <tx:annotation-driven transaction-manager="transactionManager"
            proxy-target-class="true" />
        <!-- 声明一个 Hibernate3 的事务管理器供代理类自动管理事务用 -->
        <bean id="transactionManager"
            class="org.springframework.orm.hibernate3.HibernateTransactionManager">
            <property name="sessionFactory">
                <ref local="sessionFactory" />
            </property>
        </bean>
    
    
    </beans>
    
    
    评论

报告相同问题?

悬赏问题

  • ¥15 静电纺丝煅烧后如何得到柔性纤维
  • ¥15 (标签-react native|关键词-镜像源)
  • ¥100 照片生成3D人脸视频
  • ¥15 伪装视频时长问题修改MP4的时长问题,
  • ¥15 JETSON NANO
  • ¥15 VS开发qt时如何在paintgl函数中用pushbutton控制切换纹理
  • ¥20 关于 openpyxl 处理excel文件地问题
  • ¥15 MS中不知道高分子的构型怎么构建模型
  • ¥60 QQOP数据,什么是op数据号,怎么提取op数据!能不能大量提取(语言-c语言)
  • ¥15 matlab代码 关于微分方程和嵌套的分段函数。