<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    POJO Endpoint causes NPE at JBossWebMetaDataParser.parse
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/abhi0123">abhi0123</a> in <i>JBoss Web Services</i> - <a href="https://community.jboss.org/message/730079#730079">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>POJO Endpoint deployed with web.xml and jboss-web.xml. When enabled, or attempted to, JBOSS AS 7 fails with NPE. Source code and deployable attached.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code">
15:16:25,985 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-14) MSC00001: Failed to start service jboss.deployment.unit."jaxws-pojo-endpoint-1.0.war".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.unit."jaxws-pojo-endpoint-1.0.war".PARSE: Failed to process phase PARSE of deployment "jaxws-pojo-endpoint-1.0.war"
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [classes.jar:1.6.0_31]
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [classes.jar:1.6.0_31]
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_31]
Caused by: java.lang.NullPointerException
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;at org.jboss.metadata.parser.jbossweb.JBossWebMetaDataParser.parse(JBossWebMetaDataParser.java:100)
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;at org.jboss.as.web.deployment.JBossWebParsingDeploymentProcessor.deploy(JBossWebParsingDeploymentProcessor.java:69)
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;... 5 more
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>TimeServiceSEI.java</strong></p><pre class="jive-pre"><code class="jive-code">
@WebService
public interface TimeServiceSEI {

&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;public Time getCurrentTime();

&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;public Time getCurrentTimeAfterHttpBasicAuthentication();

&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;public Time getCurrentTimeAfterDeclarativeRoleBasedAuthorization();

&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;public Time getCurrentTimeAfterProgrammaticRoleBasedAuthorization();

&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;public Time getCurrentTimeAfterUserPrincipalAuthentication();

&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;public Time getCurrentTimeAfterProgrammaticAuthentication();
}
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>TimeService.java</strong></p><pre class="jive-pre"><code class="jive-code">
@WebService(name = "Time", serviceName = "TimeService", portName = "TimeServicePort", targetNamespace = "http://abhijitsarkar.certification.edu/ocewsd/jaxws/pojo/endpoint", endpointInterface = "edu.certification.abhijitsarkar.ocewsd.jaxws.pojo.endpoint.TimeServiceSEI")
@HandlerChain(file = "handler-chain.xml")
@DeclareRoles({ "AppUser" })
public class TimeService implements TimeServiceSEI {

&#160; @WebMethod
&#160; @PermitAll
&#160; @Override
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;public Time getCurrentTime() {
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return new Time();
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;}

&#160; /* HttpBasicAuthenticationHandler authenticates this request */
&#160; @WebMethod
&#160; @Override
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;public Time getCurrentTimeAfterHttpBasicAuthentication() {
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return getCurrentTime();
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;}

&#160; @WebMethod
&#160; @RolesAllowed("AppUser")
&#160; @Override
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;public Time getCurrentTimeAfterDeclarativeRoleBasedAuthorization() {
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return getCurrentTime();
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;}
// some more methods
}
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>web.xml</strong></p><pre class="jive-pre"><code class="jive-code jive-xml">
<span class="jive-xml-tag"><span>&lt;web-app xmlns="</span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/javaee" target="_blank">http://java.sun.com/xml/ns/javaee</a><span>" xmlns:xsi="</span><a class="jive-link-external-small" href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a><span>"
&#160; xsi:schemaLocation="</span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/javaee" target="_blank">http://java.sun.com/xml/ns/javaee</a><span> </span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" target="_blank">http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd</a><span>"
&#160; version="3.0"&gt;</span></span>
&#160; <span class="jive-xml-tag">&lt;security-constraint&gt;</span>
&#160; <span class="jive-xml-tag">&lt;web-resource-collection&gt;</span>
&#160; <span class="jive-xml-tag">&lt;web-resource-name&gt;</span>All resources<span class="jive-xml-tag">&lt;/web-resource-name&gt;</span>
&#160; <span class="jive-xml-tag">&lt;url-pattern&gt;</span>/*<span class="jive-xml-tag">&lt;/url-pattern&gt;</span>
&#160; <span class="jive-xml-tag">&lt;http-method&gt;</span>POST<span class="jive-xml-tag">&lt;/http-method&gt;</span>&#160; <span class="jive-xml-comment">&lt;!-- GET is used to receive TimeService?wsdl --&gt;</span>
&#160; <span class="jive-xml-tag">&lt;/web-resource-collection&gt;</span>
&#160; <span class="jive-xml-tag">&lt;/security-constraint&gt;</span>

&#160; <span class="jive-xml-tag">&lt;login-config&gt;</span>
&#160; <span class="jive-xml-tag">&lt;auth-method&gt;</span>BASIC<span class="jive-xml-tag">&lt;/auth-method&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span class="jive-xml-tag">&lt;realm-name&gt;</span>Pojo Auth Test Realm<span class="jive-xml-tag">&lt;/realm-name&gt;</span>
&#160; <span class="jive-xml-tag">&lt;/login-config&gt;</span>
<span class="jive-xml-tag">&lt;/web-app&gt;</span>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>jboss-web.xml</strong></p><pre class="jive-pre"><code class="jive-code jive-xml">
<span class="jive-xml-tag"><span>&lt;jboss-web xmlns="</span><a class="jive-link-external-small" href="http://www.jboss.com/xml/ns/javaee" target="_blank">http://www.jboss.com/xml/ns/javaee</a><span>"
&#160; xmlns:xsi="</span><a class="jive-link-external-small" href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a><span>"
&#160; xsi:schemaLocation="</span><a class="jive-link-external-small" href="http://www.jboss.com/xml/ns/javaee" target="_blank">http://www.jboss.com/xml/ns/javaee</a><span> </span><a class="jive-link-external-small" href="http://www.jboss.org/j2ee/schema/jboss-web_7_0.xsd" target="_blank">http://www.jboss.org/j2ee/schema/jboss-web_7_0.xsd</a><span>"
&#160; version="7.0"&gt;</span></span>
&#160; <span class="jive-xml-tag">&lt;security-domain&gt;</span>other<span class="jive-xml-tag">&lt;/security-domain&gt;</span>
&#160; <span class="jive-xml-tag">&lt;context-root&gt;</span>/jaxws-pojo-endpoint<span class="jive-xml-tag">&lt;/context-root&gt;</span>
<span class="jive-xml-tag">&lt;/jboss&gt;</span>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/730079#730079">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Web Services at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>