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 3242624
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:20:13+00:00 2026-05-17T18:20:13+00:00

I am developing my first Seam + Android application and I am facing some

  • 0

I am developing my first Seam + Android application and I am facing some new scenarios as expected.

Now specifically for this app, I decided not to keep any state because probably 80% to 90% of the server calls on the REST service will be specifically to do a simple synchronization and the client is gone for a while, so there is(probably) no point on keeping any state on the server side for these calls.

Well there is a specific routine where I need to persist an Object sent by device to the server side and this object is bind to a specific user(a very common scenario in my opinion).

So there goes some code to ilustrate.

The Home interface has a user injected by Seam:

@Name("pesoHome")
public class PesoHome extends EntityHome<Peso> {

    private static final long serialVersionUID = 6087763635317971234L;

    @In
    User user;

Than we need a rest service wich uses this home interface:

public class PesoRest{

    @Logger
    Log log;

    @In(create = true)
    UserPesquisa userPesquisa;

    @In(create = true)
    PesoHome pesoHome;

    @POST
    @Path("/cadastrar/{userEmail}")
    @Consumes(MediaType.APPLICATION_JSON)
    public Response cadastraPeso(@PathParam("userEmail") String email, String jsonString)
    {
            String json = jsonString;
            System.out.println("String jSon no servidor ==>> " + json);

And than because of the User injection in the home interface the following error triggers at runtime:

Caused by: org.jboss.seam.InstantiationException: Could not instantiate Seam component: pesoHome
    at org.jboss.seam.Component.newInstance(Component.java:2144)
    ... 46 more
Caused by: org.jboss.seam.RequiredException: @In attribute requires non-null value: pesoHome.user

Notice that in the body of the request the JSon object brings information about this user wich allows to recover this user using the also injected userPesquisa reference.
I know I could have a different approach where I would build a seam component with no references to user and than in it build the user and place it in a new conversation and than inject the home reference I need, but…
I was wondering that probably there should be some more standard approach for this as it is a common scenario. Any suggestions? 🙂

[]s

  • 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-17T18:20:14+00:00Added an answer on May 17, 2026 at 6:20 pm

    as suggested by Arthur in this thread comments I have changed a bit the code and now it works:

    PesoHome:

        @In(required=false)
        User user;
    
        public User getUser() {
            return user;
        }
    
        public void setUser(User user) {
            this.user = user;
        }
    

    and than in PesoRest:

    User usuario = userPesquisa.pesquisaUsuarioPorEmail(email);
    pesoHome.setUser(usuario);
    

    And than because now user is not required on creation anymore, the error is not triggered and I can do a late bind after searching DB to recover the correct user. Quite simple solution. Thanks Arthur.

    []s

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

Sidebar

Related Questions

No related questions found

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.