[JBoss JIRA] Created: (EJBTHREE-664) Injection using @Resource of SessionContext fails with NullPointerException while deploying the application
by jaikiran pai (JIRA)
Injection using @Resource of SessionContext fails with NullPointerException while deploying the application
-----------------------------------------------------------------------------------------------------------
Key: EJBTHREE-664
URL: http://jira.jboss.com/jira/browse/EJBTHREE-664
Project: EJB 3.0
Issue Type: Bug
Affects Versions: EJB 3.0 RC8 - FD
Environment: JBoss-4.0.4GCA, jboss-EJB-3.0_RC8-FD, Java: jdk1.5.0_07
Reporter: jaikiran pai
Attachments: Exception Stacktrace.txt, MyEJB3.ear, source.zip
I have StatelessSessionBean in which i am trying to inject the SessionContext. When i am trying to deploy the bean, server throws exceptions indicating a NullPointerException and subsequently the application is not deployed.
Here's a small extract from the exception stacktrace(The entire exception stacktrace is attached to this issue):
12:52:11,816 INFO [EARDeployer] Init J2EE application: file:/D:/JBoss4.0.4GCA/jboss-4.0.4.GA/server/default/deploy/MyEJB3.ear/
12:52:12,160 INFO [Ejb3Deployment] EJB3 deployment time took: 188
12:52:12,270 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=MyEJB3.ear,jar=myapp_ejb.jar,name=TestEJB3,service=EJB3 with dependencies:
12:52:12,691 WARN [ServiceController] Problem starting service jboss.j2ee:ear=MyEJB3.ear,jar=myapp_ejb.jar,name=TestEJB3,service=EJB3
java.lang.NullPointerException
at org.jboss.ejb3.injection.ResourceHandler.loadFieldInjectors(ResourceHandler.java:283) at org.jboss.ejb3.injection.ResourceHandler.loadInjectors(ResourceHandler.java:401)
at org.jboss.ejb3.injection.ResourceHandler.loadInjectors(ResourceHandler.java:381)
at org.jboss.ejb3.EJBContainer.resolveInjectors(EJBContainer.java:640)
at org.jboss.ejb3.EJBContainer.initializePool(EJBContainer.java:576)
at org.jboss.ejb3.EJBContainer.start(EJBContainer.java:507)
at org.jboss.ejb3.SessionContainer.start(SessionContainer.java:82)
at org.jboss.ejb3.stateless.StatelessContainer.start(StatelessContainer.java:80)
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:99)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
at sun.reflect.GeneratedMethodAccessor2.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.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
at $Proxy0.start(Unknown Source)
12:52:13,785 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
--- MBeans waiting for other MBeans ---
ObjectName: jboss.j2ee:ear=MyEJB3.ear,jar=myapp_ejb.jar,name=TestEJB3,service=EJB3
State: FAILED
Reason: java.lang.NullPointerException
--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: jboss.j2ee:ear=MyEJB3.ear,jar=myapp_ejb.jar,name=TestEJB3,service=EJB3
State: FAILED
Reason: java.lang.NullPointerException
I am using JBoss - 4.0.4 GCA. I followed the following steps after installing the server:
1) I downloaded jboss-EJB-3.0_RC8-FD
2) Copied ejb3-persistence.jar in server/default/lib
3) Copied ejb3-interceptors-aop.xml in server/default/deploy
4) ejb3.deployer in server/default/deploy
Note that with the injection part commented out, everything works fine, the EJB gets deployed and i am able to invoke methods on the EJB.
I have attached the source code and the .ear file along with this issue for reference. Just place the MyEJB3.ear file in the %JBOSS_HOME%/server/default/deploy directory, after following the steps mentioned above, and start the server to reproduce the issue.
--
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
19 years, 3 months
[JBoss JIRA] Commented: (JBAS-3325) Remove old code
by Dimitris Andreadis (JIRA)
[ http://jira.jboss.com/jira/browse/JBAS-3325?page=comments#action_12344860 ]
Dimitris Andreadis commented on JBAS-3325:
------------------------------------------
What do you mean? We use the RMI implementation to comes with the JDK. Better use the forum thread.
> Remove old code
> ---------------
>
> Key: JBAS-3325
> URL: http://jira.jboss.com/jira/browse/JBAS-3325
> Project: JBoss Application Server
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: Other
> Affects Versions: JBossAS-4.0.4.GA
> Environment: JBoss 4.0.3.SP1
> $ java -version
> java version "1.4.2_12"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_12-b03)
> Java HotSpot(TM) Client VM (build 1.4.2_12-b03, mixed mode)
> $ java -version
> java version "1.5.0_07"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03)
> Java HotSpot(TM) Client VM (build 1.5.0_07-b03, mixed mode, sharing)
> Reporter: Robert Schroeder
> Assigned To: Dimitris Andreadis
> Fix For: JBossAS-4.0.6.CR1
>
>
> http://wiki.jboss.org/wiki/Wiki.jsp?page=UsingJBossBehindAFirewall mentions the parameter "java.rmi.server.hostname" to set if the external host name differs from the local host (e.g. server machine is behind a firewall)
> But org.jboss.web.WebService doesn'r recognize this parameter:
> String hostname = server.getBindAddress(); // this always returns something, at least "0.0.0.0"!
> // If not user specified hostname given, then try to determine what it should be
> if (hostname == null) //this branch is never executed!
> {
> // First look for the rmi server name
> try
> {
> hostname = System.getProperty("java.rmi.server.hostname"); // this parameter is not recognized as this branch is never executed
> }
> catch (SecurityException e)
> {
> // ignore, but don't be silent
> ThrowableHandler.addWarning(e);
> }
> // else use the localhost name
> if (hostname == null)
> {
> try
> {
> hostname = InetAddress.getLocalHost().getHostName();
> }
> catch (IOException e)
> {
> log.error("Failed to get localhost name; ignoring", e);
> }
> }
> if (hostname != null)
> {
> setHost(hostname);
> }
> }
> // Host must be set to continue (either by user or detection)
> String address = getHost();
> if (address == null)
> throw new MissingAttributeException("Host");
> // Set the rmi codebase if it is not already set
> String codebase = System.getProperty("java.rmi.server.codebase");
> if (codebase == null)
> {
> address = ServerConfigUtil.fixRemoteAddress(address);
> codebase = "http://" + address + ":" + getPort() + "/";
> System.setProperty("java.rmi.server.codebase", codebase);
> }
> log.info("Using RMI server codebase: " + codebase);
> So the resulting problem is that codebase contains an address which is not reachable from the other side of firewall because "java.rmi.server.hostname" is not recognized (same for "-Djava.rmi.server.useLocalHostname=false" )
> Example:
> JBoss started with parameter set "-Djava.rmi.server.hostname=as2.subdomain1.subdomain2.test.com"
> but (thanks to rmi logging) the proxy objects on client side have codebase set to "http://as2:<port>" and not to "http://as2.subdomain1.subdomain2.test.com:<port>" as expected.
> JBoss 4 runs on a linux machine
> hostname --> "as2"
> hostname -f --> "as2.subdomain1.subdomain2.test.com"
--
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
19 years, 3 months
[JBoss JIRA] Commented: (JBAS-3325) Remove old code
by Robert Schroeder (JIRA)
[ http://jira.jboss.com/jira/browse/JBAS-3325?page=comments#action_12344858 ]
Robert Schroeder commented on JBAS-3325:
----------------------------------------
With this bug in mind: Does JBoss AS follow RMI specification?
> Remove old code
> ---------------
>
> Key: JBAS-3325
> URL: http://jira.jboss.com/jira/browse/JBAS-3325
> Project: JBoss Application Server
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: Other
> Affects Versions: JBossAS-4.0.4.GA
> Environment: JBoss 4.0.3.SP1
> $ java -version
> java version "1.4.2_12"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_12-b03)
> Java HotSpot(TM) Client VM (build 1.4.2_12-b03, mixed mode)
> $ java -version
> java version "1.5.0_07"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03)
> Java HotSpot(TM) Client VM (build 1.5.0_07-b03, mixed mode, sharing)
> Reporter: Robert Schroeder
> Assigned To: Dimitris Andreadis
> Fix For: JBossAS-4.0.6.CR1
>
>
> http://wiki.jboss.org/wiki/Wiki.jsp?page=UsingJBossBehindAFirewall mentions the parameter "java.rmi.server.hostname" to set if the external host name differs from the local host (e.g. server machine is behind a firewall)
> But org.jboss.web.WebService doesn'r recognize this parameter:
> String hostname = server.getBindAddress(); // this always returns something, at least "0.0.0.0"!
> // If not user specified hostname given, then try to determine what it should be
> if (hostname == null) //this branch is never executed!
> {
> // First look for the rmi server name
> try
> {
> hostname = System.getProperty("java.rmi.server.hostname"); // this parameter is not recognized as this branch is never executed
> }
> catch (SecurityException e)
> {
> // ignore, but don't be silent
> ThrowableHandler.addWarning(e);
> }
> // else use the localhost name
> if (hostname == null)
> {
> try
> {
> hostname = InetAddress.getLocalHost().getHostName();
> }
> catch (IOException e)
> {
> log.error("Failed to get localhost name; ignoring", e);
> }
> }
> if (hostname != null)
> {
> setHost(hostname);
> }
> }
> // Host must be set to continue (either by user or detection)
> String address = getHost();
> if (address == null)
> throw new MissingAttributeException("Host");
> // Set the rmi codebase if it is not already set
> String codebase = System.getProperty("java.rmi.server.codebase");
> if (codebase == null)
> {
> address = ServerConfigUtil.fixRemoteAddress(address);
> codebase = "http://" + address + ":" + getPort() + "/";
> System.setProperty("java.rmi.server.codebase", codebase);
> }
> log.info("Using RMI server codebase: " + codebase);
> So the resulting problem is that codebase contains an address which is not reachable from the other side of firewall because "java.rmi.server.hostname" is not recognized (same for "-Djava.rmi.server.useLocalHostname=false" )
> Example:
> JBoss started with parameter set "-Djava.rmi.server.hostname=as2.subdomain1.subdomain2.test.com"
> but (thanks to rmi logging) the proxy objects on client side have codebase set to "http://as2:<port>" and not to "http://as2.subdomain1.subdomain2.test.com:<port>" as expected.
> JBoss 4 runs on a linux machine
> hostname --> "as2"
> hostname -f --> "as2.subdomain1.subdomain2.test.com"
--
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
19 years, 3 months