java.lang.NullPointerException在org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:272)访问JAX-WS服务时 [英] java.lang.NullPointerException at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:272) while accessing JAX-WS services

查看:131
本文介绍了java.lang.NullPointerException在org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:272)访问JAX-WS服务时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 警告:Internal(内部函数)在内部执行JAX-WS服务时出现以下异常:服务器错误:/Test-war/Test.xhtml 
java.lang.NullPointerException
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:272)
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:201)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
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(DefaultFilterChai n.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
在org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org .glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)$ or
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.th readpool.AbstractThreadPool $ Worker.doWork(AbstractThreadPool.java:565)
at org.glassfish.grizzly.threadpool.AbstractThreadPool $ Worker.run(AbstractThreadPool.java:545)
at java.lang.Thread。运行(Thread.java:745)

异常消息似乎非常特定于GlassFish Server(I '使用4.1)。






测试场景:

CDI托管bean:

  @Named 
@ViewScoped
public class TestManagedBean implements Serializable
{
私人字符串测试;
private static final long serialVersionUID = 1L;
$ b $ public TestManagedBean(){}

@PostConstruct $ b $ private void init(){
TestBean_Service testBean_Service = new TestBean_Service();
TestBean testBean = testBean_Service.getTestBeanPort();
System.out.println(testBean sum =+ testBean.getSum(5,10));
}

public String getTest(){
return test;




$ b $ p $成员变量 test 只是没用。它仅用于测试目的。



在XHTML页面中,只需像这样访问 test 字段,

 < h:outputText value =#{testManagedBean.test}/> 

,这样bean标记的方法由 @PostConstruct

在浏览器地址栏中输入适当的URL时发生异常。





$ b $ testBean.getSum(int,int)是一个远程EJB方法,当bean被更改为单身EJB只是出于类似测试的原因,

  import client.web.services.TestBean; 
导入client.web.services.TestBean_Service;
import javax.annotation.PostConstruct;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;

@Startup
@Singleton
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public class TestManagedBean
{
public TestManagedBean(){}

@PostConstruct
private void init(){
TestBean_Service testBean_Service = new TestBean_Service();
TestBean testBean = testBean_Service.getTestBeanPort();
System.out.println(testBean sum =+ testBean.getSum(5,10));




$ b $ p
$ b

在这种情况下,代理方法 getSum(int,int)在关联的远程EJB中实际可用,并且它将返回通过它提供的两个参数的总和。



当GlassFish通过XHTML页面访问服务时,GlassFish会如何看待 java.lang.NullPointerException
<这是GlassFish 4.1中一个影响服务器中 grizzly-kernel 组件的错误 - GlassFish Grizzly Embedded服务器提供HTTP请求。这需要按照建议 nucleus-grizzly-all.jar
jar文件/GLASSFISH-21118?focusedCommentId=381897&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-381897\">此处 $ {glassfishHome} / glassfish下/ modules (不要忘记在#{glassfishHome} / glassfish / domains / yourDomain 下清除 osgi-cache 在启动/重新启动服务器之前,code>)。

在本文之前,我访问了该链接,但其状态根据GlassFish Server 4.1进行了解析我认为有些不同。



请注意:有人在几小时前已经发布了相同的答案,但答案已被可信用户删除,只考虑链接答案。尽管这是一个仅链接的答案,但在这种情况下,除了替换服务器中的新jar以外,没有办法解决该问题,甚至在2014年11月19日提出此问题后提供jar 。我希望这个答案不会被删除。


I'm getting the following exception while implementing JAX-WS services in a Java EE 7 application.

Warning:   Internal Server error: /Test-war/Test.xhtml
java.lang.NullPointerException
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:272)
    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:201)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
    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:284)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
    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:565)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
    at java.lang.Thread.run(Thread.java:745)

The exception message appears to be very specific to GlassFish Server (I'm using 4.1).


The test scenario:

A CDI managed bean:

@Named
@ViewScoped    
public class TestManagedBean implements Serializable
{
    private String test;
    private static final long serialVersionUID=1L;

    public TestManagedBean() {}

    @PostConstruct
    private void init() {
        TestBean_Service testBean_Service=new TestBean_Service();
        TestBean testBean = testBean_Service.getTestBeanPort();
        System.out.println("testBean sum = "+testBean.getSum(5, 10));
    }

    public String getTest() {
        return test;
    }
}

The member variable test is just useless. It is taken only for the purpose of testing.

In an XHTML page, just access this test field like so,

<h:outputText value="#{testManagedBean.test}"/>

so that the bean's method marked by @PostConstruct can be invoked.

The exception occurs, when entering an appropriate URL in the browser's address bar.


The testBean.getSum(int, int) is a remote EJB method which is successfully invoked, when the bean is changed to a singleton EJB just for reasons of testing like so,

import client.web.services.TestBean;
import client.web.services.TestBean_Service;
import javax.annotation.PostConstruct;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;

@Startup
@Singleton
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public class TestManagedBean
{
    public TestManagedBean() {}

    @PostConstruct
    private void init() {
        TestBean_Service testBean_Service=new TestBean_Service();
        TestBean testBean = testBean_Service.getTestBeanPort();
        System.out.println("testBean sum = "+testBean.getSum(5, 10));
    }
}

In this case, the the proxy method getSum(int, int) which is actually available in the associated remote EJB is successfully invoked and it returns the sum of the two parameters supplied through it.

What makes GlassFish think about the java.lang.NullPointerException, when the service is accessed via an XHTML page?

解决方案

This is a bug in GlassFish 4.1 affecting the grizzly-kernel component in the server - the GlassFish Grizzly Embedded Server serving HTTP requests. This requires replacing the nucleus-grizzly-all.jar jar file in GlassFish server (4.1) as suggested here under ${glassfishHome}/glassfish/modules (do not forget to clear osgi-cache under #{glassfishHome}/glassfish/domains/yourDomain before starting/restarting the server).

I visited that link prior to this post but its status was "resolved" according to GlassFish Server 4.1 that made me think something different.

Please note : Someone already posted the same answer a few hours ago but the answer was deleted perhaps by trusted users considering a link-only answer. Despite the fact that it is a link-only answer but in this case, there is no way to get around the issue other than replacing the new jar in the server and even the jar was provided after this question was asked on November 19, 2014. I hope this answer will not be deleted.

这篇关于java.lang.NullPointerException在org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:272)访问JAX-WS服务时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆