2 Replies Latest reply on May 5, 2006 12:13 PM by Mark Lassiter

    NPE while deploying SLSB as Web Service on JBoss 4.0.3SP1

    Björn Eilers Newbie

      Hi,

      I tried to deploy a small phonebook example which uses an entity bean phonebook.EntryBean for the entries and a stateless session bean phonebook.PhonebookBean with remote interfaces to manage these entries. I am using DTOs implementing java.io.Serializable with zero-arg constructors to transfer the data between client and session bean. Now I tried to expose the session bean also as a web service. Therefore, I created the following service endpoint interface which signatures is similar to the method signatures in the session bean:

      package phonebook;
      
      import java.rmi.Remote;
      import java.rmi.RemoteException;
      
      public interface PhonebookSEI extends Remote {
      
       public EntryDTO findEntry(String firstname, String lastname) throws RemoteException;
       public void createNewEntry(EntryDTO entry) throws RemoteException;
       public EntryDTO[] getEntries() throws RemoteException;
      
      }


      Then, I wrote a config.xml for the wscompile tool loooking like this:

      <?xml version="1.0" encoding="UTF-8"?>
      <configuration xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
       <service name="PhonebookService"
       targetNamespace="http://phonebook"
       typeNamespace="http://phonebook/types"
       packageName="phonebook">
       <interface name="phonebook.PhonebookSEI"
       servantName="phonebook.PhonebookBean" />
       </service>
      </configuration>


      and used wscompile to create the following WSDL file

      <?xml version="1.0" encoding="UTF-8"?>
      
      <definitions name="PhonebookService" targetNamespace="http://phonebook" xmlns:tns="http://phonebook" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:ns2="http://phonebook/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
       <types>
       <schema targetNamespace="http://phonebook/types" xmlns:tns="http://phonebook/types" xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://www.w3.org/2001/XMLSchema">
       <complexType name="createNewEntry">
       <sequence>
       <element name="EntryDTO_1" type="tns:EntryDTO" nillable="true"/></sequence></complexType>
       <complexType name="EntryDTO">
       <sequence>
       <element name="dateOfBirth" type="dateTime" nillable="true"/>
       <element name="firstname" type="string" nillable="true"/>
       <element name="lastname" type="string" nillable="true"/>
       <element name="telephoneNumber" type="string" nillable="true"/></sequence></complexType>
       <complexType name="createNewEntryResponse">
       <sequence/></complexType>
       <complexType name="findEntry">
       <sequence>
       <element name="String_1" type="string" nillable="true"/>
       <element name="String_2" type="string" nillable="true"/></sequence></complexType>
       <complexType name="findEntryResponse">
       <sequence>
       <element name="result" type="tns:EntryDTO" nillable="true"/></sequence></complexType>
       <complexType name="getEntries">
       <sequence/></complexType>
       <complexType name="getEntriesResponse">
       <sequence>
       <element name="result" type="tns:EntryDTO" nillable="true" minOccurs="0" maxOccurs="unbounded"/></sequence></complexType>
       <element name="createNewEntry" type="tns:createNewEntry"/>
       <element name="createNewEntryResponse" type="tns:createNewEntryResponse"/>
       <element name="findEntry" type="tns:findEntry"/>
       <element name="findEntryResponse" type="tns:findEntryResponse"/>
       <element name="getEntries" type="tns:getEntries"/>
       <element name="getEntriesResponse" type="tns:getEntriesResponse"/></schema></types>
       <message name="PhonebookSEI_createNewEntry">
       <part name="parameters" element="ns2:createNewEntry"/></message>
       <message name="PhonebookSEI_createNewEntryResponse">
       <part name="result" element="ns2:createNewEntryResponse"/></message>
       <message name="PhonebookSEI_findEntry">
       <part name="parameters" element="ns2:findEntry"/></message>
       <message name="PhonebookSEI_findEntryResponse">
       <part name="result" element="ns2:findEntryResponse"/></message>
       <message name="PhonebookSEI_getEntries">
       <part name="parameters" element="ns2:getEntries"/></message>
       <message name="PhonebookSEI_getEntriesResponse">
       <part name="result" element="ns2:getEntriesResponse"/></message>
       <portType name="PhonebookSEI">
       <operation name="createNewEntry">
       <input message="tns:PhonebookSEI_createNewEntry"/>
       <output message="tns:PhonebookSEI_createNewEntryResponse"/></operation>
       <operation name="findEntry">
       <input message="tns:PhonebookSEI_findEntry"/>
       <output message="tns:PhonebookSEI_findEntryResponse"/></operation>
       <operation name="getEntries">
       <input message="tns:PhonebookSEI_getEntries"/>
       <output message="tns:PhonebookSEI_getEntriesResponse"/></operation></portType>
       <binding name="PhonebookSEIBinding" type="tns:PhonebookSEI">
       <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
       <operation name="createNewEntry">
       <soap:operation soapAction=""/>
       <input>
       <soap:body use="literal"/></input>
       <output>
       <soap:body use="literal"/></output></operation>
       <operation name="findEntry">
       <soap:operation soapAction=""/>
       <input>
       <soap:body use="literal"/></input>
       <output>
       <soap:body use="literal"/></output></operation>
       <operation name="getEntries">
       <soap:operation soapAction=""/>
       <input>
       <soap:body use="literal"/></input>
       <output>
       <soap:body use="literal"/></output></operation></binding>
       <service name="PhonebookService">
       <port name="PhonebookSEIPort" binding="tns:PhonebookSEIBinding">
       <soap:address location="REPLACE_WITH_ACTUAL_URL"/></port></service></definitions>
      


      In ejb-jar.xml, I added the service endpoint like this:

      <session>
       <ejb-name>Phonebook</ejb-name>
       <service-endpoint>phonebook.PhonebookSEI</service-endpoint>
       <home>phonebook.PhonebookHome</home>
       ...
       </session>
      


      and write the webservices.xml like that:

      <webservices xmlns="http://java.sun.com/xml/ns/j2ee"
       xmlns:impl="http://phonebook/ws4ee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema.instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd"
       version="1.1">
       <webservice-description>
       <webservice-description-name>PhonebookService</webservice-description-name>
       <wsdl-file>META-INF/wsdl/PhonebookService.wsdl</wsdl-file>
       <jaxrpc-mapping-file>META-INF/PhonebookService_mapping.xml</jaxrpc-mapping-file>
       <port-component>
       <port-component-name>PhonebookSEI</port-component-name>
       <wsdl-port>PhonebookSEIPort</wsdl-port>
       <service-endpoint-interface>phonebook.PhonebookSEI</service-endpoint-interface>
       <service-impl-bean>
       <ejb-link>ejb/PhonebookBean</ejb-link>
       </service-impl-bean>
       </port-component>
       </webservice-description>
      </webservices>


      When I now jar the beans and deploy them on JBoss 4.0.3 SP 1, I get the following exception:

      2006-03-17 14:08:24,444 ERROR [org.jboss.webservice.ServiceDeployer] Cannot startup webservice for: gruppe00.jar
      java.lang.NullPointerException
       at org.jboss.webservice.ServiceDeployerEJB.createWebXML(ServiceDeployerEJB.java:243)
       at org.jboss.webservice.ServiceDeployerEJB.deployWebservices(ServiceDeployerEJB.java:131)
       at org.jboss.webservice.ServiceDeployer.startWebservice(ServiceDeployer.java:191)
       at org.jboss.webservice.ServiceDeployer.handleNotification(ServiceDeployer.java:121)
       at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.notification.NotificationListenerProxy.invoke(NotificationListenerProxy.java:153)
       at $Proxy32.handleNotification(Unknown Source)
       at org.jboss.mx.util.JBossNotificationBroadcasterSupport.handleNotification(JBossNotificationBroadcasterSupport.java:127)
       at org.jboss.mx.util.JBossNotificationBroadcasterSupport.sendNotification(JBossNotificationBroadcasterSupport.java:110)
       at org.jboss.deployment.SubDeployerSupport.emitNotification(SubDeployerSupport.java:340)
       at org.jboss.deployment.SubDeployerSupport.start(SubDeployerSupport.java:308)
       at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:661)
       at sun.reflect.GeneratedMethodAccessor168.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
       at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:260)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:190)
       at $Proxy30.start(Unknown Source)
       at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1007)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:808)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:771)
       at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:260)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:190)
       at $Proxy6.deploy(Unknown Source)
       at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:334)
       at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:504)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:207)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:218)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:197)
      


      I have double-checked everything to my best knowledge, however, I don't find the error. Is this a bug, or have I missed something?