JSF 2.0 Resource injection for @ApplicationScoped ManagedBean. Problem.

Hi, guys. I've got two ManagedBeans with @ApplicationScoped
@ManagedBean(name = "config", eager=true)
@ApplicationScoped
public class Config {
and
@ManagedBean(name = "server")
@ApplicationScoped
public class Server {
@ManagedProperty(value = "#{config}")
private Config config;
public Config getConfig() {
return config;
public void setConfig(Config config) {
this.config = config;
public ServerNavCntrl() {
log.info("Initiated success. Config instance is " + config);
The problem is that Server initiated with NULL config value. Why is that? Is that a bug?
Using jsf 2.0.2 and glassfish 3

Mmmmm ... try it:
FacesContext fc = FacesContext.getCurrentInstance();
MyManagedBean mb = (MyManagedBean) fc.getApplication().getELResolver().getValue(fc.getELContext(), null, "mymanagedbean");
MyEJBRemote ejb = mb.getMyEJB();MyManagedBean have the EJB inyected, getMyEJB just return the instance.
Maybe work, however i'm not sure.

Similar Messages

  • JSF 2 resources folder for js and css files

    Hello,
    Could I change somehow default 'resources' folder for h:outputStylesheet and h:outputScript tags

    To see what the Widget Browser is and does, have a look here http://labs.adobe.com/technologies/spry/wb/dev_guide.html.
    This means, that anyone can create a widget which can then be used via the Widget Browser.
    It also means that the included code can be of any format including having references to files that are located elsewhere, as in your case, by Google.
    This is not a bad thing. You could alsways copy the contents of the file into a local file if you wish.
    I hope this helps.
    Ben

  • JSFWARNING: JSF1033: Resource injection is DISABLED.

    Anyone else have this problem using the JSF 1.2 implementation bundled with Weblogic 10?
    JSFWARNING: JSF1033: Resource injection is DISABLED.
    At start-up I get the warning and dependency injection doesn't work in backing-beans, etc.
    I've checked the various config files for compliance and everything seems to look good.
    Thanks.

    Well according to:
    http://e-docs.bea.com/wls/docs100/webapp/annotateservlet.html
    JSF backing-beans aren't one of the supported types.
    However according to the JEE5 spec they are.
    I guess Weblogic 10 isn't fully JEE5 compliant, even though it's passed certification. :_|

  • Resource injection in DAO?

    I use a Data Acces Object pattern in a Java EE 5 Web-Tier Application.
    The servlets (and JSP) in the front-end call a separate object that that hides the implementation of accessing data in the databases and maintains the connection to databases.
    Can I use the new Resource Injection annotations to simplify the JNDI and DataSoucce code in my DAO class?
    I have read that Resource Injection only works in Container managed objects like Servlets (but not in JSP which can be complied after deployment).
    Can you point me to a runnable sample application that uses Resource Injection to simplify the JNDI and DataSoucre code?

    Sample Application Listener
    package com.eshop.web;
    import com.eshop.biz.DBAccessor;
    import com.eshop.biz.ShoppingCart;
    import javax.persistence.EntityManagerFactory;
    import javax.persistence.PersistenceUnit;
    import javax.servlet.ServletContextListener;
    import javax.servlet.ServletContextEvent;
    import javax.servlet.http.HttpSessionListener;
    import javax.servlet.http.HttpSessionEvent;
    * @author Aliyu Musa
    * @version
    * Web application lifecycle listener.
    public class ShopListener implements ServletContextListener, HttpSessionListener {
    @PersistenceUnit(name="e-unit")
    private EntityManagerFactory emf;
    * ### Method from ServletContextListener ###
    * Called when a Web application is first ready to process requests
    * (i.e. on Web server startup and when a context is added or reloaded).
    * For example, here might be database connections established
    * and added to the servlet context attributes.
    public void contextInitialized(ServletContextEvent evt) {   
    DBAccessor db=new DBAccessor(emf);
    evt.getServletContext().setAttribute("db",db);
    * ### Method from ServletContextListener ###
    * Called when a Web application is about to be shut down
    * (i.e. on Web server shutdown or when a context is removed or reloaded).
    * Request handling will be stopped before this method is called.
    * For example, the database connections can be closed here.
    public void contextDestroyed(ServletContextEvent evt) {
    // TODO add your code here e.g.:
    Connection con = (Connection) e.getServletContext().getAttribute("con");
    try { con.close(); } catch (SQLException ignored) { } // close connection
    * ### Method from HttpSessionListener ###
    * Called when a session is created.
    public void sessionCreated(HttpSessionEvent evt) {
    ShoppingCart cart=new ShoppingCart();
    evt.getSession().setAttribute("cart",cart);
    evt.getSession().setMaxInactiveInterval(10*60*60);
    * ### Method from HttpSessionListener ###
    * Called when a session is destroyed(invalidated).
    public void sessionDestroyed(HttpSessionEvent evt) {
    evt.getSession().invalidate();
    }

  • Resource Injection Annotation

    Hey All,
    I am experiencing an issue with the @Resource Injection annotation.
    Following is attached my code from my class. QueueConnectionFactory is null.
    Wierdly enough when I copy over this code and @Resource Injection in an MDB it works fine!
    Any ideas of why this might be.
    I am using WLS 10.3.5
    @Stateless
    public class dummysFriend implements dummysFriendRemote, dummysFriendLocal{
         @Resource(name = "ConnectionFactory-0",
         mappedName = "jms/connectionFactory",
         description = "Connection Factory for WLS")
         private QueueConnectionFactory connectionFactory;
         @Resource(name = "DistributedQueue-3",
         mappedName = "jms/provisionASDLQueue",
         description = "Queue which holds tokenized ASDL(s) for provision")
    private Queue provisionASDLQueue;
    private QueueConnection queueConnection = null;
    private QueueSession queueSession = null;
    private QueueSender queueSender = null;
    public dummysFriend() {
    // TODO Auto-generated constructor stub
    @PostConstruct
    public void initialize(){
    try {
              queueConnection = connectionFactory.createQueueConnection();
              queueSession = queueConnection.createQueueSession(true,
                             Session.AUTO_ACKNOWLEDGE);
              queueSender = queueSession.createSender(provisionASDLQueue);
              MapMessage message = queueSession.createMapMessage();
         message.setString("ASDL", "123");
         message.setString("Token", "456");
         // Sending message to queue
         System.out.println("Sending Message");
         queueSender.send(message);
         // Closing connections
         queueSender.close();
         queueSession.close();
         queueConnection.close();
    } catch (JMSException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
    }

    I am experiencing an issue with the @Resource Injection annotation. Can you post what the issue is that you are seeing?
    -steve-

  • Resource Injection in Web Tier (JSP and Servlets)

    Hi All
    I was wondering whether someone will be kind enough enough to clear this up for me as it causing me some confusion. I am using OC4J 10.1.3.4 and Java 5. I have been reading the documentation on OC4J and at one point it says that OC4J does not support resource injection(i.e. annotations) in the web tier and you'll have to use JNDI to access resources such as EJBs from the Web tier(see Sub heading Servlet or JSP Client on http://download.oracle.com/docs/cd/B25221_04/web.1013/b14428/usclient.htm) but at other points in the documentation, it seems to suggest that that resource injection is supported see(http://database.in2p3.fr/doc/oracle/Oracle_Application_Server_10_Release_3/web.1013/b28221/undejbs001.htm#CIHFEJAC).
    I am just wondering what the definitive answer is. Does OC4J support resource injection in the web client(in particular, JSP) or not. BTW I am trying to inject an EJB into a JSP client. It doesn't seem to work with resource injection but works OK with JNDI.
    Thanks

    Does any one have any sort of explanation on this?

  • Resource Injection Question -to do with where main is...

    Hi, I've just been doing some jms stuff, and I've found that if I have a class which is just for main, and I send messages in a different class called from main, my resource injection doesn't occur.
    However if the main method is in the class which I send the messages from, resource injection does occur.
    Why is this?? is it something to do with the type of class or something???

    I read that thread and in the SAP library which is quoted, it says, "you can split up the whole dataset for an InfoCube into several, smaller, physically independent and redundancy-free units."
    So what is meant by physically independent in this definition? The way I've described it seems compatible, since data of similar partitions are physically seperate on the disk, though again I'm not sure if its true.
    More inputs would be appreciated... points have and will continue to be awarded.
    Edited by: Benson Wong on Mar 4, 2010 10:38 PM

  • Resource injection in tag handler

    I can't seem to find a straight answer for this anywhere. Using release 9.1 of the Sun Application Server, should resource injection in a tag handler be working? Tak something really simple like this:
    public class TestHandler extends SimpleTagSupport {
        @EJB SomeEJBLocal beanInstance;
        public void doTag() throws JspException {
    } When I try this, beanInstance is null. Is this a configuration issue or does this just not work yet?

    Found the answer myself. When the web module was being ported over, the web.xml was copied as-is. It still had version 2.4 as an attribute to the web-app element. Changing the attributes to match a newly created 2.5 version fixed the problem.

  • Hyper-V Resource Pools for Memory and CPU

    Hi all,
    I'm trying to understand the concepts and details of resource pools in Hyper-V in Windows Server 2012. It seems as if there is almost no documentation on all that. Perhaps somebody can support me here, maybe I've not seen some docs yet.
    So far, I learned that resource pools in their current implementation serve mainly for metering purposes. You can create pools per tenant and then group VM resources into those pools to facilitate resource metering per tenant. That is, you enable metering
    once per pool and get all the data necessary to bill that one customer for all their resources (without metering individual VMs). Is that correct?
    Furthermore, it seems to me that an ethernet pool goes one step further by providing an abstraction level for virtual switches. As far as I've understood you can add multiple vSwitches to a pool and then connect a VM to the pool. Hyper-V then decides which
    actual switch to use. This may be handy in a multi-host environment if vSwitches on different hosts use different names although they connect to the same network. Is that correct?
    So - talking about actually managing that stuff I've learned how to create a pool and how to add VHD locations and virtual switches to a pool. Enabling resource metering for a pool then collects usage data from all the resources inside that pool.
    But now: I can create a pool for memory and a pool for CPU. But I cannot add resources to those. Neither can I add a complete VM to a pool. Now I'm launching a VM that belongs to a customer whose resources I'm metering. How will Hyper-V know that it's
    supposed to collect data on CPU and memory usage for that VM?
    Am I missing something here? Or is pool-based metering only good for ethernet and VHD resources, and CPU and memory still need to be metered per VM?
    Thanks for clarification,
    Nils
    Nils Kaczenski
    MVP Directory Services
    Hannover, Germany

    Thank you for the links. I already knew those, and unfortunately they are not matching my question. Two of them are about Windows Server 2008/R2, and one only lists a WMI interface. What I'm after is a new feature in Windows Server 2012, and I need conceptional
    information.
    Thanks for the research anyway. I appreciate that a lot!
    In the meantime I've gotten quite far in my own research. See my entry above of January 7th. Some additions:
    In Windows Server 2012, Hyper-V resource pools are mainly for metering purposes. You cannot compare them to resource pools in VMware.
    A resource pool in Hyper-V (2012) facilitates resource metering and billing for VM usage especially in hosting scenarios. You can either measure resource usage for single VMs, or you can group existing resources (such as CPU power, RAM, virtual hard disk
    storage, Ethernet traffic) into pools. Those pools will mostly be assigned to one customer each. That way you can bill the customer for their resource usage in a given time period by just querying the customer's pool.
    Metering only collects aggregated data with one value per resource (i.e. overall CPU usage, maximum VHD storage, summed Ethernet traffic and so on). You can control the time period by explicitly resetting the counter at any given time (a day, a week, a
    month or what you like).
    There is no detailed data. The aggregate values serve as a basis for billing, not as monitoring data. If you need detailed monitoring data use Performance Monitor.
    There is currently only one type of resource pool that adds an abstraction layer to a virtualization farm, and that is the Ethernet type. You can use that type for metering, but you can also use it to group a number of virtual switches (that connect to
    the same network segment) and then a VM connected to that pool will automatically use an appropriate virtual switch from the pool. You need no longer worry about virtual switch names across multiple hosts as long as all equivalent virtual switches are
    added to the pool.
    While you can manage two types of pool resources in the GUI (VHD pools and Ethernet pools) you should only manage resource pools via PowerShell. Only there will you be able to control what happens. And only PowerShell provides a means to start, stop, and
    reset metering and query metering data.
    The process to use resource pools in Hyper-V (2012) in short:
    First create a new pool via PowerShell (New-VMResourcePool). (In case of a VHD pool you must specify the VHD storage paths to add to the pool in the moment you create the pool.)
    In case of an Ethernet pool add existing virtual switches to the pool (Add-VMSwitch).
    Reconfigure existing VMs that you want to measure so that they use resources from the pool. The PowerShell
    Set-VM* commands accept a parameter -ResourcePoolName to do that. Example:
    Set-VMMemory -VMName APP-02 -ResourcePoolName MyPool1
    Start measuring with Enable-VMResourceMetering.
    Query collected data as often as you need with Measure-VMResourcePool.
    Note that you should specify the pool resource type in the command to get reliable data (see my post above, Jan 7th).
    When a metering period (such as a week or a month) has passed, reset the counter to zero with
    Reset-VMResourceMetering.
    Hope that helps. I consider this the answer to my own question. ;)
    Here's some links I collected:
    http://itproctology.blogspot.ca/2012/12/hyper-v-resource-pool-introduction.html
    http://www.ms4u.info/2012/12/configure-ethernet-resource-pool-in.html
    http://blogs.technet.com/b/virtualization/archive/2012/08/16/introduction-to-resource-metering.aspx
    http://social.technet.microsoft.com/Forums/en-US/winserverhyperv/thread/1ce4e2b2-8fdd-4f16-8ab6-e1e1da6d07e3
    Best wishes, Nils
    Nils Kaczenski
    MVP Directory Services
    Hannover, Germany

  • RFC calls with SAP JCO and IBM resource adapter for SAP - basic tuning

    Hi experts,
    we are working on a java portal connected to a backend system SAP by calling RFCs.
    On our first integration tests, it appears to be quite slow fetching data from SAP by calling the remote functions from the custom portal. We are using SAP JCo 3.0.6 and IBM resource adapter for SAP 7.0.0.3 to integrate SAP with our portal.
    Is there any basic tuning to achieve to improve performances or any hint of where to tune in SAP ?
    Any help would be greatly appreciated.
    Thanks a lot,
    Jamal

    Hi Jamal,
    I understand you have already checked performance issues in the SAP Server. We had some problems with certain RFC calls and it turned out to be a badly developed ABAP sentence.
    I'd recommend you to use httpwatch or another tool to check the response times from the browser, so you can point accurately where the is.
    Regards
    Francisco

  • Security Right 'Resource' id for 'User Impersonation For Seller' right

    Hi,
    Can someone tell me whats the RESOURCE id for security right 'User Impersonation For Seller'?
    I need this to populate the workbook. None of the standard roles have this in E-Sourcing 5.1, so the standard workbook doesnt contain this right.
    Manually this right can be set in the security profile in drop down 'Users and sercurity'.
    Thanks & Regards,
    Srivatsan

    Hi
    RESOURCE ID for security right "user impersonation" is usermgmt.impersonation
    Regards
    Mudit Saini

  • Standard Resource files for CS4 SDK...

    Hi all,
      I'm a little new to the SDK, but am making some good progress on some plug-in work. I'm on Mac OSX Snow Leopard and using XCode 3.2.2. I would like to use the standard tool button icons used in stock Adobe products (e.g. trash can, new item, edit, etc.) , but am having trouble finding what I would consider to be a reusable resource file to include in my project. Is this not provided by the SDK or is it available elsewhere? Also would I have to DeRez it to find out what is in it?  Obviously I would like to see a well documented resource reference for the SDK, but am coming up empty. Thanks for a good forum.
    Marc

    Ian040504 if you purchased Creative Suite 4 from Adobe directly, and choose the download option at the time of purchase, then the download will be available under your account.  You can find more details at Find a download link on Adobe.com.

  • Creating Multiple Resource Objects for OOTB Connectors

    All,
    I am trying to create a second AD User resource object for the OOTB connector. I would like to think that the AD Connector (and all connectors, for that matter) was designed to handle the creation of multiple Resource Objects for the same Resource Types, but am I wrong? It doesn't seem like the OIM Connector can handle this easily.
    Has anyone created multiple resource objects for a connector? Is this a fairly simple task, or will it require a large effort? Is it even possible? Any pointers?
    Thanks!

    I will provide a little help with the duplication. I found the best way to do it is to import the original connector. Go through the different pieces making each one have a unique name, that is not part of any of the other piece names. You need to have unique names for the following:
    1. Resource Object
    2. Process Definition - Provisioning
    3. IT Resource
    4. Form - Process
    5. Scheduled Task
    After you import the connector, rename each of the following to something unique. I would also update your process form to have a default value of your IT Resource, as well as your scheduled task values to point to the new unique names. Export the 5 items, no dependecies. The adapters will all be the same. Use find and replace for the values and then import the new XML. If it works, duplicate the XML for each of the new workflows you want to create.
    -Kevin

  • Very big problem with JSF about FORM and "id=" for HTML form's elements and

    I have discovered a very big problem with JSF about FORM and "id=" for HTML form's elements and java instruction "request.getParameterNames()".
    Suppose you have something like this, to render some datas form a Java Beans :
    <h:dataTable value="#{TablesDb2Bean.myDataDb2ListSelection}" var="current" border="2" width="50%" cellpadding="2" cellspacing="2" style="text-align: center">
    <h:column>
    <f:facet name="header">
    <h:outputText value="Name"/>
    </f:facet>
    <h:outputText id="nameTableDb2" value="#{current.db2_name_table}"/>
    </h:column>
    </h:dataTable>
    Everything works fine...
    Suppose you want to get the name/value pairs for id="nameTableDb2" and #{current.db2_name_table} to process them in a servlet. Here is the HTML generated :
    <td><span <span class="attribute-name">id=<span class="attribute-value">"j_id_jsp_1715189495_22:0:nameTableDb2">my-table-db2-xxxxx</span></td>
    You think you can use the java instructions :
    Enumeration NamesParam = request.getParameterNames();
    while (NomsParam.hasMoreElements()) {
    String NameParam = (String) NamesParam.nextElement();
    out.println("<h4>"++NameParam+ "+</h4>);
    YOU ARE WRONG : request.getParameterNames() wants the syntax *name="nameTableDb2" but JSF must use id="nameTableDb2" for "<h:outputText"... So, you can't process datas in a FORM generated with JSF in a Servlet ! Perhaps I have made an error, but really, I wonder which ?
    Edited by: ungars on Jul 18, 2010 12:43 AM
    Edited by: ungars on Jul 18, 2010 12:45 AM

    While I certainly appreciate ejb's helpful responses, this thread shows up a difference in perspective between how I read the forum and how others do. Author ejb is correct in advising you to stay inside JSF for form processing if form processing is what you want to do.
    However, I detect another aspect to this post which reminds me of something Marc Andreesen once said when he was trying to get Netscape off the ground: "there's no such thing as bad HTML."
    In this case, I interpret ungar's request as a new feature request. Can I phrase it like this?
    "Wouldn't it be nice if I could render my nice form with JSF but, in certain cases, when I REALLY know what I'm doing" just post out to a separate servlet? I know that in this case I'll be missing out on all the nice validation, conversion, l10n, i18n, ajax, portlet and other features provided by JSF".
    If this is the case, because it really misses the point of JSF, we don't allow it, but we do have an issue filed for it
    https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=127
    If you can't wait for it to be fixed, you could decorate the FormRenderer to fix what you want.
    I have an example in my JSF book that shows how to do this decoration. http://bit.ly/edburnsjsf2
    Ed

  • SAP GUI 7.20 pro blem - the resource DLL for bitmaps cannot be loaded

    Hello guys,
    I am fighting the problem all day long.
    I've installed GUI for windows 7.20 , and it cannot be lauched because of the error message :
    SAP GUI 7.20 pro blem - the resource DLL for bitmaps cannot be loaded
    Maybe you know what exact dll is missing or how to repair the problem manually ?
    Thanks guys .
    Regards,
    Laimonas

    Thanks David,
    I don't see any errors in the file - these can be found by searching for '1E ' (note the space after
    the E or '2E ' .
    At the end of the logfile it shows:
    C:\Users\XXXX\AppData\Local\Temp\Temp.Sap\SAPGUI_INST_720\Sap1F6\system\sapbtmp.dll' successfully copied to 'C:\Windows\system32\SAPbtmp.dll', so it does copy the file to the destination directory sucessfully.
    I would suggest reinstalling the SAPGUI again but this time without any /package switches
    In the logfile it shows:
    NwSapSetupEngine.dll:     8.6.1.74
    We recommend that you update your installation server with the latest sapsetup patch as per
    note below:
    http://service.sap.com/sap/support/notes/1587566
    You will also require .NET4 runtime to use the latest installer files.
    run nwsapsetup again from the server and it should install again.
    Any more errors, update the nwsapsetup.log file again.
    Regards,
    Jude

Maybe you are looking for

  • Can airport express be used for all audio from my ibook?

    I want to be able to route all of my computer audio to the airport express station conected to my stereo. This would come in handy when I want to watch DVD's on my laptop in my dorm room. Airport Express   Mac OS X (10.4.4)  

  • Messages in Other languages

    Hi, I have developed a report in english..But when i execute the code..i wanted all messages to be displayed in italy. Pls help Thanks

  • Grantman - PS Elements 10 Launch

    I have PS Elements 10. When I open it to start a new design it appears on the taskbar only and does not maximize to the ful screen of the monitor. This also happens when I open a previous design as well. How do I fix this?

  • Method return problem

    Hi, please help me to see the problem I facing for my assignment. I need to do a few of non-duplicate random number and store them into an array. Then assign a KEY and search the array to get the index number of the array. I'm doing a linear search i

  • I just bought a used 1st gen iPad and I want to know if I can read books on it

    I tried to download the I book app available but it only runs with iOS 7. I have ios5. Is there an older iBook app available to download or will ios6 or 7 work?