模块尚未部署[netbeans+glassfish]
Posted
技术标签:
【中文标题】模块尚未部署[netbeans+glassfish]【英文标题】:The module has not been deployed [netbeans+glassfish] 【发布时间】:2014-01-03 13:07:17 【问题描述】:我正在开发一个基于J2EE EJB JSF的项目,数据库是mysql,上周项目运行良好。但是今天,我运行它时无法部署它。这里有一些例外:
Initial deploying ECOM to C:\Users\John624\Documents\NetBeansProjects\PromoCoupon\ECOM\dist\gfdeploy\ECOM
Completed initial distribution of ECOM
Initializing...
invalid header field name: Exception Description
C:\Users\John624\Documents\NetBeansProjects\PromoCoupon\ECOM\nbproject\build-impl.xml:307: The module has not been deployed.
See the server log for details.
BUILD FAILED (total time: 5 seconds)
玻璃鱼:
<code> SEVERE: Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method
SEVERE: Exception while invoking class org.glassfish.javaee.full.deployment.EarDeployer prepare method
SEVERE: org.glassfish.deployment.common.DeploymentException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [ECOM-ejbPU] failed.
Internal Exception: Exception [EclipseLink-7158] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Error encountered when building the @NamedQuery [Adresse.maxId] from entity class [class org.eclipse.persistence.internal.jpa.metadata.queries.NamedQueryMetadata].
Internal Exception: java.lang.ClassCastException: org.eclipse.persistence.jpa.jpql.parser.NullExpression cannot be cast to org.eclipse.persistence.jpa.jpql.parser.IdentificationVariable
at org.glassfish.javaee.full.deployment.EarDeployer.prepare(EarDeployer.java:180)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:922)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:431)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:356)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
at org.glassfish.grizzly.http.server.StaticHttpHandler.service(StaticHttpHandler.java:297)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.Abstractiostrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:724)
Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [ECOM-ejbPU] failed.
Internal Exception: Exception [EclipseLink-7158] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Error encountered when building the @NamedQuery [Adresse.maxId] from entity class [class org.eclipse.persistence.internal.jpa.metadata.queries.NamedQueryMetadata].
Internal Exception: java.lang.ClassCastException: org.eclipse.persistence.jpa.jpql.parser.NullExpression cannot be cast to org.eclipse.persistence.jpa.jpql.parser.IdentificationVariable
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.createPredeployFailedPersistenceException(EntityManagerSetupImpl.java:1950)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1941)
at org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactory(PersistenceProvider.java:322)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:199)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:107)
at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:223)
at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:510)
at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:230)
at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:168)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:922)
at org.glassfish.javaee.full.deployment.EarDeployer.prepareBundle(EarDeployer.java:307)
at org.glassfish.javaee.full.deployment.EarDeployer.access$200(EarDeployer.java:88)
at org.glassfish.javaee.full.deployment.EarDeployer$1.doBundle(EarDeployer.java:153)
at org.glassfish.javaee.full.deployment.EarDeployer$1.doBundle(EarDeployer.java:150)
at org.glassfish.javaee.full.deployment.EarDeployer.doOnBundles(EarDeployer.java:230)
at org.glassfish.javaee.full.deployment.EarDeployer.doOnAllTypedBundles(EarDeployer.java:239)
at org.glassfish.javaee.full.deployment.EarDeployer.doOnAllBundles(EarDeployer.java:265)
at org.glassfish.javaee.full.deployment.EarDeployer.prepare(EarDeployer.java:150)
... 35 more
Caused by: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [ECOM-ejbPU] failed.
Internal Exception: Exception [EclipseLink-7158] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Error encountered when building the @NamedQuery [Adresse.maxId] from entity class [class org.eclipse.persistence.internal.jpa.metadata.queries.NamedQueryMetadata].
Internal Exception: java.lang.ClassCastException: org.eclipse.persistence.jpa.jpql.parser.NullExpression cannot be cast to org.eclipse.persistence.jpa.jpql.parser.IdentificationVariable
at org.eclipse.persistence.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:230)
... 53 more
Caused by: Exception [EclipseLink-7158] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Error encountered when building the @NamedQuery [Adresse.maxId] from entity class [class org.eclipse.persistence.internal.jpa.metadata.queries.NamedQueryMetadata].
Internal Exception: java.lang.ClassCastException: org.eclipse.persistence.jpa.jpql.parser.NullExpression cannot be cast to org.eclipse.persistence.jpa.jpql.parser.IdentificationVariable
at org.eclipse.persistence.exceptions.ValidationException.errorProcessingNamedQuery(ValidationException.java:824)
at org.
SEVERE: Exception while preparing the app
SEVERE: eclipse.persistence.internal.jpa.metadata.queries.NamedQueryMetadata.process(NamedQueryMetadata.java:194)
at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processQueries(MetadataProject.java:1628)
at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.addNamedQueries(MetadataProcessor.java:148)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1894)
... 51 more
Caused by: java.lang.ClassCastException: org.eclipse.persistence.jpa.jpql.parser.NullExpression cannot be cast to org.eclipse.persistence.jpa.jpql.parser.IdentificationVariable
at org.eclipse.persistence.internal.jpa.jpql.DeclarationResolver$DeclarationVisitor.visit(DeclarationResolver.java:626)
at org.eclipse.persistence.jpa.jpql.parser.RangeVariableDeclaration.accept(RangeVariableDeclaration.java:98)
at org.eclipse.persistence.internal.jpa.jpql.DeclarationResolver$DeclarationVisitor.visit(DeclarationResolver.java:577)
at org.eclipse.persistence.jpa.jpql.parser.IdentificationVariableDeclaration.accept(IdentificationVariableDeclaration.java:71)
at org.eclipse.persistence.internal.jpa.jpql.DeclarationResolver$DeclarationVisitor.visit(DeclarationResolver.java:566)
at org.eclipse.persistence.jpa.jpql.parser.FromClause.accept(FromClause.java:48)
at org.eclipse.persistence.internal.jpa.jpql.DeclarationResolver.populateImp(DeclarationResolver.java:417)
at org.eclipse.persistence.internal.jpa.jpql.DeclarationResolver.populate(DeclarationResolver.java:407)
at org.eclipse.persistence.internal.jpa.jpql.JPQLQueryHelper$DescriptorCollector.collectDescriptors(JPQLQueryHelper.java:179)
at org.eclipse.persistence.internal.jpa.jpql.JPQLQueryHelper$DescriptorCollector.visit(JPQLQueryHelper.java:204)
at org.eclipse.persistence.jpa.jpql.parser.FromClause.accept(FromClause.java:48)
at org.eclipse.persistence.jpa.jpql.parser.AbstractSelectStatement.acceptChildren(AbstractSelectStatement.java:93)
at org.eclipse.persistence.jpa.jpql.parser.SelectStatement.acceptChildren(SelectStatement.java:110)
at org.eclipse.persistence.jpa.jpql.parser.AbstractTraverseChildrenVisitor.visit(AbstractTraverseChildrenVisitor.java:32)
at org.eclipse.persistence.jpa.jpql.parser.AnonymousExpressionVisitor.visit(AnonymousExpressionVisitor.java:470)
at org.eclipse.persistence.jpa.jpql.parser.SelectStatement.accept(SelectStatement.java:102)
at org.eclipse.persistence.jpa.jpql.parser.JPQLExpression.acceptChildren(JPQLExpression.java:143)
at org.eclipse.persistence.jpa.jpql.parser.AbstractTraverseChildrenVisitor.visit(AbstractTraverseChildrenVisitor.java:32)
at org.eclipse.persistence.jpa.jpql.parser.AnonymousExpressionVisitor.visit(AnonymousExpressionVisitor.java:302)
at org.eclipse.persistence.jpa.jpql.parser.JPQLExpression.accept(JPQLExpression.java:136)
at org.eclipse.persistence.internal.jpa.jpql.JPQLQueryHelper.getClassDescriptors(JPQLQueryHelper.java:87)
at org.eclipse.persistence.internal.jpa.metadata.queries.NamedQueryMetadata.addJPAQuery(NamedQueryMetadata.java:105)
at org.eclipse.persistence.internal.jpa.metadata.queries.NamedQueryMetadata.process(NamedQueryMetadata.java:192)
... 54 more
<code>
实体 bean
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package entities;
import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author John624
*/
@Entity
@Table(name = "Adresse")
@XmlRootElement
@NamedQueries(
@NamedQuery(name = "Adresse.maxId", query = "SELECT max(idAdresse) FROM Adresse"),
@NamedQuery(name = "Adresse.findAll", query = "SELECT a FROM Adresse a"),
@NamedQuery(name = "Adresse.findByIdAdresse", query = "SELECT a FROM Adresse a WHERE a.idAdresse = :idAdresse"),
@NamedQuery(name = "Adresse.findByNumEtRue", query = "SELECT a FROM Adresse a WHERE a.numEtRue = :numEtRue"),
@NamedQuery(name = "Adresse.findByComple", query = "SELECT a FROM Adresse a WHERE a.comple = :comple"),
@NamedQuery(name = "Adresse.findByCodePostale", query = "SELECT a FROM Adresse a WHERE a.codePostale = :codePostale"),
@NamedQuery(name = "Adresse.findByVille", query = "SELECT a FROM Adresse a WHERE a.ville = :ville"),
@NamedQuery(name = "Adresse.findByPays", query = "SELECT a FROM Adresse a WHERE a.pays = :pays"),
@NamedQuery(name = "Adresse.findByDateModif", query = "SELECT a FROM Adresse a WHERE a.dateModif = :dateModif"))
public class Adresse implements Serializable
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@NotNull
@Column(name = "idAdresse")
private Long idAdresse;
@Size(max = 100)
@Column(name = "numEtRue")
private String numEtRue;
@Size(max = 100)
@Column(name = "comple")
private String comple;
@Size(max = 5)
@Column(name = "codePostale")
private String codePostale;
@Size(max = 35)
@Column(name = "ville")
private String ville;
@Size(max = 35)
@Column(name = "pays")
private String pays;
@Column(name = "dateModif")
@Temporal(TemporalType.DATE)
private Date dateModif;
@OneToMany(mappedBy = "adrU")
private Collection<Utilisateur> utilisateurCollection;
@OneToMany(mappedBy = "adrRecep")
private Collection<Livraison> livraisonCollection;
@OneToMany(mappedBy = "adrE")
private Collection<Entreprise> entrepriseCollection;
public Adresse()
public Adresse(Long idAdresse)
this.idAdresse = idAdresse;
public Long getIdAdresse()
return idAdresse;
public void setIdAdresse(Long idAdresse)
this.idAdresse = idAdresse;
public String getNumEtRue()
return numEtRue;
public void setNumEtRue(String numEtRue)
this.numEtRue = numEtRue;
public String getComple()
return comple;
public void setComple(String comple)
this.comple = comple;
public String getCodePostale()
return codePostale;
public void setCodePostale(String codePostale)
this.codePostale = codePostale;
public String getVille()
return ville;
public void setVille(String ville)
this.ville = ville;
public String getPays()
return pays;
public void setPays(String pays)
this.pays = pays;
public Date getDateModif()
return dateModif;
public void setDateModif(Date dateModif)
this.dateModif = dateModif;
@XmlTransient
public Collection<Utilisateur> getUtilisateurCollection()
return utilisateurCollection;
public void setUtilisateurCollection(Collection<Utilisateur> utilisateurCollection)
this.utilisateurCollection = utilisateurCollection;
@XmlTransient
public Collection<Livraison> getLivraisonCollection()
return livraisonCollection;
public void setLivraisonCollection(Collection<Livraison> livraisonCollection)
this.livraisonCollection = livraisonCollection;
@XmlTransient
public Collection<Entreprise> getEntrepriseCollection()
return entrepriseCollection;
public void setEntrepriseCollection(Collection<Entreprise> entrepriseCollection)
this.entrepriseCollection = entrepriseCollection;
@Override
public int hashCode()
int hash = 0;
hash += (idAdresse != null ? idAdresse.hashCode() : 0);
return hash;
@Override
public boolean equals(Object object)
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Adresse))
return false;
Adresse other = (Adresse) object;
if ((this.idAdresse == null && other.idAdresse != null) || (this.idAdresse != null && !this.idAdresse.equals(other.idAdresse)))
return false;
return true;
@Override
public String toString()
return "entities.Adresse[ idAdresse=" + idAdresse + " ]";
会话 bean
/* * 要更改此模板,请选择工具 |模板 * 并在编辑器中打开模板。 */ 打包会话;
import entities.Adresse;
import java.util.List;
import javax.ejb.Stateless;
import javax.ejb.LocalBean;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
/**
*
* @author John624
*/
@Stateless
@LocalBean
public class AdresseManager
@PersistenceContext(unitName = "ECOM-ejbPU")
private EntityManager em;
public List<Adresse> getAllAdresses()
Query query=em.createNamedQuery("Adresse.findAll");
return query.getResultList();
public Adresse update(Adresse adresse)
return em.merge(adresse);
public void persist(Object object)
em.persist(object);
public Long nextId()
Query query = em.createNamedQuery("Adresse.maxId");
long res;
res = query.getResultList().indexOf(0)+1;
return res;
JSF 托管豆
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package managedbeans;
import entities.Adresse;
import java.io.Serializable;
import java.util.List;
import javax.ejb.EJB;
import javax.enterprise.context.SessionScoped;
import javax.inject.Named;
import session.AdresseManager;
/**
*
* @author John624
*/
@Named(value="adresseMBean")
@SessionScoped
public class AdresseMBean implements Serializable
private List<Adresse> adresses;
private Adresse adresse;
@EJB
private AdresseManager adresseManager;
public AdresseMBean()
adresse=new Adresse();
adresseManager = new AdresseManager();
/**
* returns customer list for display in a datatable DataTable
* @return
*/
public List<Adresse> getAdresses()
if((adresses == null) || (adresses.isEmpty()))
adresses = adresseManager.getAllAdresses();
return adresseManager.getAllAdresses();
// public void refresh()
// tousLesComptes = compteBancaireFacade.findAll();
//
/**
* returns details of a customer. Useful for displaying in a form a customer's details
* @return
*/
public Adresse getDetails()
return adresse;
/**
* Action handler - Called when a line in the table is clicked
* @param adresse
* @return
*/
public String showDetails(Adresse adresse)
this.adresse = adresse;
return "AdresseDetails"; // will display CustomerDetails.xml JSF page
/**
* Action handler - update the customer model in the database.
* called when one press the update button in the form
* @return
*/
public String update()
System.out.println("###UPDATE###");
adresse = adresseManager.update(adresse);
return "AdresseList"; // will display the customer list in a table
/**
* Action handler - returns to the list of customers in the table
*/
public String list()
System.out.println("###LIST###");
return "AdresseList";
public void update(Adresse adrU)
System.out.println("###UPDATE###");
adresseManager.update(adrU);
提前致谢。
【问题讨论】:
【参考方案1】:如以下异常堆栈跟踪所示
Exception Description: Error encountered when building the @NamedQuery [Adresse.maxId] from entity class [class org.eclipse.persistence.internal.jpa.metadata.queries.NamedQueryMetadata].
问题就在这里:
@NamedQuery(name = "Adresse.maxId", query = "SELECT max(idAdresse) FROM Adresse"),
要解决此问题,请尝试以下方法:
@NamedQuery(name = "Adresse.maxId", query = "SELECT max(a.idAdresse) FROM Adresse a"),
【讨论】:
谢谢,我找到了问题。这是查询的问题。 SELECT max(a.idAdresse) FROM Adresse a") 我遇到了类似的问题。就我而言,它是 where 语句之前缺少的空格。【参考方案2】:试试这些步骤:
-
从 glassfish 服务器取消部署应用程序。
重新启动 glassfish 服务器。
重启 netbeans。
再次在 glassfish 服务器上部署您的应用程序。
【讨论】:
【参考方案3】:尝试删除 adresseManager = new AdresseManager();来自您的 AdresseMBean 类。
@EJB 已经注入并创建了对象。
然后尝试重新部署项目并在 getAdresses 方法中放置一个调试断点,以查看 adresseManager 对象是否不为空或执行不良 Sysout。
如果您想在托管 bean 启动时初始化服务,您需要在托管 bean 内的自定义公共方法上使用 @PostConstruct 注释并在那里编写初始化代码(例如,从 db 加载实体列表)。
希望对你有所帮助。
PS : 请原谅我的英语错误,我是法国人。
PS2 : 我之前没有看到它工作过,所以这可能是一个部署问题!
【讨论】:
以上是关于模块尚未部署[netbeans+glassfish]的主要内容,如果未能解决你的问题,请参考以下文章
如何使用 Netbeans IDE 在 glassfish 的特定端口上部署 Web 应用程序?
在 Windows 中的 Netbeans/Glassfish 哪里添加 jdbc 驱动程序?
如何使用 Netbeans 和 Glassfish 分析企业应用程序?
org.jboss.weld.exceptions.DefinitionException:在payara / glassfish中部署时的WELD-001113