<properties>
<jersey.version>2.23.1</jersey.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<finalName>ws2</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<inherited>true</inherited>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey</groupId>
<artifactId>jersey-bom</artifactId>
<version>${jersey.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<!-- use the following artifactId if you don't need servlet 2.x
compatibility -->
<!-- artifactId>jersey-container-servlet</artifactId -->
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>6.0.2</version>
</dependency>
<dependency>
<groupId>waterwingsdao</groupId>
<artifactId>waterwingsdao</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.6.2</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-spring3</artifactId>
<version>2.23</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.3.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.3.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>4.3.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.1.0.Final</version>
<exclusions>
<exclusion>
<artifactId>jboss-logging</artifactId>
<groupId>org.jboss.logging</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
<property name="dataSource" ref="wwDbConfig" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.current_session_context_class">thread</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>
<!-- JNDI config -->
<bean id="wwDbConfig" class="org.springframework.jndi.JndiObjectFactoryBean"
scope="singleton">
<property name="jndiName" value="java:comp/env/jdbc/blahblah" />
<property name="resourceRef" value="true" />
</bean>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!-- <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId>
<version>3.6.3.Final</version> </dependency> -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>5.1.0.Final</version>
<exclusions>
<exclusion>
<artifactId>jboss-logging</artifactId>
<groupId>org.jboss.logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.2.0.Final</version>
<exclusions>
<exclusion>
<artifactId>jboss-logging</artifactId>
<groupId>org.jboss.logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>6.0.2</version>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.20.0-GA</version>
</dependency>
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5.2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.21</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.3.0.RELEASE</version>
</dependency>
</dependencies>
以下是堆栈跟踪:
组织。springframework。豆。工厂BeanCreationException:创建在类路径资源[applicationContext.xml]中定义的名为“sessionFactory”的bean时出错:调用init方法失败;嵌套的异常是java。lang.NoSuchMethodError:org。jboss。登录中。记录器。debugf(Ljava/lang/String;I)V位于org。springframework。豆。工厂支持AbstractAutowireCapableBeanFactory。在org上初始化ebean(AbstractAutowireCapableBeanFactory.java:1578)。springframework。豆。工厂支持AbstractAutowireCapableBeanFactory。org上的doCreateBean(AbstractAutowireCapableBeanFactory.java:545)。springframework。豆。工厂支持AbstractAutowireCapableBeanFactory。在org上创建Bean(AbstractAutowireCapableBeanFactory.java:482)。springframework。豆。工厂支持AbstractBeanFactory 1美元。org上的getObject(AbstractBeanFactory.java:306)。springframework。豆。工厂支持DefaultSingletonBeanRegistry。getSingleton(DefaultSingletonBeanRegistry.java:230)位于org。springframework。豆。工厂支持抽象工厂。org上的doGetBean(AbstractBeanFactory.java:302)。springframework。豆。工厂支持抽象工厂。org上的getBean(AbstractBeanFactory.java:197)。springframework。豆。工厂支持DefaultListableBeanFactory。在org上预实例化Singleton(DefaultListableBeanFactory.java:756)。springframework。上下文支持AbstractApplicationContext。在org上完成BeanFactoryInitialization(AbstractApplicationContext.java:861)。springframework。上下文支持AbstractApplicationContext。在org上刷新(AbstractApplicationContext.java:541)。springframework。网状物上下文上下文加载器。在org上配置AndrefreshWebApplicationContext(ContextLoader.java:389)。springframework。网状物上下文上下文加载器。位于org的initWebApplicationContext(ContextLoader.java:294)。springframework。网状物上下文ContextLoaderListener。contextInitialized(ContextLoaderListener.java:112)位于org。阿帕奇。卡塔琳娜。果心标准上下文。listenerStart(StandardContext.java:4813)位于org。阿帕奇。卡塔琳娜。果心标准上下文。startInternal(StandardContext.java:5272)位于org。阿帕奇。卡塔琳娜。util。生命周期酶。在org上启动(LifecycleBase.java:147)。阿帕奇。卡塔琳娜。果心ContainerBase$StartChild。在org上调用(ContainerBase.java:1407)。阿帕奇。卡塔琳娜。果心ContainerBase$StartChild。在java上调用(ContainerBase.java:1397)。util。同时发生的未来任务。在java上运行(FutureTask.java:266)。util。同时发生的线程池执行器。java上的runWorker(ThreadPoolExecutor.java:1142)。util。同时发生的线程池执行器$Worker。在java上运行(ThreadPoolExecutor.java:617)。朗。丝线。运行(Thread.java:745)的原因是:java。lang.NoSuchMethodError:org。jboss。登录中。记录器。debugf(Ljava/lang/String;I)V位于org。冬眠cfg。设置。(Settings.java:81)位于org。冬眠cfg。设置。(Settings.java:50)在org上。冬眠内部的SessionFactoryImpl。(SessionFactoryImpl.java:200)位于org。冬眠靴子内部的SessionFactoryBuilderImpl。在org上构建(SessionFactoryBuilderImpl.java:476)。冬眠cfg。配置buildSessionFactory(Configuration.java:707)位于org。冬眠cfg。配置buildSessionFactory(Configuration.java:723)位于org。springframework。奥姆。冬眠。LocalSessionFactoryBean。buildSessionFactory(LocalSessionFactoryBean.java:504)位于org。springframework。奥姆。冬眠。LocalSessionFactoryBean。在org上设置AfterPropertieSet(LocalSessionFactoryBean.java:488)。springframework。豆。工厂支持AbstractAutowireCapableBeanFactory。org上的invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)。springframework。豆。工厂支持AbstractAutowireCapableBeanFactory。initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
我的意图是在MySQL之上使用hibernate构建一个Jax-RS服务,并使用Spring加载。
任何帮助都将不胜感激。
看起来您正在尝试使用Commons日志并排除jboss记录器。但是其中一个类使用jboss日志记录。从堆栈跟踪中找出调用jboss logger类的类。因为在运行时logger类不可用,所以应用程序抛出NoSuchMethodError。
我找到了答案,Hibernate 5.1.0最终版依赖于JBoss日志。我补充说
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<version>3.3.0.Final</version>
</dependency>
我仍然需要以下排除:
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-spring3</artifactId>
<version>2.23</version>
<exclusions>
<exclusion>
<groupId>org.glassfish.hk2.external</groupId>
<artifactId>bean-validator</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.3.0.RELEASE</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>5.1.0.Final</version>
<exclusions>
<exclusion>
<artifactId>jboss-logging</artifactId>
<groupId>org.jboss.logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.2.0.Final</version>
<exclusions>
<exclusion>
<artifactId>jboss-logging</artifactId>
<groupId>org.jboss.logging</groupId>
</exclusion>
</exclusions>
</dependency>
谢谢你的帮助,有时候你只需要另一双眼睛或是朝正确的方向轻推。
我们使用ivy来管理一个多项目java应用程序,最近当我们进行构建时,这个错误开始出现。这是什么原因?
读取用户登陆信息 调用地址 http://api.bilibili.cn/log/login 需要 App Key 并验证登录状态(Access key) 参数 字段 必选 类型 说明 page false int 结果分页选择 默认为第1页 pagesize false int 单页返回的记录条数,最大不超过300,默认为10。 返回 返回值字段 字段类型 字段说明 results int 返回
使用Spring Boot1.4和Logback,我在中配置日志记录: 请注意,第二种配置的建议直接来自Spring Cloud Service Registration and Discovery文档。它在信息和其他“正常”级别上工作得很好。但是,日志还显示(由我重新格式化):
Web-INF中的jboss-deployment-structure.xml: 和log4j.xml设置(在war中位于“web-inf/classes/log4j.xml”中):
一般来说,你应该在运行时增加调试选项来调试问题;也可以把调试选项添加到 Ceph 配置文件里来调试启动问题,然后查看 /var/log/ceph (默认位置)下的日志文件。 Tip 调试输出会拖慢系统,这种延时有可能掩盖竞争条件。 日志记录是资源密集任务。如果你碰到的问题在集群的某个特定区域,只启用那个区域对应的日志功能即可。例如,你的 OSD 运行良好、元数据服务器却不行,这时应该先打开那个可疑
在开发主题和插件时,调试和记录信息是非常必要的。 Grav使用如下所述的一些功能来使用调试信息。 PHP调试栏 Grav附带了一个名为Debug Bar的工具来显示调试信息。 默认情况下,此功能已禁用。 您可以全局system.yaml它,也可以将system.yaml用于您的开发环境。 debugger: enabled: true twig: true shutdown: