[
http://jira.jboss.com/jira/browse/EJBTHREE-933?page=comments#action_12391035 ]
Andr← Pastore commented on EJBTHREE-933:
----------------------------------------
Hi!
I'm having this NullPointerException when I deploy my application at first time, in a
same instance of AS.
With the following technologies:
JBoss AS 4.0.5GA
EJB 3.0
I'm deploying a EAR with the follow structure:
application.ear
lib/<my-application-lib>*
META-INF/application.xml
META-INF/jboss-app.xml
service-ejb.jar
service-ejb.jar/META-INF/jboss.xml
service-ejb.jar/META-INF/ejb-jar.xml
service-ejb.jar/<ejb-classes>
service-web.war
The EJB name declaration, registration of Local and remote interfaces are configured by
Annotations. as follow:
/* MyServiceEjb.class */
@Stateless(name = "myEjbName")
@Remote(MyRemoteInterface.class)
@Local(MyLocalInterface.class)
public class MyServiceEjb implements MyRemoteInterface, MyLocalInterface {
/**--ejb class implementation--*/
}
/*MyRemoteInterface.class*/
@Remote
public class MyRemoteInterface {
/**--ejb remote interface--*/
}
/*MyLocalInterface.class*/
@Local
public class MyLocalInterface {
/**--ejb local interface--*/
}
/*jboss.xml*/
<jboss
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://www.jboss.org/j2ee/schema/jboss_5_0.xsd"
version="3.0">
<enterprise-beans>
<session>
<ejb-name>myEjbName</ejb-name>
<jndi-name>
myEjbName/remote
</jndi-name>
<local-jndi-name>
myEjbName/local
</local-jndi-name>
</session>
<enterprise-beans>
</jboss>
Then, when I deploy my application.ear, at the first time, the follow LOG (trace) was
generated:
# ... ######################################################
08:48:07,125 DEBUG [Ejb3DescriptorHandler] adding class annotation
org.jboss.annotation.ejb.LocalBinding to com.example.MyServiceEjb
org.jboss.annotation.ejb.LocalBindingImpl@18bff68
08:48:07,125 DEBUG [Ejb3DescriptorHandler] adding class annotation
org.jboss.annotation.ejb.LocalBinding to com.example.MyServiceEjb
org.jboss.annotation.ejb.LocalBindingImpl@18bff68
08:48:07,125 DEBUG [Ejb3DescriptorHandler] adding class annotation
org.jboss.annotation.ejb.RemoteBinding to com.example.MyServiceEjb [RemoteBindingImpl:,
jndi=myEjbName/remote, stack=, bindUrl=, proxyFactory=interface
org.jboss.ejb3.remoting.RemoteProxyFactory]
08:48:07,125 DEBUG [Ejb3DescriptorHandler] adding class annotation
org.jboss.annotation.ejb.RemoteBinding to com.example.MyServiceEjb [RemoteBindingImpl:,
jndi=myEjbName/remote, stack=, bindUrl=, proxyFactory=interface
org.jboss.ejb3.remoting.RemoteProxyFactory]
08:48:07,140 DEBUG [Ejb3DescriptorHandler] adding class annotation
org.jboss.annotation.ejb.RemoteBinding to com.example.MyServiceEjb [RemoteBindingImpl:,
jndi=myEjbName/remote, stack=, bindUrl=, proxyFactory=interface
org.jboss.ejb3.remoting.RemoteProxyFactory]
08:48:07,140 DEBUG [Ejb3DescriptorHandler] adding class annotation
org.jboss.annotation.ejb.RemoteBinding to com.example.MyServiceEjb [RemoteBindingImpl:,
jndi=myEjbName/remote, stack=, bindUrl=, proxyFactory=interface
org.jboss.ejb3.remoting.RemoteProxyFactory]
08:48:07,140 DEBUG [Ejb3AnnotationHandler] found EJB3: ejbName=myEjbName,
class=com.example.MyServiceEjb, type=STATELESS
# ... ######################################################
08:48:08,359 DEBUG [EJB3Deployer] start application, deploymentInfo:
org.jboss.deployment.DeploymentInfo@1fd590ec {
url=file:/E:/_applications/jboss/jboss-4.0.5.GA_clusterOff/server/default/tmp/deploy/tmp54338application.ear-contents/service-ejb.jar
}
deployer: MBeanProxyExt[jboss.ejb3:service=EJB3Deployer]
status: Starting
state: START_DEPLOYER
watch:
file:/E:/_applications/jboss/jboss-4.0.5.GA_clusterOff/server/default/tmp/deploy/tmp54338application.ear-contents/service-ejb.jar
altDD: null
lastDeployed: 1197024484156
lastModified: 1197024454656
mbeans:
, short name: service-ejb.jar, parent short name: application.ear
# ... ######################################################
08:48:08,359 DEBUG [Ejb3Module] Starting jboss.j2ee:service=EJB3,module=service-ejb.jar
08:48:08,375 DEBUG [EJBContainer] Initialising interceptors for myEjbName...
08:48:08,375 DEBUG [EJBContainer] Default interceptors: []
08:48:08,375 DEBUG [EJBContainer] Class interceptors: []
08:48:08,375 DEBUG [EJBContainer] All applicable interceptor classes: []
# ... ######################################################
08:48:08,640 DEBUG [JmxKernelAbstraction] creating wrapper delegate for:
org.jboss.ejb3.stateless.StatelessContainer
08:48:08,640 INFO [JmxKernelAbstraction] installing MBean:
jboss.j2ee:ear=application.ear,jar=service-ejb.jar,name=myEjbName,service=EJB3 with
dependencies:
08:48:08,640 DEBUG [ServiceController] Creating service
jboss.j2ee:ear=application.ear,jar=service-ejb.jar,name=myEjbName,service=EJB3
08:48:08,640 DEBUG [ServiceController] adding depends in ServiceController.register: []
08:48:08,640 DEBUG [ServiceDelegateWrapper] Creating
jboss.j2ee:ear=application.ear,jar=service-ejb.jar,name=myEjbName,service=EJB3
08:48:08,640 DEBUG [ServiceDelegateWrapper] Created
jboss.j2ee:ear=application.ear,jar=service-ejb.jar,name=myEjbName,service=EJB3
08:48:08,640 DEBUG [ServiceController] Creating dependent components for:
jboss.j2ee:ear=application.ear,jar=service-ejb.jar,name=myEjbName,service=EJB3 dependents
are: []
08:48:08,640 DEBUG [ServiceController] starting service
jboss.j2ee:ear=application.ear,jar=service-ejb.jar,name=myEjbName,service=EJB3
08:48:08,640 DEBUG [ServiceDelegateWrapper] Starting
jboss.j2ee:ear=application.ear,jar=service-ejb.jar,name=myEjbName,service=EJB3
08:48:08,640 DEBUG [UserTransactionImpl] new UserTx:
org.jboss.ejb3.tx.UserTransactionImpl@cae5b8
08:48:08,656 DEBUG [JaccHelper] myEjbName has no @SecurityDomain - skipping JACC
configuration
08:48:08,656 INFO [EJBContainer] STARTED EJB: com.example.MyServiceEjb ejbName:
myEjbName
08:48:08,671 DEBUG [ServiceDelegateWrapper] Starting failed
jboss.j2ee:ear=application.ear,jar=service-ejb.jar,name=myEjbName,service=EJB3
java.lang.NullPointerException
at
org.jboss.ejb3.stateless.StatelessRemoteProxyFactory.getInterfaces(StatelessRemoteProxyFactory.java:61)
at
org.jboss.ejb3.stateless.BaseStatelessProxyFactory.init(BaseStatelessProxyFactory.java:172)
at
org.jboss.ejb3.stateless.StatelessRemoteProxyFactory.init(StatelessRemoteProxyFactory.java:77)
at
org.jboss.ejb3.stateless.BaseStatelessProxyFactory.start(BaseStatelessProxyFactory.java:221)
at
org.jboss.ejb3.stateless.StatelessRemoteProxyFactory.start(StatelessRemoteProxyFactory.java:84)
at org.jboss.ejb3.ProxyDeployer.start(ProxyDeployer.java:83)
at org.jboss.ejb3.SessionContainer.start(SessionContainer.java:124)
at org.jboss.ejb3.stateless.StatelessContainer.start(StatelessContainer.java:96)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.jboss.ejb3.ServiceDelegateWrapper.startService(ServiceDelegateWrapper.java:102)
# ... ######################################################
08:48:14,406 DEBUG [MainDeployer] End deployment start on package: pms-stream.war
08:48:14,421 DEBUG [ServiceController] starting service
jboss.j2ee:service=EARDeployment,url='pms-service.ear'
08:48:14,421 DEBUG [EARDeployment] Starting
jboss.j2ee:service=EARDeployment,url='pms-service.ear'
08:48:14,421 DEBUG [EARDeployment] Started
jboss.j2ee:service=EARDeployment,url='pms-service.ear'
08:48:14,421 DEBUG [ServiceController] Starting dependent components for:
jboss.j2ee:service=EARDeployment,url='pms-service.ear' dependent components: []
08:48:14,421 INFO [EARDeployer] Started J2EE application:
file:/E:/_applications/jboss/jboss-4.0.5.GA_clusterOff/server/default/farm/pms-service.ear
08:48:14,421 DEBUG [MainDeployer] End deployment start on package: pms-service.ear
08:48:14,421 DEBUG [MainDeployer] Deployed package:
file:/E:/_applications/jboss/jboss-4.0.5.GA_clusterOff/server/default/farm/pms-service.ear
08:48:14,421 DEBUG [URLDeploymentScanner] Watch URL for:
file:/E:/_applications/jboss/jboss-4.0.5.GA_clusterOff/server/default/farm/pms-service.ear
->
file:/E:/_applications/jboss/jboss-4.0.5.GA_clusterOff/server/default/farm/pms-service.ear
08:48:14,437 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
--- MBeans waiting for other MBeans ---
ObjectName:
jboss.j2ee:ear=pms-service.ear,jar=pms-service-ejb.jar,name=portalmusic.service.ApplicationService,service=EJB3
State: FAILED
Reason: java.lang.NullPointerException
# ... ######################################################
--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName:
jboss.j2ee:ear=pms-service.ear,jar=pms-service-ejb.jar,name=portalmusic.service.UserStatisticService,service=EJB3
State: FAILED
Reason: java.lang.NullPointerException
# FINISH FAILED EJB DEPLOYMENT ######################################################
Then, re-packaging the same application.ear file structure, and redeploy, the same lib,
classes and others, then, installation was sucessfully!!
Debugging JBoss, I found the error in the code:
# StatelessRemoteFactory.java #####################################################
/**...**/
/**
* Comment
*
* @author <a href="mailto:bill@jboss.org">Bill Burke</a>
* @version $Revision: 57207 $
*/
public class StatelessRemoteProxyFactory extends BaseStatelessProxyFactory implements
RemoteProxyFactory
{
/**...**/
protected Class[] getInterfaces()
{
Class[] interfaces;
Class[] remoteInterfaces = ProxyFactoryHelper.getRemoteInterfaces(container);
/**LINE 60**/
interfaces = new Class[remoteInterfaces.length + 2];
/**LINE 61**/
/**...**/
}
/**...**/
}
####################################################################################
# ProxyFactoryHelper.java ##########################################################
/**
* Comment
*
* @author <a href="mailto:bill@jboss.org">Bill Burke</a>
* @version $Revision: 57207 $
*/
public class ProxyFactoryHelper
{
public static Class[] getRemoteInterfaces(Container container)
{
Remote ri = (Remote) ((Advisor) container).resolveAnnotation(Remote.class); /**
LINE 326 **/
if (ri == null)
{
Class beanClass = container.getBeanClass();
Class[] intfs = beanClass.getInterfaces();
ArrayList<Class> remotes = new ArrayList<Class>();
for (Class clazz : intfs)
{
if (clazz.isAnnotationPresent(Remote.class)) /**
LINE 334 **/
{
remotes.add(clazz);
}
}
if (remotes.size() > 0)
{
intfs = remotes.toArray(new Class[remotes.size()]);
ri = new RemoteImpl(intfs);
((Advisor) container).getAnnotations().addClassAnnotation(Remote.class, ri);
return ri.value();
}
return null; /**
LINE 347 **/
}
/**...**/
}
/**...**/
}
####################################################################################
The null value given from the verification of presence of Annotation @Remote over the
'clazz' interface. When debugging, the class with the assign interface
"javax.ejb.Remote" was compared with "javax.ejb.Remote", but the
response was false.
Then, method return null att line 347, because "remotes" list is empty.
My actual work (workaround) to use this EAR structure, is follow:
1. Start JBoss;
2. Deploy application.ear once;
3. After all fail deployment messages, redeploy the application with a diferent file, to
generate a hot-deploy, or execute the redeploy manually.
4. All work fine.
This works, because in the second time, in the LINE 326 populates the 'Remote ri'
reference variable.
This is my case using EJB3.
This problem persists in version jbossas-4.2.2 and jbossas-5.0.0.Beta2
[]'s,
André Pastore
NPE when deploying web service beans
------------------------------------
Key: EJBTHREE-933
URL:
http://jira.jboss.com/jira/browse/EJBTHREE-933
Project: EJB 3.0
Issue Type: Bug
Reporter: Heiko Braun
The exception:
java.lang.NullPointerException
at
org.jboss.ejb3.stateless.StatelessRemoteProxyFactory.getInterfaces(StatelessRemoteProxyFactory.java:74)
at
org.jboss.ejb3.stateless.BaseStatelessProxyFactory.init(BaseStatelessProxyFactory.java:172)
at
org.jboss.ejb3.stateless.StatelessRemoteProxyFactory.init(StatelessRemoteProxyFactory.java:100)
at
org.jboss.ejb3.stateless.BaseStatelessProxyFactory.start(BaseStatelessProxyFactory.java:221)
at
org.jboss.ejb3.stateless.StatelessRemoteProxyFactory.start(StatelessRemoteProxyFactory.java:107)
at org.jboss.ejb3.ProxyDeployer.start(ProxyDeployer.java:83)
at org.jboss.ejb3.SessionContainer.start(SessionContainer.java:124)
at org.jboss.ejb3.stateless.StatelessContainer.start(StatelessContainer.java:94)
The bean that get's deployed:
package com.sun.ts.tests.webservices12.ejb.annotations.WSEjbPortFieldInjectionTest;
import javax.ejb.Stateless;
import javax.jws.WebService;
@WebService(
portName="Hello",
serviceName="HelloService",
targetNamespace="http://Hello.org",
wsdlLocation="META-INF/wsdl/HelloService.wsdl",
endpointInterface="com.sun.ts.tests.webservices12.ejb.annotations.WSEjbPortFieldInjectionTest.Hello")
@Stateless(name="WSEjbPortFieldInjectionTest")
public class HelloBean {
public String hello(String str)
{
return "WebSvcTest-Hello " + str;
}
public String bye(String str)
{
return "WebSvcTest-Bye and take care " + str;
}
}
The spec:
Session bean's business interface(s), if the session bean provides an EJB 3.0 local
or remote
client view.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira