Dependency injection and inaccessible target return null

Hello
I tried a simple code to jsf 2.
That's
Here's the jsp
-----
< h:form >
< h:inputText value="#{MBTest.thePerson.name}"/ >
< h:commandButton value = 'submit' action = "#{MBTest.action}" / >
< h:messages / >
< / h:form >
-----

Here's Managed bean MBTest
-----
@ManagedBean (name = "MBTest")
@RequestScoped
public class MBTest {}

@ManagedProperty (value = "#{thePerson}")
private person thePerson = null;

public MBTest() {}
}

public person {} getThePerson()
Return thePerson;
}

{} public void setThePerson (person thePerson)
this.thePerson = thePerson;
}

{} public void action()
System.out.println (thePerson.GetName ());
}
}
-----
This is the Person class
-----
public class person {}

private String name = null;
private int age = 0;

public int getAge() {}
return age;
}

public void setAge (int age) {}
This.Age = age;
}

public String getName() {}
return the name.
}

public void setName (String name) {}
myIdName = name;
}
}
-----

But once this completed page opens (Please note that "thePerson" managed bean instance is not instantiated, just the managed property has been declared). When the button is pressed, it gives me the error of followuing
-----
/index. XHTML @12,60 value = "#{MBTest.thePerson.name}": unattainable target, "thePerson" returned null "
-----
Could you please tell me why?

Off topic:
Where the code tags? I can't find it here.

as far as I can see, your person class is not a managed bean. I expect an annotation @ManagedBean (name = "thePerson") on it. If you do not a managed bean, JSF doesn't know it exists.

If you don't want a person as being a managed bean, then simply yourself create an instance of your class MBTest.

private Person thePerson = new Person();

Tags: Java

Similar Questions

  • Inaccessible, the "myPage" target returned null

    Hi all
    I use Jdeveloper 11.1.1.0
    I have a page in adfc-config, and when I run my application I have this error:
    Cause first of ServletException.
    javax.el.PropertyNotFoundException: inaccessible target, 'myPage' returned null
    at com.sun.el.parser.AstValue.getTarget(AstValue.java:88)
    at com.sun.el.parser.AstValue.setValue(AstValue.java:133)
    at com.sun.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:255)
    at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:259)
    at javax.faces.webapp.UIComponentELTag.createComponent(UIComponentELTag.java:222)

    What is the problem?

    Thank you

    Andrea

    Andrea,
    We cannot say without any knowledge on your page.
    All I see is that you are referencing a myPage property somewhere in your page that is not present in every bean or binding.
    Search for my page and check if the bean is present.

    Timo

  • bbUI.js and localStorage.getItem return null values

    Hello

    I build a WebWorks app with bbUI.js for BB10 and I run problems when I want to retrieve items of localStorage. Their storage is no problem. Here is my architecture:

    1. index.html which uses localStorage.getItem in a function ondomready for 1 screen (fueltracker.html), it works
    2. JS/Register.js with functions like registerUser(), registerEngine(), registerBrand(), registerModel() called when onclick in their respective screens, see below
    3. RegisterUser() calls register.html
    4. registerBrand() calls addCar.html
    5. registerModel() calls addModel.html
    6. registerEngine() calls addEngine.html
    7. fueltracker.html which has a few buttons that the label should be changed to values from localStorage

    The register() functions make a call to localStorage.setItem (), working (i.e. the values are defined). However, in some cases parts of objects stored in localStorage it update, so this object must be recovered first, updated and then stored again. Unfortunately the calls localStorage.getItem () does not return the value that is stored in the localStorage.

    So how does it do?

    Yes Chad, variables have been established.

    It's the same problem as this one: http://stackoverflow.com/questions/2010892/storing-objects-in-html5-localstorage (objects cannot be stored in LocalStorage, single key-value pairs, so items must be chained before putting them in the LocalStorage). The getObject() en index.html setObject methods and their use instead of getItem() and setItem() solved the problem.

  • Goal unattainable '&lt; beanInstanceName &gt;' returned Null

    Hi all
    I attend ADF of Oracle University training. Today is the last day of training. I'm having some problem with running a simple application and could not get the right answer for the sub question.

    Created a Fusion WebApplication 'Test' with model and ViewController project.
    Created a ManagedBean "TestBean", Taskflow 'TestFlow', page Jsff in taskflow 'TestJsff' and a 'TestJspx '.
    Recorded the TestBean with Taskflow in the request scope.
    Created a property String name = 'Ram' in Bean managed with the accessor of the property.
    Created an outputText component the TestJsff and set the value property to "#{requestScope.TestBean.name}".
    Dragged the TestJsff Taskflow and TestFlow to TestJspx.
    Running the page TestJspx and I see the mistake 'Inaccessible TestBean Target returned null.'

    I don't know what to do?

    Thanks in advance...

    Rajdeep

    It is a common mistake with EL.
    The problem is that #{requestScope.Beanname.attribute} refers to only the objects (beans) in memory, but do not create them when they aren't there. So you get a NPE if you are referring to a bean the first time (when it is not instantiated already). This is true for all scopes in JSF (request, session and application).
    Other scopes added by the life cycle of ADFrc (view, pageflow and backingbean) behave different due to the extended ADFrc controller. The controller looking for these special glasses and manages (for example to create them the object if it is not there).

    Frank Nimphius recorded a screen expressed about common mistakes using ADF. If you want, you can watch it here:
    http://download.Oracle.com/otn_hosted_doc/JDeveloper/11gdemos/classic_api_mistakes_part2/classic_api_mistakes_part2.html

    Timo

  • PersistentObject.getContents () returns null after app update

    Hello

    I'm trying to track down a bug with PersistentStore.
    Usually when I update the app I get the getContents() stored content.
    However, something in the code has changed from one version to the other and now getContents() returns null.

    I made sure the id has never changed for PersistentStore.getPersistentObject (id);
    I made sure that we use the same basic sdk (4.3.0)
    I made sure that there are the data stored in the stored hash table

    Currently, it's a hash table - no subclass (even though I know that I should change it to a subclass when it's fixed);

    I wonder if there are any suggestions on what might cause the getContents() return null - or which could result in the PersistentStore have cleared.

    What information is needed, please let me know and I'll paste.

    I found the problem after.

    Classes have begun to obscure differently. If the hash table was still readable, but because he could not read the content of the hash table, he would return null.

    It was unexpected, because if you have a custom class persisted and you try to read it, you will get the content, but you can't cast. But with the hash table, it does not return the content (uncastable) and it throws no exceptions...

    I hope this helps someone else who has a similar problem.

  • All tables and xml are be NULL problem

    Hello guys

    I'm working on a project that uses the format of loading xml, e4x and intensively, table manipulation and it was fine but now I'm stuck on a strange problem.  All code was beautiful and application work and respond in a desired way, but then mystourisly it stopped working and started to return NULL values in almost all the tables of the (internal) actionscript and XML varibales.

    Now every time I have to load the xml file and set the loaded xml internal variables, internal values get only NULL instead of data.
    The same is the situation with the berries, I created a few components in mxml, and when I passed them to reference tables, the code gets compiled successfully, but again Array has only null values [that code worked very well too]

    I wonder if Adobe Flex did an update reduced to silence or something similar and it's the result of this things!

    I use Adobe Flex 3.2 SDK 3.3 on windows Vista Ultimate Edition.

    Please check this project attached, import it and see if you face the same problem

    Thank you

    Link to the problematic project

    http://isolatedperson.googlepages.com/problemXperiment.zip

    Problem screenshot

    http://isolatedperson.googlepages.com/xmlissue.jpg

    HTTPService to load the data. You will have less problems.

    
    
         
              
         
         
         
    
    
  • Debugging inaccessible FacesException:Target, 'bean' returned null

    Hi all

    Jdev: 11.1.1.7.1

    We have a living ADF application that worked very well until installing a recent where a flow is the break with the message "inaccessible FacesException:Target, 'bean' returned null. It works very well in our UAT and our production environment is clustered.

    StackTrace

    oracle.jbo.JboException: JBO-29000: Unexpected exception caught: javax.faces.FacesException, msg=#{pageFlowScope.xyzBean.showCaseDetails}: Target Unreachable, 'xyzBean' returned null
    Supplemental Detail    at oracle.adf.model.binding.DCBindingContainer.reportException(DCBindingContainer.java:417)
    at oracle.adf.model.binding.DCBindingContainer.reportException(DCBindingContainer.java:479)
    at com.wellsfargo.common.view.WFExceptionHandler.handleException(WFExceptionHandler.java:57)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._handleException(LifecycleImpl.java:1380)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:211)
    .....
    ..
    ## Detail 0 ##
    javax.faces.FacesException: #{pageFlowScope.xyzBean.showCaseDetails}: Target Unreachable, 'xyzBean' returned null
    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
    at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
    at org.apache.myfaces.trinidad.component.UIXCollection.broadcast(UIXCollection.java:148)
    at org.apache.myfaces.trinidad.component.UIXTable.broadcast(UIXTable.java:280)
    

    Guidance on how to debug what appears not a problem with scope as our UAT works very well.

    We were finally able to reproduce the problem in our local instance.

    Regarding the cause, the view behind the UI object, the research doesn't have the right keys. As a result, selection on the table was selecting two rows on the search results. By clicking on the commandlink, it seems that two events of Action are put in queue and after that the first action event navigates successfully, the second is pulled and fails.

  • 10 g XE GET_WKT() and GET_WKB() return NULL;

    All,

    Select sdo_geometry ('POINT (37-79)', 4326). GET_WKT() FROM DUAL;

    Returns NULL in my 10g XE edition. I read in some places that XE does not come with this feature inside landmark because of a problem JVM version. Is this true? Can I convert between WKT and WKB or get the WKB of a SDO_GEOMETRY with XE?

    THX in advance.

    XE has no JVM, so spatial functionality that depends on the JVM are not available in the XE.
    I guess the only option is to write your own function to generate the WKT XE.

    Siva

  • Unattainable goal BackingBean returned null

    We have a master application that references libraries (deployed to the logic of the web as WAR files). To do this, we have a deployment descriptor weblogic listing libraries.

    Content in the referenced library is a workgroup that contains a list of identifiers. We use contextual events to pass the id of the current line of the library to the main application. When a button is clicked in the working group id of the current line should be sent to the master application. The ActionListener designates the backing bean editAppWC

    #{backingBeanScope.appWCPubBean.editAppWC}

    It comes when we run the application master we get the error:

    Root cause]] of ServletException.
    javax.faces.FacesException: javax.el.PropertyNotFoundException: inaccessible target, 'appsWCPubBean' returned null
    at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:262)
    at javax.faces.webapp.UIComponentELTag.createComponent(UIComponentELTag.java:222)
    at javax.faces.webapp.UIComponentClassicTagBase.createChild(UIComponentClassicTagBase.java:486)
    at javax.faces.webapp.UIComponentClassicTagBase.findComponent(UIComponentClassicTagBase.java:670)
    at javax.faces.webapp.UIComponentClassicTagBase.doStartTag(UIComponentClassicTagBase.java:1142)
    Truncated. check the log file full stacktrace

    Is this what we set in the adfc-config. XML or the faces-config. XML? The adfc-config file. XML library, I can see reference to the managed bean, but that's all. I'm sure that we have to miss a step.

    Any help would be greatly appreciated

    Thank you
    Kylie

    Hello

    You must register bean in stubborn taskflow you use inside taskflow.
    Open taskflow in source view and copy the same code used to save beans in adfc - config.xml to taskflow delimited (inside the tag).

    Jean Lou

  • Get error inaccessible target ADF Application performance

    Hi Experts,

    IM using Managed Bean Scope session, but its gives me this error.

    javax.faces.FacesException: javax.el.PropertyNotFoundException: inaccessible target, 'SHU_Bean' returned null

    at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:261)

    at javax.faces.webapp.UIComponentELTag.createComponent(UIComponentELTag.java:222)

    at javax.faces.webapp.UIComponentClassicTagBase.createChild(UIComponentClassicTagBase.java:513)

    at javax.faces.webapp.UIComponentClassicTagBase.findComponent(UIComponentClassicTagBase.java:782)

    at javax.faces.webapp.UIComponentClassicTagBase.doStartTag(UIComponentClassicTagBase.java:1354)

    at org.apache.myfaces.trinidad.webapp.UIXComponentELTag.doStartTag(UIXComponentELTag.java:71)

    at oracle.adfinternal.view.faces.unified.taglib.input.UnifiedInputTextTag.doStartTag(UnifiedInputTextTag.java:51)

    but when I change the scope of Session to backedbean then its fine running. But I need scope Session here for the conservation of the data for each user. Any help

    Thank you

    Raul

    If you change the field of beans to return to session scope, you need to delete each prefix "backingBeanScope." in your pages, then it should look like: "SHU_Bean.propLegacy."

    Dario

  • ConnectionFactory.getConnection () returns null.

    ConnectionFactory connFact = new ConnectionFactory();
            ConnectionDescriptor connDesc = null;
            connDesc = connFact.getConnection(----here goes my url String----);
    

    Hi all

    In the code posted above, number In Line 3, reason for which the null value is returned by the statement "connFact.getConnection (- this is my String url-);"   and he is assigned to the variable 'connDesc '.  Although I was able to login successfully before 2 to 3 hours. but it is now return null...

    Could you please help me?

    Best regards,

    Hi Sir,

    After going through the link provided by you (and a few other sup on internet links), I was able to resolve the issue for now... I write the code for other users help here...

    Thank you for your support...

    Best regards.

    // make a list of transport types ordered according to preference (they will be tried in succession)
    int[] preferredTransportTypes = {TransportInfo.TRANSPORT_MDS, TransportInfo.TRANSPORT_WAP2};
    
    // Create ConnectionFactory
    ConnectionFactory factory = new ConnectionFactory();
    
    // Configure the factory
    factory.setPreferredTransportTypes( preferredTransportTypes );
    
    // use the factory to get a connection
    ConnectionDescriptor conDescriptor = factory.getConnection("http://www.blackberry.com");
    
    if ( conDescriptor != null ) {
    
       // connection suceeded
       int transportUsed = conDescriptor.getTransportDescriptor().getTransportType();
    
       // using the connection
       HttpConnection  httpCon = (HttpConnection) conDescriptor.getConnection();
       ...
    }
    
  • Connection string returns null

    HI my app works perfectly well on the 3G network, but when I try to use the = wifi interface to establish a connection with wifi, an IOException is thrown by showing its null. can someone help me with this please?

    Thanks in advance

    Sorry I'm not trying to be picky here, but this line, which is the line that I suspect you got to, can see not all

    NULL:

    System.out.println ("LiveGuard Could not connect to server." + e.getMessage ());

    I got the answer to this topic with the question "what null.  I don't even really know what is the answer to this question.

    If you want peple to help you, you help them.  So please answer the questions and follow all instructions.  If you decide not to do it at least explain why you do not have.  At least, that will alert stakeholders as to what you actually do and they can return to explain why really did you what was asked, if she is still topical.

    And don't forget that you explain your problem to someone who has only seen a small part of your code, do not know your skill level or your experience or your entire upwards, so you have to be as detailed as you possibly can.

  • The body of the message to return null on os 4.5.0.18. When you use getBodyText()

    Hi all

    Today, when I debug my application on 4.5.0.18 device 8130.

    I implements FolderListener, when new messages coming,.

    I grap message object and want to analyze the body of the message to check if the message is what application you are looking for.

    Hoever, when I call Message.getBodyText (). It returns null.

    In fact, there a lot of message in the body of the message.

    is there any sweet experiencing this problem?

    What is work around?

    Thank you.

    getBodyText() will work on 4.5 If the body is 'plain text '. Otherwise, you will need to get the HTML content of the message and extract the text elements.

    See this article:

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800698/How_To _...

  • CAMERA: getSnapshot returns NULL (CURVE 8900)

    Hello

    I did and took positions... and the examples also set permissions so that I don't get exceptions...

    I see a camera in my viewField... but when I call "getSnapshot", return of the values is null... I tried setting imageType to one of those supported and also tried with null as a parameter in getSnapshot...

    My support for 8900Curve formats are:

    Encoding = rgb565

    Encoding = jpeg & width = 2048 & height = 1536 & quality Super fine =

    Encoding = jpeg & width = 2048 & height = 1536 & quality = normal

    Encoding = jpeg & width = 2048 & height = 1536 & quality = very good

    Encoding = jpeg & width = 1024 & height = 768 & quality = normal

    Encoding = jpeg & width = 1024 & height = 768 & quality = very good

    Encoding = jpeg & width = 1024 & height = 768 & quality Super fine =

    Encoding = jpeg & width = 480 & height = 360 & quality = normal

    Encoding = jpeg & width = 480 & height = 360 & quality = very good

    Encoding = jpeg & width = 480 & height = 360 & quality Super fine =

    My code is below...

    Reader = Manager.createPlayer ("capture://video");

    Player.Realize ();

    Player.Start ();

    VC = player.getControl ("VideoControl") (alarm);

    Viewfinder field (Field) = vc.initDisplayMode (VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field"); this.add (viewfinder);

    String imageType = "encoding = jpeg & width = 480 & height = 360 & quality = normal;

    byte [] imageBytes = (imageType) vc.getSnapshot;

     

    if (imageBytes! =null)

    {

    Image bitmap = Bitmap.createBitmapFromBytes (imageBytes, 0, imageBytes.length, 5);

    ...

    ...

    }

    Thank you.

    Kris

    Two issues I see when we compare your code with mine, who works on a Curve 8900.

    (a) my player.start is that I added the field to the screen.

    (b) my getSnapshot is done on a screen (actually a button click) event, while I am sure that the screen was displayed and the viewfinder is visible.

    I also had real problems with this code on the curve.   You might find this Thread helpful reviews.

    http://supportforums.BlackBerry.com/Rim/Board/message?board.ID=java_dev&message.ID=27454

  • Hash table returns null

    It's the stumping me. I add a key and a value in a hash table, pass in the key and retrieve the value. Basic enough, but when I go to retrieve the value a second time (after the restart of the application), it returns null.

    If it isn't exactly the code that would be the basic scheme:

    class A
    {
         private static Hashtable table = new Hashtable();
    
         public static Object getObject(Class clazz)
         }
              return A.table.get(clazz);
         }
    
         public static void setObject(Class clazz, Object obj)
         }
              A.table.put(clazz, obj);
         }
    
         //Code stuff...
    }
    
    class B
    {
         public static void main(String[] args)
         {
              A.setObject(C.class, new C());
              Object obj = A.getObject(C.class); //This works
         }
    
         //Code stuff...
    }
    
    class C
    {
         //Code stuff...
    }
    

    What happens on the 9550 Simulator and is fixed after restarting the Simulator but work always and only the first time through. If the app is closed, then reopened, then it returns null, even if the hash table was always the same items.

    Ah. When you run the application a second time, he rebuilt serializers to persistent store. Unfortunately, your objects of the class are new instances, so that they cannot be used as persistent hash keys. I suggest you use class names as keys rather than objects of class themselves.

Maybe you are looking for