@EJB annotation doesn't work

Hello all,
I'm new to EJB3. I use the annotation @EJB for my private fields in my stateless beans.
Could someone tell me in which cases this annotation wouldn't work?
Actually I use it in many places, but in one place it doesn't work and the declared object is null... and I don't really understand why...
many thanks.

Hello, and thanks for your answer.
ok,
so here is where I try to call my EJB:
package servicesFacades;
import java.util.Collection;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.naming.InitialContext;
import services.cyberProcedureServices.CpaManifInterface;
import util.exception.ManifException;
import models.beans.File;
import models.objects.CpaManifBean;
@Stateless
public class BdCitizenServicesImpl implements BdCitizenServices {
     // All the services this class provides pass through this cyber procedure manager.
     //@EJB
     private CpaManifInterface cpaEventManager;
     public Collection<CpaManifBean> getEventsCp(String userName)
          System.out.println("YOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO, on est dans citizenServices Man!");
          getEventManager();
          try{
          return cpaEventManager.getListeCpaManifParCitoyen(userName);
          }catch (Exception ex){
               System.out.println("Exception saisie dans citizenService" + ex);
               return null;
     }and here is my EJB declaration:
package services.cyberProcedureServices;
import java.util.*;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.jms.*;
import javax.jms.Queue;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.acegisecurity.context.SecurityContextHolder;
import org.acegisecurity.userdetails.UserDetails;
import dao.cyberProcedure.CyberProcedureDao;
import dao.event.EventDao;
import services.MnfSgdiInterface;
import services.messageServices.MnfMessageCpaInterface;
import services.payementServices.MnfPaymentInterface;
import services.payementServices.MnfPaymentManager;
import services.streetsClosingServices.MnfFermetureRueInterface;
import services.streetsClosingServices.MnfFermetureRueManager;
import services.eventServices.MnfManifestationInterface;
import services.fireWorksServices.MnfFeuArtificeInterface;
import services.fireWorksServices.MnfFeuArtificeManager;
import services.personsServices.MnfPersonneInterface;
import models.*;
import models.beans.*;
import models.objects.*;
import util.exception.ManifException;
@Stateless
//@SecurityDomain("manif")
public class CpaManifManager implements CpaManifInterface {
//     @EJB
//     private MnfPersonneManager personneMgr;
     @PersistenceContext
     protected EntityManager em;
     @EJB
     private CyberProcedureDao cpDao;
     // used to get the role
     //@EJB private SessionContext ctx;
....

Similar Messages

  • Inject DataSouce with Annotation doesn't work.

    Here we are going to add this in ejb-jar.xml, for injecting the datasource.
    <resource-ref>
    <description>Primary database</description>
    <res-ref-name>jdbc/mmserver-ds</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    <injection-target>
    <injection-target-class>
    com.gemalto.mmserver.sdmc.services.impl.segmentation.SmartDonglesFleetPersistenceServiceBean
    </injection-target-class>
    <injection-target-name>sdmcDataSource</injection-target-name>
    </injection-target>
    </resource-ref>But, a very strange problem is, in the source code, if I wrote in this way:
    @Resource
    private javax.sql.DataSource sdmcDataSource;
    It does NOT work! I really can not understand. Maybe a bug of Sun application server.
    If I wrote in this way:
    private javax.sql.DataSource sdmcDataSource;
    (Remove the annotation @Resource)
    It works fine!
    In specification, it says, when Annotation coexist with deployment description file, the one defined in description file should take effect. Why does this happen when inject resource; at the same time, this problem doesn't happen when we try to inject env-entry.
    Could anyone explain this?

    A dependency declared via annotation and a dependency in ejb-jar.xml are associated by their component environment name. Each environment annotation has a name() attribute. That name() attribute corresponds to the res-ref-name of resource-ref. If they match, they are considered the "same" dependency. If not, they are different.
    If no name() attribute is specified on @Resource it defaults to <fully-qualified-declaring-class-name>/field. The simplest thing to do in your case is just use @Resource(name=jdbc/mmserver-ds) to make sure it matches your existing ejb-jar.xml

  • EJB annotation does not work but lookup does

    Hello, I am developing an application which has two modules: an EJB module and a WEB module. As I am using EJB 3 I would like to call the EJBs from the web module using the @EJB annotation.
    For example:
        @EJB(name = "GestioDeLlocsEJB")
        private GestioDeLlocsRemote gestioDeLlocs;
        public Collection<Lloc> getLlocs() {
            return gestioDeLlocs.findAllLlocs();
        }The problem is that the JEE container injects a null in the Remote interface ( gestioDeLlocs ) so it seems to fail when trying to match the name and the JNDI reference.
    I have added the following lines in sun-web.xml:
      <ejb-ref>
        <ejb-ref-name>GestioDeLlocsEJB</ejb-ref-name>
        <jndi-name>es.ajuntament.palma.drogues.servei.GestioDeLlocsRemote</jndi-name>
      </ejb-ref>And I have added some lines in web.xml too:
       <ejb-ref>
            <ejb-ref-name>GestioDeLlocsEJB</ejb-ref-name>
            <ejb-ref-type>Session</ejb-ref-type>
            <remote>es.ajuntament.palma.drogues.servei.GestioDeLlocsRemote</remote>
        </ejb-ref>I can test the EJBs by using the traditional lookup method:
    Context c = new InitialContext();
    return (GestioDeLlocsRemote) c.lookup("es.ajuntament.palma.drogues.servei.GestioDeLlocsRemote");But I would like to use the @EJB annotation which seems not to work.
    What am I doing wrong?

    What kind of class are you putting the annotation on? Only certain managed classes like servlet classes,
    JSF managed beans, etc. support Java EE environment annotations. If it's a plain POJO the annotations
    will be ignored.

  • WEB DYNPRO AND WEB SERVICE MODEL: ejb remove doesn't work

    Hi guru,
    this is my scenario:
    J2EE-7.00 SP14-> PORTAL ->7 sp14  ->WEB DYNPRO FOR JAVA ->Web Service Model ->  WS Custom with MDM API JAVA
    The my WS is a Stateless Session Bean and i have this code:
         public void ejbCreate() throws CreateException {
              loc.setMinimumSeverity(Severity.INFO);
              loc.addLog(new ConsoleLog());
              this.plug = (MdmPlug) new MdmPlug(true);
              try {
                   this.loadProperties();
                   this.plug.connect(
                        hostname,
                        repository,
                        language,
                        username,
                        password);
                   loc.fatalT(msgLog+"[ ejbCreate ] START....");
              } catch (Exception e) {
                   if (e.getMessage()!=null)this.error=e.getMessage();
                   loc.fatalT(msgLog, this.error);
    public void ejbRemove() {
              try {
                   loc.fatalT(msgLog+"[ ejbRemove ] STOP....");
                   this.plug.close();
                   loc.fatalT(msgLog+"[ ejbRemove ] ...OK");
              } catch (ControlException e) {
                   loc.fatalT(msgLog+"[ ejbRemove ] ...K O !!!!");
    The my problem is:
    When open the IE and open my WD  the new EJB's instance is created (I see my log +"[ ejbCreate ] START....in LOG VIEWER).
    But, when I do log-off or I close IE, I don't see "[ ejbRemove ] STOP...." in LOG.
    Result:
    I open the MDM connection but not close it.
    Where is the problem?
    In Web Dynpro?
    In Web services?
    I have to create another WS's type?

    Hi Max,
    You can't run an EJBControl from a simple java class using either @Control or programmatic instantiation.
    The EJBControl implementation relies on Resource Context events so it "needs" a container context to run.
    You can use the ControlTestCase to unit test an EJB via EJB Control. You will need to configure the JNDIContextEnv annotation to bind to the server where the EJB is deployed. Note that this only works with EJBs that have a remote interface and a global JNDI name.
    The test case would look something like this (I've seen this example run as long as the JUnit classpath includes weblogic.jar)
    public class SimpleClient extends ControlTestCase {
    public void setUp() throws Exception { super.setUp(); }
    public void tearDown() throws Exception { super.tearDown(); }
    @Control
    @EchoEjbControl.JNDIContextEnv(
    contextFactory="weblogic.jndi.WLInitialContextFactory",
    providerURL="t3://localhost:7001",
    principal="weblogic",
    credentials="weblogic"
    public EchoEjbControl echoEjb;
    public void testXXX() {} // ... test methods that reference echoEjb
    Thanks
    Vimala

  • Round Robin doesn't work in Bea Weblogic Cluster

    hello!
              we are using a weblogic (V5.1 SP8) cluster in the following configuration:
              2 Weblogic App-Servers as Servlet Containers.
              4 Weblogic App-Servers as EJB Containers.
              if a client connects to the first servlet - server, round robin between the
              4 EJB-servers behind doesn't work. It seems that the servlet-server is
              pinned to one EJB-server all the time.
              If we kill the second servlet-server as from now on round robin works in the
              EJB-server cluster like we expected.
              As we changed this configuration and also use an IPlanet webserver (one
              instance) with the weblogic proxy-plugin which connects to the
              servlet-cluster (2 instances)... round robin is working properly in the
              EJB-server cluster when the client connects to the IPlanet-server....
              what is the problem, why doesn't round robin work in the first
              configuration? any suggestions?
              Torsten Jenkner
              

    Okay, is it that the round-robining is not perfect (i.e., it doesn't send the
              first request to server1 and the second request to server2 and so on) or is it
              sending every request to one server?
              Torsten Jenkner wrote:
              > yes exactly Robert that's it!
              >
              > Torsten
              >
              > "Robert Patrick" <[email protected]> schrieb im Newsbeitrag
              > news:[email protected]...
              > > I don't understand this. Are you saying that with servlet node 1 or
              > servlet
              > > node 2 running by themselves that RR works fine but once you start both
              > > together, it does not?
              > >
              > > This sounds like a case for support...
              > > Robert
              > >
              > > Torsten Jenkner wrote:
              > >
              > > > > > it is always the same stub in our case. Also the round robin in the
              > EJB
              > > > > > cluster does with the same java classes but does not if the servlet
              > > > cluster
              > > > > > consits of two nodes. So it seems to be a configuration problem, but
              > > > which
              > > > > > one?
              > > > >
              > > > > Hmm.... I don't quite understand this last statement about the EJB
              > and
              > > > servlet
              > > > > cluster, could you explain a little more?
              > > > >
              > > > > Thanks,
              > > > > Robert
              > > > >
              > > >
              > > > if you use 2 servlet cluster nodes round robin between the
              > servlet-cluster
              > > > and the ejb-cluster doesn't work. if i kill the second servlet-node it
              > works
              > > > fine. so my thought was it has to be a configuration problem, because RR
              > > > does with one servlet-node. ok?
              > > >
              > > > Torsten Jenkner
              > >
              

  • How to I set an internal link in a PDF document using Preview?  After setting a link under the Tools/Annotations menu, the link doesn't work and no detailed instructions are provided.

    How to I set an internal link in a PDF document using Preview?  After setting a link under the Tools/Annotations menu, the link doesn't work and no detailed instructions are provided via the Help menu other than it showing the pull-down menu selection to make.

    No.  I am able to use the other features such as underlining, highlighting, adding rectangles and oval and save those changes.

  • Annotating pdf documents in Preview - the text search feature doesn't work?

    Hi everyone,
    I'd like to annotate my pdf documents using preview. However, I realized the other day that as soon as I start annotating a document (with notes, shapes, highlighting, etc), the preview text search doesn't work anymore.
    Thanks for any help or advice!

    This is a known problem. I have seen one suggestion to print the annotated PDF as a new PDF in order to get search capability back. You can try the Apple Discussions "search" feature at the upper right corner to look for more suggestions.

  • Finding XML file from EJB doesn t work.

    Hi all:
    I have an EJB accesing a XML file to parse a XML document. The file is in the classpath, and sometimes the EJB finds it and sometimes not.
    What happens?
    When the EJB finds it, DOMParser method, parse(InputStream), doesn t work.
    I use this file to config DB connection externally for my BC4J (I don t use JTS).
    Thanks in advance.
    Joaqumn.

    Well, it won't work as iWeb has no import facility so cannot open html files.
    What you could do is upload the html file to wherever you are hosting your site and create a link to it from iWeb, or find another package similar to the one you are using at present that is for Mac rather then PC.

  • @EJB annotation in JSF managed beans not working

    Hi all,
    I've been trying to get the @EJB annotation to work in a JSF manged bean without success.
    The EJB interface is extremely simple:
    package model;
    import javax.ejb.Local;
    @Local
    public interface myEJBLocal {
    String getHelloWorld();
    void setHelloWorld(String helloWorld);
    and the bean code is simply:
    package model;
    import javax.ejb.Stateless;
    @Stateless
    public class myEJBBean implements myEJBLocal {
    public String helloWorld;
    public myEJBBean() {
    setHelloWorld("Hello World from myEJBBean!");
    public String getHelloWorld() {
    return helloWorld;
    public void setHelloWorld(String helloWorld) {
    this.helloWorld = helloWorld;
    When I try to use the above EJB in a managed bean, I only get a NullPointerException when oc4j tries to instantiate my managed bean. The managed bean looks like:
    package view.backing;
    import javax.ejb.EJB;
    import model.myEJBLocal;
    import model.myEJBBean;
    public class Hello {
    @EJB
    private static myEJBLocal myBean;
    private String helloWorld;
    private String helloWorldFromBean;
    public Hello() {
    helloWorld = "Hello from view.backing.Hello!";
    helloWorldFromBean = myBean.getHelloWorld();
    public String getHelloWorld() {
    return helloWorld;
    public void setHelloWorld(String helloWorld) {
    this.helloWorld = helloWorld;
    public String getHelloWorldFromBean() {
    return helloWorldFromBean;
    Am I missing something fundamentally here? Aren't you supposed to be able to use an EJB from a JSF managed bean?
    Thanks,
    Erik

    Well, the more I research this issue, the more confused I get. There have been a couple of threads discussing this already, and in this one Debu Panda states that:
    "Support of injection in JSF managed bean is part of JSF 1.1 and OC4J 10.1.3.1 does not support JSF 1.1"
    10.1.3.1 Looking up a session EJB with DI from the Web tier
    But if you look in the release notes for Oracle Application Server 10g R3, it is explicitly stated that JSF 1.1. is supported. So I'm not sure what to believe.
    I've also tried changing the version in web.xml as described here:
    http://forums.java.net/jive/thread.jspa?threadID=2117
    but that didn't help either.
    I've filed a SR on Metalink for this, but haven't got any response yet.
    Regards,
    Erik

  • @EJB annotation in entity bean does not work

    I just started with ejb3. I have created a couple of beans. One session bean that looks like this:
    @Stateless
    public class MySessionBean implements MySession
         @Resource(name="jdbc/mydb")
         private DataSource myDB;
    public void someMethod() {
    myDB.getConnection()
    This works great. The other bean is an entity bean, and there the resource injection doesn't work. It looks like this:
    @Entity
    public class MyEntityBean
    @Resource(name="jdbc/mydb")
         private DataSource myDB;
    public void someMethod() {
    myDB.getConnection()
    Is resource injection any different in an entity bean then in a session bean? Both beans belong to the same package and are in the same application, (ear). I have exactly the same problem with @EJB injection: it works fine in the session bean but not in the entity bean...
    Any help is appreciated...
    John

    <code>
    @Entity
    @Table(name = "assetfault")
    @NamedQueries( {@NamedQuery(name = ... )})
    public class Assetfault implements Serializable {
    @javax.ejb.EJB private com.novadent.data.assetmg.sessionbeans.AssetFacadeLocal aF;
    @javax.ejb.EJB private com.novadent.data.assetmg.sessionbeans.AssetfaultFacadeLocal afF;
    </code>
    importing javax.ejb.EJB ?

  • @Resource annotation does not work for XA resource?

    Okay, sounds absurd that it works for everything except XA, but that is all I have to go with for now. We are moving from EJB2.x to EJB3 and I am encountering an issue when using the @Resource annotation for an XA connection factory. See deployment exception at bottom of post.
    First, I deploy my-aqjms-jms.xml which contains two connection factories (sorry, I do not know the equivalent "pre" tag for this board so all formatting is lost):
    <weblogic-jms>
    <foreign-server name="MY-AQJMS-JMS">
    <foreign-connection-factory name="ForeignConnectionFactory-0">
    <local-jndi-name>my/jms/QCF</local-jndi-name>
    <remote-jndi-name>QueueConnectionFactory</remote-jndi-name>
    </foreign-connection-factory>
    <foreign-connection-factory name="ForeignConnectionFactory-1">
    <local-jndi-name>my/jms/XAQCF</local-jndi-name>
    <remote-jndi-name>XAQueueConnectionFactory</remote-jndi-name>
    </foreign-connection-factory>
    <initial-context-factory>oracle.jms.AQjmsInitialContextFactory</initial-context-factory>
    <jndi-property>
    </jndi-property>
    </foreign-server>
    </weblogic-jms>
    Next, I look at my ejb-jar.xml:
    <session>
    <description>My EJB</description>
    <ejb-name>MyEJB</ejb-name>
    <ejb-class>demo.MyEJB</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    <resource-ref>
    <description>connection factory</description>
    <res-ref-name>jms/myQCF</res-ref-name>
    <res-type>javax.jms.QueueConnectionFactory</res-type>
    <res-auth>Container</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
    <resource-ref>
    <res-ref-name>jms/myXAQCF</res-ref-name>
    <res-type>javax.jms.XAQueueConnectionFactory</res-type>
    <res-auth>Container</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
    </session>
    These are the resource tags I want to move into annotations. (There are matching tags in weblogic-ejb-jar.xml which map "jms/myQCF" to "my/jms/QCF" and same for XAQCF). So, I open demo.MyEJB and add the annotation for the first one:
    @Stateless(name="MyEJB")
    @Resources({
    @Resource(description="connection factory",
    name="jms/myQCF",
    type=javax.jms.QueueConnectionFactory.class,
    authenticationType=Resource.AuthenticationType.CONTAINER,
    shareable=true,
    mappedName = "my/jms/QCF"),
    I remove the resource-ref tag for "jms/myQCF" in ejb-jar and weblogic-ejb-jar.xml but keep the one for "jms/myXAQCF", re-compile, re-package, re-deploy, and test. Everything seems to work fine. So, I open demo.MyEJB and add the annotation for the second connection factory:
    @Resource(description="XA connection factory",
    name="jms/myXAQCF",
    type=javax.jms.XAQueueConnectionFactory.class,
    authenticationType=Resource.AuthenticationType.CONTAINER,
    shareable=true,
    mappedName="my/jms/XAQCF"),
    I also remove the resource-ref tag for "jms/myXAQCF" in both *ejb-jar.xml's.  But now when I try to redeploy, I get the following exception:
    [EJB:011026]The EJB container failed while creating the java:/comp/env namespace for this EJB deployment.
    weblogic.deployment.EnvironmentException: [EJB:010176]The resource-env-ref 'jms/myXAQCF' declared in the ejb-jar.xml descriptor or annotation has no JNDI name mapped to it. The resource-ref must be mapped to a JNDI name using the resource-description element of the weblogic-ejb-jar.xml descriptor or corresponding annotation.
    If I comment the XAQCF annotation it will deploy again. I have since done the same annotation replacement for jms queues and jdbc resources. However, only this one XA connection factory is giving me trouble. Is this an issue in weblogic or is there something I am missing from the annotation?
    Thanks!

    Look like a bug in Appserver. XAResourceWrapper is
    used only for debugging. May be you want to reducethe
    log level to INFO and try it.Yeah, that worked.
    But this is a bug in the app server because a switch
    in the log level shouldn't influence transaction
    behavior.Yes. There is a bug when log level in FINEST. All other log levels should be fine. Please see the bug report at
    http://developer.java.sun.com/developer/bugParade/bugs/4973434.html
    >
    The only big issue I still have is that recovery
    doesn't work. See my other message in this forum. Do
    you have a solution for this?I have asked someone who knows that area well to answer your query.
    - Binod
    >
    -- Andreas

  • EJB 3 CMP not working in JBoss

    hi,
    i created a simple CMP Entity Bean with mySQL and works fine with OC4J but when delpoy to JBoss 4.0.4RC1, it doesn't work.
    What I realised is that when a JDeveloper create a CMP Entity Bean from a Table it uses @Resource annotaion while I saw all the JBoss samples using @Persistance annotation.
    I changed my CMP to use @persistence annotation and created a persistence.xml file; for somereason it is not working neither in JBoss nor does it work in OC4J.
    Now, if i continue using @Resource annotation, where can I set the datasource so that the @Resource annotation uses my datasource when I deploy it to JBoss?
    or is there any other way to get it working?
    p/s: my datasource is working fine. i created a simple slsb and used
    DataSource ds =
    (DataSource)context.lookup(
    "java:jdbc/mysqlDS");
    and it works fine both in OC4J and JBoss
    any help is appreciated.
    thanks

    Ok, i got this working in JBoss.
    1) Replaced @Resource annotation with @Peristence annotation
    @PersistenceContext(unitName="mysql")
    2) Created persistence.xml in META-INF directory
    <persistence>
    <persistence-unit name="mysql">
    <jta-data-source>java:/jdbc/mysqlDS</jta-data-source>
    <!-- <properties>
    <property name="hibernate.hbm2ddl.auto"
    value="create-drop"/>
    </properties> -->
    </persistence-unit>
    </persistence>
    that is it.
    It means that whether we create EJB 3 on toplink EJB 3 or hibernate EJB 3, we should be able to run it on any of these as long as we stick with the standard annotations. JBoss Hibernate EJB has many additional annotations.
    Now, the only thing that is not working is my Firebird DataSource in JBoss. If anyone has done it please let me know .. thanks.

  • @postconstruct doesn't work in managed bean

    Hi,
    I'm using JBOSS 6, JSF 2 and EJB 3.1, i have an ear with
    - EJB folder (@postconstruct is working)
    - JSF folder with manged bean where @postconstruct doesn't work
    This my manged bean :
    package com.galhauban.geriex;
    import java.util.ArrayList;
    import java.util.List;
    import javax.annotation.PostConstruct;
    import javax.ejb.EJB;
    import javax.faces.bean.ManagedBean;
    import javax.faces.bean.ViewScoped;
    import javax.faces.component.UIComponent;
    import javax.faces.context.FacesContext;
    import javax.faces.event.ValueChangeEvent;
    import javax.faces.model.SelectItem;
    import javax.servlet.ServletContext;
    import org.richfaces.event.ItemChangeEvent;
    @ManagedBean
    @ViewScoped
    public class AdministrationController {
    @EJB
    private VilleBean ville;
    private List<SelectItem> villes = new ArrayList<SelectItem>();
    private String commune;
    private String communeId;
    private String cp;
    private String labelListCommune;
    @EJB
    private BisBean bisBean;
    private String bis;
    private Integer bisId;
    private List<SelectItem> bisList = new ArrayList<SelectItem>();
    @EJB
    private RueBean rueBean;
    private String rue;
    private String rueId;
    private List<SelectItem> ruesList = new ArrayList<SelectItem>();
    //boolean desactives pour n'afficher que ce que l'on souhaite a partir du menu
    private boolean bCommune =false;
    private boolean bBis =false;
    private boolean bRue =false;
    private UIComponent selectedChild = null;
    //Pour connaitre l'item du menu actif
    private String selectedTab;
    private List<String> renderComponents = new ArrayList<String>();
    public AdministrationController(){
    ServletContext servletContext = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext();
    System.out.println("============================================================================");
    System.out.println("==================================CONSTRUCTEUR==============================");
    System.out.println("Servlet : "+servletContext.getEffectiveMajorVersion()+"."+servletContext.getMinorVersion());
    System.out.println("============================================================================");
    @PostConstruct
    public void postConstruct(){
    setSelectedTab("rue");
    System.out.println("###################################################");
    System.out.println(" POST CONSTRUCT MANAGED BEAN ");
    System.out.println("###################################################");
    JanusController multi = new JanusController();
    * AFFICHAGE DES MODIFS/SUP/AJOUT EN FONCTION DU MENU SELECTIONNE
    public void updateCurrent(ItemChangeEvent event){
    setSelectedTab(event.getNewItem().getId());
    System.out.println("====> SELECTEDTAB " + selectedTab.toString());
    if (selectedTab.equals("commune")) {
    setbCommune(true);
    setbBis(false);
    setbRue(false);
    renderComponents.add("gCommune");
    else if (selectedTab.equals("bis")) {
    setbBis(true);
    setbCommune(false);
    setbRue(false);
    renderComponents.add("gBis");
    else if (selectedTab.equals("rue")) {
    setbRue(true);
    setbBis(false);
    setbCommune(false);
    renderComponents.add("gRue");
    else System.out.println("----> pas dans le if " + selectedTab.toString());
    public void ajouter(){
    System.out.println("====> AJOUTER SELECTEDTAB " + selectedTab.toString());
    if (selectedTab.equals("commune")) {
    System.out.println("ajouter commune ");
    ville.ajouter(commune, cp);
    else if (selectedTab.equals("bis")) {
    System.out.println("ajouter iBbis ");
    bisBean.ajouter(bis);
    else if (selectedTab.equals("rue")) {
    System.out.println("ajouter rue: "+commune);
    rueBean.ajouter(rue, Integer.parseInt(communeId));
    else System.out.println("----> pas dans le if de l'ajouter " + selectedTab.toString());
    public void modifier(){
    System.out.println("====> MODIFIER SELECTEDTAB " + selectedTab.toString());
    if (selectedTab.equals("commune")) {
    ville.modifier(Integer.parseInt(communeId), commune);
    else if (selectedTab.equals("bis")) {
    bisBean.modifier(bisId, bis);
    else if (selectedTab.equals("rue")) {
    rueBean.ajouter(rue, Integer.parseInt(communeId));
    else System.out.println("----> pas dans le if de modifier " + selectedTab.toString());
    public void supprimer(){
    System.out.println("====> SUPRIMER SELECTEDTAB " + selectedTab.toString());
    if (selectedTab.equals("commune")) {
    System.out.println("ajouter commune ");
    ville.ajouter(commune, cp);
    else if (selectedTab.equals("bis")) {
    System.out.println("supprimer iBbis ");
    bisBean.supprimer(bisId);
    else if (selectedTab.equals("rue")) {
    System.out.println("ajouter rue: "+commune);
    rueBean.ajouter(rue, villes.indexOf(ville));
    else System.out.println("----> pas dans le if de l'ajouter " + selectedTab.toString());
    * LISTENER
    public void selectListener(ValueChangeEvent vce){
    System.out.println("new value : "+vce.getNewValue());
    public void listAdminCommune(ValueChangeEvent vce){
    System.out.println("listener*************");
    ruesList.clear();
    ruesList = rueBean.listRue(Integer.parseInt(vce.getNewValue().toString()));
    * AUTRES FONCTIONS
    public boolean invbool(boolean vrai){
    if (vrai == true) return false;
    else return true;
    * GETTER AND SETTER
    Any help will be highly appreciated.
    Regards
    Couse1

    Hi,
    First of all thanks for your help.
    I've some problems to add a new mojarra version (2.1.2) to jboss 6
    1- I modified the file META-INF\jsf-integration-deployer-jboss-beans.xml
    <entry>
              <key>Mojarra-2.1.2</key>
              <value>${jboss.server.home.url}deployers/jsf.deployer/Mojarra-2.1.2</value>
    </entry>
    <bean name="JSFUrlIntegrationDeployer-212" class="org.jboss.jsf.deployer.JSFUrlIntegrationDeployer">
        <property name="JSFConfigName">
          <value>Mojarra-2.1.2</value>
        </property>
        <property name="JSFImplManagementDeployer">
          <inject bean="JSFImplManagementDeployer"/>
        </property>
      </bean>2- I added this code in my web.xml(war)
    <context-param> 
            <param-name>org.jboss.jbossfaces.JSF_CONFIG_NAME</param-name> 
            <param-value>Mojarra-2.1.2</param-value> 
          </context-param>3- And in the folder ...\deployers\jsf.deployer\Mojarra-2.1.2, i've got :
    - jsf-libs with jars
    - META-INF with web.xml
    I took the web.xml from Mojarra-2.0 :
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
       version="2.5">
       <!-- ======================== Introduction ============================== -->
       <!-- This document defines default values for the Mojarra-2.0 JSF config  -->
       <!--                                                                      -->
       <!-- WARNING:  Do not configure application-specific resources here!      -->
       <!-- They should go in the "/WEB-INF/web.xml" file in your application.   -->
       <!-- =========== Common Context Params ================================== -->
       <!-- Regular expression to determine if two different URLs actually point -->
       <!-- to the same jar file.  This keeps faces-config files from being      -->
       <!-- read twice.                                                          -->
       <context-param>
         <param-name>com.sun.faces.duplicateJARPattern</param-name>
         <param-value>^tmp\d+(\S*\.jar)</param-value>
       </context-param>
       <!-- JBossInjectionProvider provides resource injection for managed beans. -->
       <!-- See JSF 1.2 spec section 5.4 for details.                             -->
       <context-param>
         <param-name>com.sun.faces.injectionProvider</param-name>
         <param-value>org.jboss.web.jsf.integration.injection.JBossDelegatingInjectionProvider</param-value>
       </context-param>
       <!-- ================== Common filter Configuration ==================== -->
       <!-- ================== Common Listener Configuration ==================== -->
       <!-- Configures JSF 2.0 -->
       <listener>
         <listener-class>org.jboss.web.jsf.integration.config.JBossMojarra20ConfigureListener</listener-class>
       </listener>
    </web-app>And of course i've got this error :
    org.jboss.web.jsf.integration.config.JBossMojarra20ConfigureListener: java.lang.ClassNotFoundException: org.jboss.web.jsf.integration.config.JBossMojarra20ConfigureListener
    I don't know where to find the listener-class, and in fact i don't know to configure this web.xml.
    Help or sugestion will be appreciated.
    Best regards
    couse1

  • Web Service @EJB injection isn't working

    I'm running WebLogic Server 10.0 MP1
    I have a local interface:
    @Local
    public interface Login {
         boolean loginUser( String username, String password );
    }And an implementation:
    @Stateless
    @Local
    public class LoginBean implements Login {
         public boolean loginUser(String username, String password) {
              if (username != null && password != null && username.equals("test")
                        && password.equals("password")) {
                   return true;
              return false;
    }Those are bundled up in service.jar
    I also have a Web Service:
    @Stateless
    @WebService(name = "LoginService", targetNamespace = "http://my.namespace/here")
    @WLHttpTransport(contextPath = "services", serviceUri = "LoginService")
    public class LoginService {
         @EJB(name="bLogin")
         private Login login;
         @WebMethod
         public boolean login(String username, String password) {
              return login.loginUser(username, password);
    }The webservice is bundled into LoginService.war by the jswc ant task.
    LoginService.war and services.jar are together bundled into my .ear file with an appropriate application.xml, and the web console shows both the web service and EJB as being deployed with the EAR.
    When I access the LoginService, I always get a NullPointerException on the return login.loginUser() line (and a println indicates that in fact login is null).
    So WebLogic isn't injecting my bean into the login variable, however there are no warnings or errors on the console.
    I have seen http://forums.bea.com/thread.jspa?threadID=300003881 but that doesn't help, as my web.xml is generated by jswc and I verified that it always sets the version to 2.5 and namespace properly.
    One other interesting tidbit: If I set beanName to something crazy (like "foo") on the @EJB annotation in LoginService, I DO get an error (at deployment time) in the server log saying that the ejb-link for 'foo' wasn't found. So the lookup appears to be happening (though there is nothing about an ejb-link in the web.xml, I expect that it is implicitly happening at deploy time from the @EJB annotation) just not the actual injection.
    Thoughts?

    Since it looks like no one from BEA actually monitors these forums, I'll answer my own question.
    I no longer use the jswc ant task to generate LoginService.war. Now, I just drop my Login web service into its own jar file (apparently it doesn't work if it's in a JAR with other EJBs), say, ws.jar and put that into the EAR with everything else, and it works. Here is my web service now (called LoginImpl)
    @WebService(name = "Login", targetNamespace = MY_NAMESPACE)
    @SOAPBinding(style = Style.DOCUMENT, use = Use.LITERAL, parameterStyle = ParameterStyle.WRAPPED)
    @WLHttpTransport(contextPath = "services", serviceUri = "LoginService")
    @Stateless
    public class LoginImpl {
         @EJB(name = "Login")
         private Login login;
         @WebMethod(operationName="LoginRequest")
         @WebResult(name = "LoginResponse")
         public boolean login(
              @WebParam(name = "Username", targetNamespace = MY_NAMESPACE) String username,
              @WebParam(name = "Password", targetNamespace = MY_NAMESPACE) String password
              return login.loginUser( username, password );
         @WebMethod(operationName="LogoutRequest")
         @WebResult(name="LogoutResponse")
         public void logout( @WebParam(name = "SessionToken", targetNamespace = MY_NAMESPACE) String sessionToken ) {
              login.logoutUser( sessionToken );
    }So in summary:
    * Put @WebService files in their own JAR
    * Don't use jswc
    I also used Sun's JAX-WS reference implementation to generate the *.jaxwx.* files, otherwise WebLogic complains

  • Please help: Application doesn't work after upgrade to Workshop 8 sp2 from sp1

    Hi,
    Our application worked on workshop 8 sp1. After we upgrade system from sp1 to
    sp2, some of the part doesn't work propertly any more.
    1. netui:select seems not bind form data propertly. For drop down list box in
    forms, although user has chosen something from the drop down list box, the returned
    value in the form is always null.
    2. we use Java script window.open(url,...) to download and view files. After upgrade
    from sp1 to sp2, clients keep getting IE error complaining that "Internet Explore
    can not open this Internet site. The request site is either unavailable or can
    not be found. Please try again later", although the server and the files are all
    in local host server.
    Please help. Thanks

    Did you update your workshop application files and recompile your application?
    A few things changed between GA and sp2, some annotations were renamed, and some
    were added.
    If you open up your application in Workshop sp2, it should given you the option
    to upgrade your application.
    Failing that, you may need to go through the code that is not performing as it
    was before and check whether it was not utilising a bug that was fixed in sp2
    and thus causes it to not function correctly now.
    "Cynthia" <[email protected]> wrote:
    >
    Hi,
    Our application worked on workshop 8 sp1. After we upgrade system from
    sp1 to
    sp2, some of the part doesn't work propertly any more.
    1. netui:select seems not bind form data propertly. For drop down list
    box in
    forms, although user has chosen something from the drop down list box,
    the returned
    value in the form is always null.
    2. we use Java script window.open(url,...) to download and view files.
    After upgrade
    from sp1 to sp2, clients keep getting IE error complaining that "Internet
    Explore
    can not open this Internet site. The request site is either unavailable
    or can
    not be found. Please try again later", although the server and the files
    are all
    in local host server.
    Please help. Thanks

Maybe you are looking for