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

  • SEARCH
  • Home
  • 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 7606979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:32:43+00:00 2026-05-31T00:32:43+00:00

I created a basic application shell with AppFuse, and followed the AppFuse tutorial to

  • 0

I created a basic application shell with AppFuse, and followed the AppFuse tutorial to create a a simple RESTful service with Jax-RS. That works just fine. A call to http://localhost:8080/services/api/persons returns a collection of Person objects as a Json formatted string with the right data.

I now would like to access the ServletRequest and ServletResponse objects from within a RESTful service exposed by Appfuse (to use another library that requires these objects).

I think that should be doable by adding an @Context annotation, e.g. following this StackOverflow post and this forum post.

But if I add the @Context tag (see below), it compiles fine but throws an Exception when the server is restarted (attached at bottom).

Here’s the declaration of the @WebService:

@WebService
@Path("/persons")
public interface PersonManager extends GenericManager<Person, Long> {
    @Path("/")
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    List<Person> read();
    ...
}

And here’s the implementation class where I think I would call the @Context annotation:

@Service("personManager") 
public class PersonManagerImpl extends GenericManagerImpl<Person, Long> implements PersonManager { 
    PersonDao personDao; 
    @Context ServletRequest request; // Exception thrown on launch if this is present 
    @Context ServletContext context;  // Exception thrown on launch of this is present 
    ... 
    } 

Hopefully I’m missing something simple, either something to include to make it work, or to realize that getting the ServletRequest isn’t supposed to be possible because…. Any clues would be welcome.

Am running this on Tomcat in IntelliJ.

=== EXCEPTION STACK TRACE (Truncated) ===

Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: 
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'serviceBeans' threw exception; nested exception is java.lang.RuntimeException: java.lang.NullPointerException 
        at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:102) 
        at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58) 
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1358) 
        ... 37 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-31T00:32:45+00:00Added an answer on May 31, 2026 at 12:32 am

    Try injecting the HttpServletRequest and HttpServletContext directly:

    @Context private HttpServletRequest servletRequest;
    @Context private HttpServletContext servletContext;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created just the most basic WCF Service Application to do some prototyping, but
I have created a basic WCF service in IIS. I am aware that this
I created a basic application in Xcode 4.2. Very simple application, I have not
I'm trying to create a basic application, i created facebook application before but everything
I created a sample application that where I have a basic fullscreensize UIImageView set
I am trying to create application with Zend framework so I have created basic
I created a Visual Basic 6 application that runs without a hitch on my
I've created a basic RESTful Roo application using the following Roo-script (Roo 1.1.5). project
I have created a very basic service operation that needs to write content to
I'd like to create a basic Hello World style application for the IPhone using

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.