2017-02-06 10 views
0

私は動的Webプロジェクトを作成し、Eclipseの火星にJPAファセットを追加しました。 私のビルド・パスには、jdk8、EclipseLink 2.6、JPA 2.1、Tomcat 8、Oracle Thin Driver(ojdbc14.jar)があります。eclipse linkとoracle dbでテーブルを生成できません - IllegalBlockSizeException

同じプロジェクトが一部のマシンでは動作しますが、他のマシンでは動作しないため、奇妙なことがあります。

私は単なるjpaプロジェクトのエンティティからテーブルを生成したいので、tomcatは必須ではないと思います。

私は2つのJPAエンティティを作成しましたし、私は私のOracleデータベース(成功のPing)を指すようにpersistence.xmlを設定しました:

persistence.xml 
<?xml version="1.0" encoding="UTF-8"?> 
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"> 
    <persistence-unit name="question" transaction-type="RESOURCE_LOCAL"> 
     <class>it.corsojava.question.domain.Student</class> 
     <class>it.corsojava.question.domain.Question</class> 
     <properties> 
      <property name="javax.persistence.jdbc.url" value="jdbc:oracle:thin:@192.168.14.111:1521:ORCL"/> 
      <property name="javax.persistence.jdbc.user" value="fede"/> 
      <property name="javax.persistence.jdbc.password" value="fede"/> 
      <property name="javax.persistence.jdbc.driver" value="oracle.jdbc.OracleDriver"/> 
      <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/> 
      <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/> 
      <property name="javax.persistence.schema-generation.scripts.action" value="drop-and-create"/> 
      <property name="eclipselink.jdbc.bind-parameters" value="false"/> 
      <property name="eclipselink.jdbc.exclusive-connection.is-lazy" value="true"/> 
      <property name="eclipselink.jdbc.exclusive-connection.mode" value="Transactional"/> 
      <property name="eclipselink.jdbc.batch-writing" value="Oracle-JDBC"/> 
     </properties> 
    </persistence-unit> 
</persistence> 

Question.java パッケージit.corsojava.question.domain。

import java.io.Serializable; 
import java.lang.Long; 
import java.lang.String; 
import javax.persistence.*; 

/** 
* Entity implementation class for Entity: Question 
* 
*/ 
@Entity 
public class Question implements Serializable { 

    @Id @GeneratedValue(strategy=GenerationType.IDENTITY) 
    private Long id; 
    private String text; 
    private static final long serialVersionUID = 1L; 

    public Question() { 
     super(); 
    } 
    public Long getId() { 
     return this.id; 
    } 

    public void setId(Long id) { 
     this.id = id; 
    } 
    public String getText() { 
     return this.text; 
    } 

    public void setText(String text) { 
     this.text = text; 
    } 

} 

Student.java

残念ながら
package it.corsojava.question.domain; 

import java.io.Serializable; 
import java.lang.Long; 
import java.lang.String; 
import javax.persistence.*; 

/** 
* Entity implementation class for Entity: Student 
* 
*/ 
@Entity 
public class Student implements Serializable { 

    @Id @GeneratedValue(strategy=GenerationType.IDENTITY) 
    private Long id; 
    private String name; 

    private String username; 
    private String password; 
    private String email; 


    private static final long serialVersionUID = 1L; 

    public Student() { 
     super(); 
    } 
    public Long getId() { 
     return this.id; 
    } 

    public void setId(Long id) { 
     this.id = id; 
    } 
    public String getName() { 
     return this.name; 
    } 

    public void setName(String name) { 
     this.name = name; 
    } 
    public String getUsername() { 
     return this.username; 
    } 

    public void setUsername(String username) { 
     this.username = username; 
    } 
    public String getPassword() { 
     return this.password; 
    } 

    public void setPassword(String password) { 
     this.password = password; 
    } 
    public String getEmail() { 
     return this.email; 
    } 

    public void setEmail(String email) { 
     this.email = email; 
    } 

} 

、私はJPAツールを実行>エンティティからテーブルを作成します...私は、エラーを以下の取得:

[EL Fine]: server: Configured server platform: org.eclipse.persistence.platform.server.NoServerPlatform 
[EL Config]: metadata: The access type for the persistent class [class it.corsojava.question.domain.Question] is set to [FIELD]. 
[EL Config]: metadata: The access type for the persistent class [class it.corsojava.question.domain.Student] is set to [FIELD]. 
[EL Config]: metadata: The alias name for the entity class [class it.corsojava.question.domain.Question] is being defaulted to: Question. 
[EL Config]: metadata: The table name for entity [class it.corsojava.question.domain.Question] is being defaulted to: QUESTION. 
[EL Config]: metadata: The column name for element [id] is being defaulted to: ID. 
[EL Config]: metadata: The column name for element [text] is being defaulted to: TEXT. 
[EL Config]: metadata: The alias name for the entity class [class it.corsojava.question.domain.Student] is being defaulted to: Student. 
[EL Config]: metadata: The table name for entity [class it.corsojava.question.domain.Student] is being defaulted to: STUDENT. 
[EL Config]: metadata: The column name for element [password] is being defaulted to: PASSWORD. 
[EL Config]: metadata: The column name for element [name] is being defaulted to: NAME. 
[EL Config]: metadata: The column name for element [id] is being defaulted to: ID. 
[EL Config]: metadata: The column name for element [email] is being defaulted to: EMAIL. 
[EL Config]: metadata: The column name for element [username] is being defaulted to: USERNAME. 
[EL Severe]: ejb: Local Exception Stack: 
Exception [EclipseLink-7107] (Eclipse Persistence Services - 2.6.4.v20160829-44060b6): org.eclipse.persistence.exceptions.ValidationException 
Exception Description: Error encountered during string decryption. 
Internal Exception: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8 when decrypting with padded cipher 
    at org.eclipse.persistence.exceptions.ValidationException.errorDecryptingPassword(ValidationException.java:894) 
    at org.eclipse.persistence.internal.security.JCEEncryptor.decryptPassword(JCEEncryptor.java:114) 
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.updateLogins(EntityManagerSetupImpl.java:2404) 
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.updateSession(EntityManagerSetupImpl.java:2716) 
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:710) 
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getAbstractSession(EntityManagerFactoryDelegate.java:205) 
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:183) 
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getDatabaseSession(EntityManagerFactoryImpl.java:528) 
    at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactoryImpl(PersistenceProvider.java:150) 
    at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:188) 
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79) 
    at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.buildEntityManagerFactory(Main.java:94) 
    at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:80) 
    at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:68) 
Caused by: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8 when decrypting with padded cipher 
    at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:913) 
    at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:824) 
    at com.sun.crypto.provider.DESCipher.engineDoFinal(DESCipher.java:314) 
    at javax.crypto.Cipher.doFinal(Cipher.java:2165) 
    at org.eclipse.persistence.internal.security.JCEEncryptor.decryptPassword(JCEEncryptor.java:109) 
    ... 12 more 

Exception in thread "main" javax.persistence.PersistenceException: Exception [EclipseLink-7107] (Eclipse Persistence Services - 2.6.4.v20160829-44060b6): org.eclipse.persistence.exceptions.ValidationException 
Exception Description: Error encountered during string decryption. 
Internal Exception: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8 when decrypting with padded cipher 
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:815) 
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getAbstractSession(EntityManagerFactoryDelegate.java:205) 
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:183) 
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getDatabaseSession(EntityManagerFactoryImpl.java:528) 
    at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactoryImpl(PersistenceProvider.java:150) 
    at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:188) 
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79) 
    at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.buildEntityManagerFactory(Main.java:94) 
    at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:80) 
    at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:68) 
Caused by: Exception [EclipseLink-7107] (Eclipse Persistence Services - 2.6.4.v20160829-44060b6): org.eclipse.persistence.exceptions.ValidationException 
Exception Description: Error encountered during string decryption. 
Internal Exception: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8 when decrypting with padded cipher 
    at org.eclipse.persistence.exceptions.ValidationException.errorDecryptingPassword(ValidationException.java:894) 
    at org.eclipse.persistence.internal.security.JCEEncryptor.decryptPassword(JCEEncryptor.java:114) 
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.updateLogins(EntityManagerSetupImpl.java:2404) 
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.updateSession(EntityManagerSetupImpl.java:2716) 
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:710) 
    ... 9 more 
Caused by: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8 when decrypting with padded cipher 
    at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:913) 
    at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:824) 
    at com.sun.crypto.provider.DESCipher.engineDoFinal(DESCipher.java:314) 
    at javax.crypto.Cipher.doFinal(Cipher.java:2165) 
    at org.eclipse.persistence.internal.security.JCEEncryptor.decryptPassword(JCEEncryptor.java:109) 
    ... 12 more 

答えて

1

これは、既知のbugに関し、バージョン2.6.5-RC1で修正されました。また、最新の2.6.5-RC2リリース候補(2017年6月から利用可能)で期待どおりに動作します。

場合は、あなたがMavenプロジェクトを持っているので、同じようのEclipseLink依存関係のバージョン文字列を変更します。

<dependency> 
    <groupId>org.eclipse.persistence</groupId> 
    <artifactId>eclipselink</artifactId> 
    <version>2.6.5-RC2</version> 
</dependency> 

をこれは、スタンドアロンのプロジェクトの場合は、最新の2.6.5-RC2 jar file on Maven Centralを見つけます。古いjarファイルを削除して、アプリケーションのクラスパスに新しいファイルを置きます。

希望します。

関連する問題