首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >java.lang.NoSuchMethodError:在使用Java8的Glassfish上运行的Spring、Hibernate和JSF项目中的sun.security.ssl.SSLSessionImpl.<init>

java.lang.NoSuchMethodError:在使用Java8的Glassfish上运行的Spring、Hibernate和JSF项目中的sun.security.ssl.SSLSessionImpl.<init>
EN

Stack Overflow用户
提问于 2018-09-11 20:57:01
回答 2查看 1.8K关注 0票数 2

我有一个使用以下技术的项目:

  • Spring
  • Hibernate
  • JSF
  • Server: Server 5
  • JDK版本: 1.8.0_181
  • 数据库: Sql Server-版本Intellij 2018.1.6

应用程序引发以下异常(java.lang.NoSuchMethodError):

代码语言:javascript
复制
[2018-09-11T12:57:32.846+0100] [glassfish 5.0] [WARNING] [] [org.springframework.context.annotation.AnnotationConfigApplicationContext] [tid: _ThreadID=31 _ThreadName=http-listener-1(3)] [timeMillis: 1536667052846] [levelValue: 900] [[
  Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'applicationServiceImp': Unsatisfied dependency expressed through field 'applicationDAO'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'applicationDAO': Unsatisfied dependency expressed through field 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in com.foo.app.HibernateConf: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: sun.security.ssl.SSLSessionImpl.<init>(Lsun/security/ssl/ProtocolVersion;Lsun/security/ssl/CipherSuite;Ljava/util/Collection;Lsun/security/ssl/SessionId;Ljava/lang/String;I)V]]

这是我的POM:

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.foo</groupId>
    <artifactId>FOO</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
    </properties>

    <dependencies>

        <!--EmailAddress Validator-->
        <dependency>
            <groupId>commons-validator</groupId>
            <artifactId>commons-validator</artifactId>
            <version>1.6</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.primefaces/primefaces -->
        <dependency>
            <groupId>org.primefaces</groupId>
            <artifactId>primefaces</artifactId>
            <version>6.2</version>
        </dependency>

        <dependency>
            <groupId>org.primefaces.extensions</groupId>
            <artifactId>primefaces-extensions</artifactId>
            <version>6.2</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/javax.faces/javax.faces-api -->
        <dependency>
            <groupId>javax.faces</groupId>
            <artifactId>javax.faces-api</artifactId>
            <version>2.1</version>
        </dependency>

        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>7.0</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>2.2.9</version>
        </dependency>

        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-impl</artifactId>
            <version>2.2.9</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>5.3.1.Final</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.hibernate.validator/hibernate-validator -->
        <dependency>
            <groupId>org.hibernate.validator</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>6.0.9.Final</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.17</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.17</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.lowagie/itext -->
        <dependency>
            <groupId>com.lowagie</groupId>
            <artifactId>itext</artifactId>
            <version>2.1.7</version>
        </dependency>

        <!-- spring-orm module provides the Spring integration with Hibernate -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>5.0.6.RELEASE</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>5.0.6.RELEASE</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-dbcp2 -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-dbcp2</artifactId>
            <version>2.3.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/jaxen/jaxen -->
        <dependency>
            <groupId>jaxen</groupId>
            <artifactId>jaxen</artifactId>
            <version>1.1.6</version>
        </dependency>


    </dependencies>

    <build>
        <sourceDirectory>src/main/java</sourceDirectory>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
        </resources>

        <testSourceDirectory>src/test/java</testSourceDirectory>
        <testResources>
            <testResource>
                <directory>source/test/resources</directory>
            </testResource>
        </testResources>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    <warSourceDirectory>web</warSourceDirectory>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

我没有后端技术的经验。我收到这个项目,只是想让它运行良好,这样我就可以开始改变前端。我知道它在创建这个项目的人的计算机上运行得很好。它运行时不会抛出此异常。

项目编译得很好。也开始运行得很好。我不明白为什么会发生这种异常。

EN

回答 2

Stack Overflow用户

发布于 2018-09-11 21:18:57

您应该将java (JDK & JRE)降级到1.8.0_151

这将会解决这个问题。

票数 2
EN

Stack Overflow用户

发布于 2018-09-12 08:31:34

在将java降级到1.8版本后,仍然存在相同的问题:

代码语言:javascript
复制
org.hibernate.exception.GenericJDBCException: Unable to open JDBC Connection for DDL execution]]  it seems that this error occurred due to a  bad  database connection, thus

您必须在资源文件夹下的application.properties中设置数据库连接属性

代码语言:javascript
复制
spring.datasource.driverClassName=com.mysql.jdbc.Driver 
spring.datasource.username=Ur user name 
spring.datasource.password=Your data base password
spring.datasource.platform=mysql spring.datasource.continueOnError=false
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52276514

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档