当前位置: 首页 > 知识库问答 >
问题:

我正在使用Spring4和Hibernate4,我已经展示了我的配置文件和库,但是得到了UnsatisfiedDependencyException

华涵意
2023-03-14

缺少哪个jar文件

jboss-logging-3.1.1.GA.jar
activation-1.0.2.jar
antlr-2.7.7.jar
aopalliance-repackaged-2.4.0-b06.jar
apache-logging-log4j.jar
commons-beanutils-1.7.0.jar
commons-collections-3.2.1.jar
commons-logging-1.1.1.jar
dom4j-1.6.1.jar
hibernate-commons-annotations-4.0.1.Final.jar
hibernate-core-4.0.1.Final.jar
hibernate-entitymanager-4.0.1.Final.jar
hibernate-jpa-2.0-api-1.0.1.Final.jar
javassist-3.4.GA.jar
javax.transaction-api-1.2.jar
jstl-1.2.jar
jta-1.1.jar
postgresql-8.4-701.jdbc3.jar
spring-aop-4.3.9.RELEASE.jar
spring-aspects-4.3.9.RELEASE.jar
spring-beans-4.3.9.RELEASE.jar
spring-context-4.3.9.RELEASE.jar
spring-core-4.3.9.RELEASE.jar
spring-expression-4.3.9.RELEASE.jar
spring-jdbc-4.3.9.RELEASE.jar
spring-orm-4.3.9.RELEASE.jar
spring-tx-4.3.9.RELEASE.jar
spring-web-4.3.9.RELEASE.jar
spring-webmvc-4.3.9.RELEASE.jar
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-4.3.xsd
http://www.springframework.org/schema/mvc 
http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd">

<mvc:annotation-driven /> 
<context:component-scan base-package="com.scm" />
<context:annotation-config />

<tx:annotation-driven transaction-manager="hibernateTransactionManager" /> 

<bean id="jspViewResolver"

class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="viewClass"
        value="org.springframework.web.servlet.view.JstlView" />
    <property name="prefix" value="WEB-INF/view/" />
    <property name="suffix" value=".jsp" />
</bean>

<bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="org.postgresql.Driver" />
    <property name="url" value="jdbc:postgresql://localhost:5433/SCM1" />
    <property name="username" value="postgres" />
    <property name="password" value="postgres123"/>
</bean> 


<bean id="sessionFactory" 
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
    <property name="dataSource" ref="dataSource" />    
    <property name="annotatedClasses">
        <list>
            <value>com.scm.Pojo.Req_Vcmd_Inter_Dist_Mas</value>
            <value>com.scm.Pojo.Req_Vcmd_Inter_Dist_Det</value>           
        </list>
    </property>     
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">
                org.hibernate.dialect.PostgreSQLDialect
            </prop>
            <prop key="hibernate.validator.apply_to_ddl">false</prop>
            <prop key="hibernate.validator.autoregister_listeners"> 
false</prop> 
              <prop key="hibernate.show_sql"> false   </prop> 

        </props>
    </property>
 </bean>

<bean id="hibernateTransactionManager" 
class="org.springframework.orm.hibernate4.HibernateTransactionManager" >
<property name="sessionFactory" ref="sessionFactory" />
</bean>

</beans>
@Service
public class scmServiceImpl implements scmService {


@Autowired
private scmDao scmdao;

public scmDao getScmdao() {
    return scmdao;
}

public void setScmdao(scmDao scmdao) {
    this.scmdao = scmdao;
}

@Override
public List<Users> getUser(String username) {   
    return scmdao.getUser(username);
}
}

控制器是:

import com.scm.Beans.Users;
import com.scm.Service.scmService;


@Controller
public class myHomeController {

@Autowired
private scmService scm_service;

public scmService getScm_service() {
    return scm_service;
}

public void setScm_service(scmService scm_service) {
    this.scm_service = scm_service;
}


HttpSession session;

public HttpSession getSession() {
    return session;
}

public void setSession(HttpSession session) {
    this.session = session;
}

}

共有1个答案

籍靖
2023-03-14

信息很清楚:

java.lang.NoClassDefFoundError: org/jboss/logging/BasicLogger

您缺少jboss-logging.jar。我建议使用像Maven或Gradle这样的依赖关系管理系统来避免这样的错误。

 类似资料:
  • org.springframework.beans.factory.beanCreationException:创建名为“student controller”的bean时出错:注入autowired依赖项失败;嵌套异常为org.springframework.beans.factory.BeanCreationException:无法自动连接字段:public edu.java.spring.d

  • 这个代码基本上是将一个数字作为字符串,我的目标是获取字符串的每个索引并将其值传输到整数数组的索引,以便我的数字在整数数组中,并且数组的每个索引表示数字的一个数字

  • 这是我的hibernate配置xml文件,我已经设置了,但仍然收到警告: 警告:不建议在没有服务器身份验证的情况下建立SSL连接。根据MySQL 5.5.45+、5.6.26+和5.7.6+的要求,如果未设置显式选项,默认情况下必须建立SSL连接。为了符合不使用SSL的现有应用程序,verifyServerCertificate属性设置为'false'。您需要通过设置usessl=false来显式

  • 在我的JavaSpringMVC应用程序中,我有一个返回用户的DAO。DAO经常被命中,所以我尝试缓存用户。 我是这样做的(如下),但我不知道我是否做对了。 我在想使得它只运行一次,并且所有其他时间的值都将从缓存中加载。 和上的和会在发生更新或删除时清除缓存。 那是正确的吗?如果是,什么时候使用合适?

  • 类路径资源[org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientAutoConfiguration$restemplateconfig$TraceInterceptorConfiguration.class]中定义的bean“traceresttemplatebeanpostsprocessor”,[org/sp

  • 问题内容: 我试图用groovy为Swagger页面编写Selenium对象构建器。为了便于讨论,我的问题代码可以简化为以下几种: 调用它非常简单(来自JUnit3): 该构造函数是一个可怕的眼睛痛!我试图用以下等待替换它: 要么: 两者都产生了相同的结果:以开头的行中的闭包中的“ org.openqa.selenium.StaleElementReferenceException:元素不再连接到