我对一个Glassfish-Server有点奇怪的问题,不知道在哪里,在哪里寻找。
在Ubuntu Ubuntu 14.04.4上LTS,Glassfish 4.1,OpenJDK 1.7(或Oracle JDK 1.8)我在访问mysql数据库时遇到以下异常:
[2016-03-18T20:44:16.693+0100] [glassfish 4.1] [INFO] [NCLS-JMX-00024] [javax.enterprise.system.jmx] [tid: _ThreadID=71 _ThreadName=Thread-23] [timeMillis: 1458330256693] [levelValue: 800] [[
Creating a SecureRMIServerSocketFactory @ 0.0.0.0 with ssl config = GlassFishConfigBean.org.glassfish.grizzly.config.dom.Ssl]]
[2016-03-18T20:44:16.720+0100] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=71 _ThreadName=Thread-8] [timeMillis: 1458330256720] [levelValue: 800] [[
SSLParams =org.glassfish.admin.mbeanserver.ssl.SSLParams@4e5ce39d]]
[2016-03-18T20:44:16.720+0100] [glassfish 4.1] [WARNING] [NCLS-JMX-00020] [javax.enterprise.system.jmx] [tid: _ThreadID=71 _ThreadName=Thread-23] [timeMillis: 1458330256720] [levelValue: 900] [[
All SSL cipher suites disabled for network-listener(s). Using SSL implementation specific defaults]]
[2016-03-18T20:44:16.744+0100] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=71 _ThreadName=Thread-8] [timeMillis: 1458330256744] [levelValue: 800] [[
SSLParams =org.glassfish.admin.mbeanserver.ssl.SSLParams@4e5ce39d]]
[2016-03-18T20:44:16.744+0100] [glassfish 4.1] [WARNING] [NCLS-JMX-00020] [javax.enterprise.system.jmx] [tid: _ThreadID=71 _ThreadName=Thread-23] [timeMillis: 1458330256744] [levelValue: 900] [[
All SSL cipher suites disabled for network-listener(s). Using SSL implementation specific defaults]]
[2016-03-18T20:44:16.810+0100] [glassfish 4.1] [INFO] [NCLS-JMX-00025] [javax.enterprise.system.jmx] [tid: _ThreadID=71 _ThreadName=Thread-23] [timeMillis: 1458330256810] [levelValue: 800] [[
SSLServerSocket /0.0.0.0:8686 and [SSL: ServerSocket[addr=/0.0.0.0,localport=8686]] created]]
[2016-03-18T20:44:17.024+0100] [glassfish 4.1] [INFO] [NCLS-BOOTSTRAP-00027] [javax.enterprise.bootstrap] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1458330257024] [levelValue: 800] [[
Registered com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishImpl@46fa75c6 as OSGi service registration: org.apache.felix.framework.ServiceRegistrationImpl@25eb5807.]]
[2016-03-18T20:44:17.203+0100] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=74 _ThreadName=Thread-25] [timeMillis: 1458330257203] [levelValue: 800] [[
visiting unvisited references]]
[2016-03-18T20:44:18.369+0100] [glassfish 4.1] [INFO] [NCLS-JMX-00005] [javax.enterprise.system.jmx] [tid: _ThreadID=71 _ThreadName=Thread-23] [timeMillis: 1458330258369] [levelValue: 800] [[
JMXStartupService has started JMXConnector on JMXService URL service:jmx:rmi://ownNas:8686/jndi/rmi://ownNas:8686/jmxrmi]]
[2016-03-18T20:44:19.166+0100] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=74 _ThreadName=Thread-25] [timeMillis: 1458330259166] [levelValue: 800] [[
visiting unvisited references]]
[2016-03-18T20:44:19.177+0100] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=74 _ThreadName=Thread-25] [timeMillis: 1458330259177] [levelValue: 800] [[
visiting unvisited references]]
[2016-03-18T20:44:19.180+0100] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=74 _ThreadName=Thread-25] [timeMillis: 1458330259180] [levelValue: 800] [[
visiting unvisited references]]
[2016-03-18T20:44:21.610+0100] [glassfish 4.1] [INFO] [jsf.config.listener.version] [javax.enterprise.resource.webcontainer.jsf.config] [tid: _ThreadID=74 _ThreadName=Thread-25] [timeMillis: 1458330261610] [levelValue: 800] [[
Initializing Mojarra 2.2.12 ( 20150720-0848 https://svn.java.net/svn/mojarra~svn/tags/2.2.12@14885) for context '']]
[2016-03-18T20:44:22.885+0100] [glassfish 4.1] [INFO] [AS-WEB-GLUE-00172] [javax.enterprise.web] [tid: _ThreadID=74 _ThreadName=Thread-25] [timeMillis: 1458330262885] [levelValue: 800] [[
Loading application [__admingui] at [/]]]
[2016-03-18T20:44:22.887+0100] [glassfish 4.1] [INFO] [NCLS-CORE-00022] [javax.enterprise.system.core] [tid: _ThreadID=74 _ThreadName=Thread-25] [timeMillis: 1458330262887] [levelValue: 800] [[
Loading application __admingui done in 5,865 ms]]
[2016-03-18T20:44:39.877+0100] [glassfish 4.1] [WARNING] [] [org.eclipse.persistence.default] [tid: _ThreadID=26 _ThreadName=http-listener-1(4)] [timeMillis: 1458330279877] [levelValue: 900] [[
2016-03-18 20:44:39 http-listener-1(4) INFO com.np.propmgmt.controller.HouseController: ejbFacade com.np.propmgmt.facade.HouseFacade@29b9cef7
2016-03-18 20:44:39 http-listener-1(4) INFO com.np.propmgmt.facade.HouseFacade: em-manager com.sun.enterprise.container.common.impl.EntityManagerWrapper@2969d5d3
java.lang.NullPointerException
at org.eclipse.persistence.platform.server.ServerPlatformUtils.createServerPlatform(ServerPlatformUtils.java:99)
at org.eclipse.persistence.sessions.factories.SessionManager.init(SessionManager.java:77)
at org.eclipse.persistence.sessions.factories.SessionManager.<clinit>(SessionManager.java:71)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.addSessionToGlobalSessionManager(EntityManagerSetupImpl.java:907)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.initSession(EntityManagerSetupImpl.java:2671)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:675)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getAbstractSession(EntityManagerFactoryDelegate.java:205)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:305)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:337)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:318)
at com.sun.enterprise.container.common.impl.EntityManagerWrapper._getDelegate(EntityManagerWrapper.java:197)
at com.sun.enterprise.container.common.impl.EntityManagerWrapper.createNamedQuery(EntityManagerWrapper.java:521)
at com.np.propmgmt.facade.HouseFacade.findAll(HouseFacade.java:72)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1081)
at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1153)
at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:4786)
at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:656)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822)
at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:608)
at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:64)
at org.jboss.weld.ejb.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:883)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822)
at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:608)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doCall(SystemInterceptorProxy.java:163)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:140)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:883)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822)
at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:369)
at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:4758)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:4746)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:212)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88)
at com.sun.proxy.$Proxy182.findAll(Unknown Source)
at com.np.propmgmt.facade.__EJB31_Generated__HouseFacade__Intf____Bean__.findAll(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.jboss.weld.util.reflection.Reflections.invokeAndUnwrap(Reflections.java:434)
at org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.invoke(EnterpriseBeanProxyMethodHandler.java:127)
at org.jboss.weld.bean.proxy.EnterpriseTargetBeanInstance.invoke(EnterpriseTargetBeanInstance.java:56)
at org.jboss.weld.bean.proxy.InjectionPointPropagatingEnterpriseTargetBeanInstance.invoke(InjectionPointPropagatingEnterpriseTargetBeanInstance.java:67)
at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:100)
at com.np.propmgmt.facade.HouseFacade$Proxy$_$$_Weld$EnterpriseProxy$.findAll(Unknown Source)
at com.np.propmgmt.controller.HouseController.getItems(HouseController.java:104)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at javax.el.BeanELResolver.getValue(BeanELResolver.java:363)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
at com.sun.el.parser.AstValue.getValue(AstValue.java:140)
at com.sun.el.parser.AstValue.getValue(AstValue.java:204)
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:226)
at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182)
at javax.faces.component.UISelectItems.getValue(UISelectItems.java:129)
at org.primefaces.renderkit.InputRenderer.getSelectItems(InputRenderer.java:54)
at org.primefaces.component.selectonemenu.SelectOneMenuRenderer.encodeMarkup(SelectOneMenuRenderer.java:73)
at org.primefaces.component.selectonemenu.SelectOneMenuRenderer.encodeEnd(SelectOneMenuRenderer.java:67)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:920)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:176)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:890)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:458)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:134)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:659)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:416)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:283)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
at java.lang.Thread.run(Thread.java:745)
]]
[2016-03-18T20:44:39.918+0100] [glassfish 4.1] [INFO] [] [org.eclipse.persistence.session./file:/usr/share/glassfish4/glassfish/domains/domain1/applications/PropertyMgmt-2.0/WEB-INF/classes/_com.np.propmgmt] [tid: _ThreadID=26 _ThreadName=http-listener-1(4)] [timeMillis: 1458330279918] [levelValue: 800] [[
EclipseLink, version: Eclipse Persistence Services - 2.6.1.v20150605-31e8258]]
在Windows 10(或Debian 7.8)上,Glassfish 4.1(版本13),JDK 1.7(或1.8)一切正常。我有点无助,我可以寻找。
HouseController:
package com.np.propmgmt.controller;
import com.np.propmgmt.entity.tables.DocumentTreeNode;
import com.np.propmgmt.entity.tables.EntryCode;
import com.np.propmgmt.entity.tables.EntryCodeAmounts;
import com.np.propmgmt.facade.HouseFacade;
import com.np.propmgmt.entity.tables.House;
import com.np.propmgmt.util.JsfUtil;
import com.np.propmgmt.util.NavigationBean;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.ResourceBundle;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.enterprise.context.SessionScoped;
import javax.faces.event.ValueChangeEvent;
import javax.inject.Named;
import org.apache.log4j.Logger;
import org.primefaces.event.NodeSelectEvent;
import org.primefaces.model.DefaultTreeNode;
import org.primefaces.model.TreeNode;
@Named("houseController")
@SessionScoped
public class HouseController extends AbstractController<House> implements Serializable {
private final Logger logger = Logger.getLogger(this.getClass().getName());
@Inject
private HouseFacade ejbFacade;
@Inject
private NavigationBean navBean;
private int houseId = 0;
private TreeNode entryCodeRoot;
private int entryCodeId;
private BigDecimal ecAmountFix;
private BigDecimal ecAmountVar;
private Date ecValidFrom;
private Date ecValidThru;
public HouseController() {
super(House.class);
}
@PostConstruct
public void init() {
super.setFacade(ejbFacade);
}
@Override
public void setSelected(House selected) {
if (selected == null)
return;
super.setSelected( selected );
if (this.houseId != selected.getHouseId())
this.entryCodeId = 0;
this.houseId = selected.getHouseId();
}
public void houseChanged(ValueChangeEvent event) {
if (event.getNewValue() != getSelected()) {
setSelected(null);
}
}
public List<House> getItems() {
logger.info("ejbFacade " + ejbFacade);
return ejbFacade.findAll();
}
}
HouseFacade:
package com.np.propmgmt.facade;
import com.np.propmgmt.entity.tables.EntryCode;
import com.np.propmgmt.entity.tables.EntryCodeAmounts;
import com.np.propmgmt.entity.tables.House;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.apache.log4j.Logger;
@Stateless
public class HouseFacade extends AbstractFacade<House> {
private final Logger logger = Logger.getLogger(this.getClass().getName());
@PersistenceContext(unitName = "com.np.propmgmt")
private EntityManager em;
@Override
protected EntityManager getEntityManager() {
return em;
}
public HouseFacade() {
super(House.class);
}
public House findHouse (int p_house)
{
javax.persistence.Query q = getEntityManager().
createNamedQuery("House.findByHouseId")
.setParameter("houseId", p_house);
return (House) q.getSingleResult();
}
public List<EntryCode> findHouseEntryCodes (
int houseId) {
javax.persistence.Query q = getEntityManager().
createNamedQuery("EntryCode.findByHouse").setParameter("houseId", houseId);
return q.getResultList();
}
public List<House> findAll() {
logger.info("em-manager " + getEntityManager());
javax.persistence.Query q = getEntityManager().
createNamedQuery("House.findAll");
return q.getResultList();
}
public List<EntryCodeAmounts> findHouseEcAmounts (
int entryCodeId) {
javax.persistence.Query q = getEntityManager().
createNamedQuery("EntryCodeAmounts.findByEntryCodeId").setParameter("entryCodeId", entryCodeId);
return q.getResultList();
}
public void newEcAmounts (
int entryCodeId,
BigDecimal amountFix,
BigDecimal amountVar,
Date validFrom,
Date validThru) {
javax.persistence.Query q = getEntityManager().
createNamedQuery("EntryCodeAmounts.terminateLast").
setParameter("entryCodeId", entryCodeId).
setParameter("validThru", validFrom);
q.executeUpdate();
EntryCodeAmounts ecAmounts = new EntryCodeAmounts();
ecAmounts.setEntryCodeId(entryCodeId);
ecAmounts.setAmountVar(amountVar);
ecAmounts.setAmountFix(amountFix);
ecAmounts.setValidFrom(validFrom);
ecAmounts.setValidThru(validThru);
getEntityManager().persist(ecAmounts);
}
}
对其他表/实体类的所有其他访问都正常工作。
答案 0 :(得分:0)
我相信你被击中https://java.net/jira/browse/GLASSFISH-21468这只是一个可以忽略的警告。在部署持久性单元时会发生此NPE,这仅在第一次访问时发生。并通过服务器平台检测方法捕获并记录,然后正常进行部署。