Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5971937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:35:15+00:00 2026-05-22T20:35:15+00:00

public interface ModelClient { public JSONObject _callModel(URL url); } @Stateless @Local(ModelClient.class) public class ModelClientBean

  • 0
public interface ModelClient {
    public JSONObject _callModel(URL url);
}

@Stateless
@Local(ModelClient.class)
public class ModelClientBean implements ModelClient {
    public JSONObject _callModel(URL url) { /* some implementation */ }
}

@Stateless(name="ejb/ModelServiceBean")
public class ModelServiceBean {

   @EJB
   private ModelClient modelClient;
}

JBoss AS 6 says:

17:25:30,186 INFO  [org.jboss.ejb3.session.SessionSpecContainer] Starting jboss.j2ee:ear=rms-ear.ear,jar=rms-ejb-1.0-SNAPSHOT.jar,name=ModelClientBean,service=EJB3
17:25:30,187 INFO  [org.jboss.ejb3.EJBContainer] STARTED EJB: com.domain.rms.ejbs.ModelClientBean ejbName: ModelClientBean
17:25:30,250 INFO  [org.jboss.ejb3.proxy.impl.jndiregistrar.JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:
rms-ear/rms-ejb-1.0-SNAPSHOT.jar/ModelClientBean!local - EJB3.x Default Local Business Interface
rms-ear/rms-ejb-1.0-SNAPSHOT.jar/ModelClientBean!com.domain.rms.ejbs.ModelClient - EJB3.x Local Business Interface

so far so good.
But any attempt to modelClient results with “NullPointerException”.

Any Idea ?

UPDATE: ModelServiceBean is looked up over JNDI (InitialContext) from a non-managed context

public JobServiceCall() {
    Context context = null;
    try {
        context = new InitialContext();
        modelServiceBean = (ModelServiceBean)context.lookup("..");
    } catch ()...
 }

The exception stack trace:

Caused by: java.lang.NullPointerException
    at com.domain.rms.ejbs.ModelClientBean._callModel(ModelClientBean.java:53) [:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_24]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_24]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_24]
    at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_24]
    at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:122) [jboss-aop.jar:2.2.1.GA]
    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111) [jboss-aop.jar:2.2.1.GA]
    at org.jboss.ejb3.interceptors.container.ContainerMethodInvocationWrapper.invokeNext(ContainerMethodInvocationWrapper.java:72) [:1.1.3]
    at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.invoke(InterceptorSequencer.java:76) [:1.1.3]
    at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.aroundInvoke(InterceptorSequencer.java:62) [:1.1.3]
    at sun.reflect.GeneratedMethodAccessor279.invoke(Unknown Source) [:1.6.0_24]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_24]
    at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_24]
    at org.jboss.aop.advice.PerJoinpointAdvice.invoke(PerJoinpointAdvice.java:174) [jboss-aop.jar:2.2.1.GA]
    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]
    at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.fillMethod(InvocationContextInterceptor.java:74) [:1.1.3]
    at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_fillMethod_11016588.invoke(InvocationContextInterceptor_z_fillMethod_11016588.java)
    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]
    at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.setup(InvocationContextInterceptor.java:90) [:1.1.3]
    at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_setup_11016588.invoke(InvocationContextInterceptor_z_setup_11016588.java)
    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]
    at org.jboss.ejb3.async.impl.interceptor.AsynchronousServerInterceptor.invoke(AsynchronousServerInterceptor.java:128) [:1.7.17]
    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]
    at org.jboss.ejb3.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:62) [:1.7.17]
    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]
    at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:56) [:1.7.17]
    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]
    at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47) [:1.7.17]
    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]
    at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42) [:1.0.3]
    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]
    at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:68) [:1.7.17]
    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]
    at org.jboss.ejb3.core.context.SessionInvocationContextAdapter.proceed(SessionInvocationContextAdapter.java:95) [:1.7.17]
    at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:223) [:0.0.1]
    ... 109 more
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T20:35:15+00:00Added an answer on May 22, 2026 at 8:35 pm

    How do you get hold to an instance of ModelServiceBean? Injection only works when ModelServiceBean itself is injected into some managed bean (e.g. a Servlet, JSF Managed bean, etc) or when you request it via JNDI.

    Injection will not happen when you instantiate the class with the new operator.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The classes: public interface Inter { ...some methods... } public class Impl implements Inter
If we have: public interface Foo{} public class Bar implements Foo{...} Is there a
public interface Foo { } public class SpecificFoo implements Foo { } public interface
public interface ITest { void Somethink(); } public class Test1 : ITest { public
I have an interface: public interface IMyInterface { } I have a class which
public interface IFoo : ICanCatch, ICanLog { void Bar () } public class Foo
Given: public interface PrimaryKey<Key extends Comparable> { Key getKey(); } and public class PrimaryKeyComparator
class Interface{}; class Foo: public Interface{}; class Bar{ public: vector<Interface*> getStuff(); private: vector<Foo*> stuff;
public interface ITaskProvider { T GetTask<T>(); } In the implementation of ITaskprovider below, as
[ServiceContract] public interface ISecurities<T> : IPolicyProvider where T: EntityObject { [OperationContract(Name=GetAllSecurities)] IEnumerable<T> GetSecurities(); [OperationContract]

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.