使用Wildfly 14部署EJB项目时无法定义类

时间:2019-11-21 12:03:46

标签: java java-ee ejb wildfly wildfly-14

我想在Wildfly 14服务器上部署我的EJB项目,我已经设置了数据源并测试了它是否有效,我在没有Java Classes的情况下测试了我的项目的部署,并且工作了,但是当我添加{ {1}}我的身体不好。 我收到的错误消息:

  

12:31:20,381警告[org.jboss.modules.define](MSC服务线程1-7)无法从服务模块加载程序:java的模块“ deployment.Projet_EJB.jar”中定义类com.session.ImpCompteSociete。 .lang.UnsupportedClassVersionError:无法链接com / session / ImpCompteSociete(来自Service Module Loader的模块“ deployment.Projet_EJB.jar”):com / session / ImpCompteSociete已由Java Runtime的最新版本进行编译(类文件版本55.0) ),此版本的Java运行时仅可识别52.0以下的类文件版本           在java.lang.ClassLoader.defineClass1(本机方法)           在java.lang.ClassLoader.defineClass(ClassLoader.java:763)

这是我的课程之一:

Java Classes

我的远程类及其接口是:

接口:

package com.entities;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;


@SuppressWarnings("serial")
@Entity
@Table(name = "tbl_clients")
public class Client implements Serializable {
    @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
    private int code;
    private String nom;
    private String prenom;
    private String ville;
    @ManyToMany(mappedBy = "clients")
    private List<Produit> produits;
    @OneToOne
    @JoinColumn(name = "numero_compte")
    private Compte_Societe compte_societe;
    public Client() {
        super();
        // TODO Auto-generated constructor stub
    }
    public Client(int code, String nom, String prenom, String ville) {
        super();
        this.code = code;
        this.nom = nom;
        this.prenom = prenom;
        this.ville = ville;
    }
    public int getCode() {
        return code;
    }
    public void setCode(int code) {
        this.code = code;
    }
    public String getNom() {
        return nom;
    }
    public void setNom(String nom) {
        this.nom = nom;
    }
    public String getPrenom() {
        return prenom;
    }
    public void setPrenom(String prenom) {
        this.prenom = prenom;
    }
    public String getVille() {
        return ville;
    }
    public void setVille(String ville) {
        this.ville = ville;
    }
    public List<Produit> getProduits() {
        return produits;
    }
    public void setProduits(List<Produit> produits) {
        this.produits = produits;
    }
    public Compte_Societe getCompte_societe() {
        return compte_societe;
    }
    public void setCompte_societe(Compte_Societe compte_societe) {
        this.compte_societe = compte_societe;
    }

}

RemoteClass:

package com.session;

import java.util.List;

import javax.ejb.Remote;

import com.entities.Client;

@Remote
public interface IRemote_Client {

    public void addClient(Client clt);
    public boolean deleteClient(int code);
    public boolean updateClient(Client clt);
    public Client getClient(int code);
    public List<Client> getAllClients();

}

和我的package com.session; import java.util.List; import javax.ejb.LocalBean; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.Query; import com.entities.Client; /** * Session Bean implementation class IRemote_Client */ @Stateless(name = "RClient") @LocalBean public class ImpClient implements IRemote_Client { @PersistenceContext EntityManager EM; public ImpClient() { // TODO Auto-generated constructor stub } @Override public void addClient(Client clt) { EM.persist(clt); } @Override public boolean deleteClient(int code) { Client clt = EM.find(Client.class, code); if(clt != null) { EM.remove(clt); return true; } return false; } @Override public boolean updateClient(Client clt) { Client client = EM.find(Client.class, clt.getCode()); if(client != null) { EM.merge(clt); return true; } return false; } @Override public Client getClient(int code) { Client clt = EM.find(Client.class, code); return clt; } @SuppressWarnings("unchecked") @Override public List<Client> getAllClients() { Query query = EM.createQuery("from Client"); return query.getResultList(); } }

Persistence.xml

0 个答案:

没有答案