Announcement Announcement Module
Collapse
No announcement yet.
BeanCreationException: Error creating bean with name 'locationVO' Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • BeanCreationException: Error creating bean with name 'locationVO'

    Dear Sirs et Madames,
    Am new to spring, and I have inherited code which I want to add to. Am adding a class LocationVO, then adding the associated bean to applicationContext.xml. However, on deployment I get the following error:

    PHP Code:
       19:34:01,124 ERROR org.springframework.web.context.ContextLoader:208 Context initialization failed
        org
    .springframework.beans.factory.BeanCreationExceptionError creating bean with name 'locationVO' defined in file [C:\apache-tomcat-6.0.18\apache-tomcat-6.0.18\webapps\hdss-x\WEB-INF\classes\META-INF\spring\applicationContext.xml]: Initialization of bean failednested exception is java.lang.UnsupportedOperationExceptionOnly HttpServletRequest supported
                at org
    .springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
                
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
                
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290
    My LocationVO class looks like so:

    PHP Code:
     public class LocationVO {
        
            private 
    Location location;
            private 
    Long id;
            private 
    String extId;
            
    String locationNo;
            
    FieldWorker fieldWorker;
            
    String region;
            
    Integer district;
            
    Integer village;
            
    Integer hamlet;
            
    Calendar entryDate;
            
    DataStatus status;
            
    Long locationTypeId;
            List<
    LocationlocationList;
            
    SelectItem[] locationItems;
            
    String parentUuid;
            
    LocationCrudImpl locationCrudImpl;
        
            public 
    LocationVO() {
            }... 
    The bean declaration looks like so:

    PHP Code:
    ...
        <
    bean id="locationVO" class="is.vo.LocationVO">
           <
    property name="locationCrudImpl" ref="locationCrud" />
        </
    bean>
        ... 
    I am not sure why am getting the "Only HttpServletRequest supported" message, does anyone know what may be causing the exception?

    Thanks in advance



  • #2
    Post the whole stacktrace...

    Comment


    • #3
      Originally posted by Marten Deinum View Post
      Post the whole stacktrace...
      And the whole VO class (or at least the part relevant to the collaborator you are setting on it)

      Comment


      • #4
        And, FWIW, your VO should have a handle to the interface of your crud object, not the implementation...

        Comment


        • #5
          Hey guyus, ok here is the complete stack trace:

          PHP Code:
          19:34:01,124 ERROR org.springframework.web.context.ContextLoader:208 Context initialization failed
          org
          .springframework.beans.factory.BeanCreationExceptionError creating bean with name 'locationVO' defined in file [C:\apache-tomcat-6.0.18\apache-tomcat-6.0.18\webapps\hdss-x\WEB-INF\classes\META-INF\spring\applicationContext.xml]: Initialization of bean failednested exception is java.lang.UnsupportedOperationExceptionOnly HttpServletRequest supported
                  at org
          .springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
                  
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
                  
          at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
                  
          at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
                  
          at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
                  
          at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
                  
          at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:557)
                  
          at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:842)
                  
          at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416)
                  
          at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:261)
                  
          at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:192)
                  
          at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
                  
          at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
                  
          at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
                  
          at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
                  
          at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
                  
          at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
                  
          at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627)
                  
          at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
                  
          at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
                  
          at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
                  
          at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
                  
          at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
                  
          at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
                  
          at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
                  
          at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
                  
          at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
                  
          at org.apache.catalina.core.StandardService.start(StandardService.java:516)
                  
          at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
                  
          at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
                  
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                  
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                  
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                  
          at java.lang.reflect.Method.invoke(Method.java:597)
                  
          at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
                  
          at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
          Caused byjava.lang.UnsupportedOperationExceptionOnly HttpServletRequest supported
                  at org
          .apache.myfaces.context.servlet.ServletExternalContextImpl.checkHttpServletRequest(ServletExternalContextImpl.java:745)
                  
          at org.apache.myfaces.context.servlet.ServletExternalContextImpl.getSession(ServletExternalContextImpl.java:143)
                  
          at org.springframework.web.context.request.FacesRequestAttributes.getSessionMutex(FacesRequestAttributes.java:213)
                  
          at org.springframework.web.context.request.SessionScope.get(SessionScope.java:90)
                  
          at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
                  
          at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
                  
          at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
                  
          at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
                  
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1305)
                  
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1067)
                  
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511)
                  ... 
          35 more 
          Am putting the LocationVO code in the following message, as apparently there is a limit to how much I can submit per message...

          Comment


          • #6
            and here is the complete LocationVO:

            PHP Code:
             public class LocationVO {
                private 
            Location location;
                private 
            Long id;    
                
            String locationNo
                
            Integer district;
                
            Integer village;    
                
            Calendar entryDate;
                
            DataStatus status;
                
            Long locationTypeId;
                List<
            LocationlocationList;
                
            SelectItem[] locationItems;
                
            String parentUuid;
                
            LocationCrudImpl locationCrudImpl;

                public 
            LocationVO() {
                }
                public 
            Long getLocationTypeId() {
                    return 
            locationTypeId;
                }

                public 
            void setLocationTypeId(Long locationTypeId) {
                    
            this.locationTypeId locationTypeId;
                }

                public List<
            LocationgetLocationList() {
                    if(
            parentUuid==null){
                        
            Location loc = new Location();
                        
            loc.setParentLocation(null);
                       
            locationList locationCrudImpl.getDao().findByExample(loc);
                    }else{
                        
                        
            locationList locationCrudImpl.getDao().findListByProperty("parentLocationId"parentUuid);
                    }
                    
                    
            SelectItem item = new SelectItem("SELECT A REGION");
                    
            locationItems[0] = item;

                    if (!(
            locationList == null)) {
                        
            int i 1;
                        for (
            Location loc locationList) {
                            
            item = new SelectItem(loc.getUuid(), loc.getLocationName());
                            
            locationItems[i++] = item;
                        }
                    }

                    
            setLocationItems(locationItems);
                    return 
            locationList;
                }

                public 
            SelectItem[] getLocationItems() {
                    
            getLocationList();
                    return 
            locationItems;
                }

                public 
            void setLocationItems(SelectItem[] locationItems) {
                    
            this.locationItems locationItems;
                }

                public 
            Integer getDistrict() {
                    return 
            district;
                }

                public 
            void setDistrict(Integer district) {
                    
            this.district district;
                }

                public 
            Calendar getEntryDate() {
                    return 
            entryDate;
                }

                public 
            void setEntryDate(Calendar entryDate) {
                    
            this.entryDate entryDate;
                }

              
                public 
            Long getId() {
                    return 
            id;
                }

                public 
            void setId(Long id) {
                    
            this.id id;
                }

                public 
            LocationCrudImpl getLocationCrudImpl() {
                    return 
            locationCrudImpl;
                }

                public 
            void setLocationCrudImpl(LocationCrudImpl lci) {
                    
            this.locationCrudImpl lci;
                }

                public 
            Location getLocation() {
                    return 
            location;
                }

                public 
            void setLocation(Location location) {
                    
            this.location location;
                }

                public 
            String getLocationNo() {
                    return 
            locationNo;
                }

                public 
            void setLocationNo(String locationNo) {
                    
            this.locationNo locationNo;
                }

                public 
            DataStatus getStatus() {
                    return 
            status;
                }

                public 
            void setStatus(DataStatus status) {
                    
            this.status status;
                }

                public 
            Integer getVillage() {
                    return 
            village;
                }

                public 
            void setVillage(Integer village) {
                    
            this.village village;
                }

                public 
            void setExtId(String extId) {
                    
            this.extId MessageFormat.format("{0}{1}"regionlocationNo);
                }

                public 
            String getParentUuid() {
                    return 
            parentUuid;
                }

                public 
            void setParentUuid(String parentUuid) {
                    
            this.parentUuid parentUuid;
                }

                public 
            void create() {
                    
            location.setExtId(extId);
                    
            location.setFieldWorker(fieldWorker);
                    
            location.setId(id);
                    
            location.setLocationNo(locationNo);
                    
            location.setLocationType(getLocationType(locationTypeId));
                    
            location.setParentLocation(getParentLocation(parentUuid));
                    
            location.setRegion(region);

                    
            locationCrudImpl.setItem(location);
                    
            locationCrudImpl.create();

                }

                private 
            LocationType getLocationType(Long locationTypeId) {
                    
            LocationType locationType = new LocationTypeCrudImpl(LocationType.class).getDao().read(locationTypeId);
                    return 
            locationType;
                }

                private 
            Location getParentLocation(String parentUuid) {
                    
            Location parentLocation = (Location)locationCrudImpl.getDao().
                            
            findByProperty("uuid"parentUuid);
                    return 
            parentLocation;
                }

                
            /*
                 * To be removed, only here for testing purposes. When removed,
                 * <f:selectItems value="#{locationVO.testSelectItems}" /> in location-proto\create.xhtml should be replaced with
                 * <f:selectItems value="#{locationVO.locationItems}" />
                 */
                
            public List<LocationtestSelectItems() {

                    
            Location parentLocation = new Location();
                    
            parentLocation.setFieldWorker(new FieldWorker());
                    
            parentLocation.setId(21L);
                    
            parentLocation.setRegion("IFAKARA");
                    
            parentLocation.setLocationNo("123");
                    
            parentLocation.setPosition("east");

                    
            Location childLocation = new Location();
                    
            childLocation.setFieldWorker(new FieldWorker());
                    
            childLocation.setId(22L);
                    
            childLocation.setRegion("IFAKARA");
                    
            childLocation.setLocationNo("234");
                    
            childLocation.setPosition("west");
                    
            childLocation.setParentLocation(parentLocation);

                    
            Location childLocation1 = new Location();
                    
            childLocation1.setFieldWorker(new FieldWorker());
                    
            childLocation1.setId(23L);
                    
            childLocation1.setRegion("IFAKARA");
                    
            childLocation1.setLocationNo("345");
                    
            childLocation1.setPosition("south");
                    
            childLocation1.setParentLocation(parentLocation);


                    return 
            locationList;
                }

            PS- I HAVE tried using both the Interface AND the Implementation of the crud object, error message remains the same. Hope this helps?

            Thanks in advance

            Comment


            • #7
              What's the locationcrudimpl class look like and what does the bean definition look like in your spring config?

              Comment


              • #8
                Originally posted by chudak View Post
                What's the locationcrudimpl class look like and what does the bean definition look like in your spring config?
                Hi Chudak,
                well the locationCrudImpl is like so:

                PHP Code:
                package is.webui;

                import is.model.DataStatus;
                import is.model.Location;

                import java.util.Calendar;
                import java.util.List;
                import javax.faces.model.SelectItem;

                public class 
                LocationCrudImpl extends EntityCrudImpl<LocationLong> {

                    
                SelectItem[] locations;

                    public 
                LocationCrudImpl(Class<LocationentityClass) {
                        
                super(entityClass);
                    }

                    @
                Override
                    
                public String create() {
                        
                entityItem.setEntryDate(Calendar.getInstance());
                        
                entityItem.setStatus(DataStatus.P);
                        return 
                super.create();
                    }

                    public List<
                LocationgetChildLocations(Location location) {
                        List<
                LocationchildLocationList dao.findListByProperty("parentLocation"location);
                        return 
                childLocationList;
                    }
                    
                    public 
                SelectItem[] getLocations() {
                        return 
                getSelectItemsByProperty("parentLocation"entityItem.getParentLocation());
                    }

                    public 
                SelectItem[] getParentLocation() {
                        return 
                locations;
                    }

                    public 
                void setLocations(SelectItem[] location) {
                        
                this.locations location;
                    }

                EntityCrudImpl, which locationCrudimpl implements is like so:

                PHP Code:
                @Transactional
                public class EntityCrudImpl<TPK extends Serializable> implements
                        
                EntityCrud<TPK> {

                    static 
                Log log LogFactory.getLog(EntityCrudImpl.class);
                    
                // This is currently being used to create a new
                    // instance of the entity type
                    
                Class<TentityClass;
                    
                String outcomePrefix;
                    
                // The current entity (or "backing bean") being worked on
                    // wired from the applicationContext.xml file
                    
                T entityItem;
                    
                PagingState pager;
                    
                Dao<TPKdao;
                    List<
                TpagedItems;
                    
                // used to convert an entity from a string to object, or
                    // object to a string
                    
                EntityConverter<Tconverter;
                    
                // helper service
                    
                JsfService jsfService;

                    public 
                EntityCrudImpl(Class<TentityClass) {
                        if (
                entityClass == null) {
                            throw new 
                IllegalArgumentException(
                                    
                "entity class type required for crud");
                        }
                        if (
                log.isDebugEnabled()) {
                            
                log.debug("creating crud for class: " entityClass.getName());
                        }
                        
                this.entityClass entityClass;
                        
                this.outcomePrefix entityClass.getSimpleName().toLowerCase();
                        
                pager = new PagingState();
                    }

                    public 
                void setJsfService(JsfService jsfService) {
                        
                this.jsfService jsfService;
                    }

                    
                /*
                     * (non-Javadoc)
                     *
                     * @see is.webui.EntityCrud#setDao(is.dao.Dao)
                     */
                    
                public void setDao(Dao<TPKdao) {
                        
                this.dao dao;
                    }

                    public 
                Dao<TPKgetDao() {
                        return 
                dao;
                    }
                    
                    
                /*
                     * (non-Javadoc)
                     *
                     * @see is.webui.EntityCrud#getPager()
                     */
                    
                public PagingState getPager() {
                        if (
                pager.getTotalCount() < 0) {
                            
                pager.setTotalCount(dao.getTotalCount());
                        }
                        return 
                pager;
                    }

                    
                /**
                     * Create a new instance of the entity type
                     * @return the new object instance
                     */
                    
                protected T newInstance() {
                        try {
                            return 
                entityClass.newInstance();
                        } catch (
                Exception e) {
                            throw new 
                FacesException("failed to instantiate entity "
                                    
                entityClass.getName(), e);
                        }
                    }

                    
                /**
                     *
                     * @param resetPaging
                     */
                    
                protected void reset(boolean resetPaging) {
                        
                entityItem null;
                        
                pager.setTotalCount(-1);
                        
                pagedItems null;
                        if (
                resetPaging) {
                            
                pager.setPageIndex(0);
                        }
                    }

                    
                /*
                     * (non-Javadoc)
                     *
                     * @see is.webui.EntityCrud#listSetup()
                     */
                    
                public String listSetup() {
                        
                reset(true);
                        return 
                outcomePrefix "_list";
                    }

                    
                /**
                     *
                     */
                    
                public void validateCreate(FacesContext facesContext,
                            
                UIComponent componentObject value) {
                        
                T newItem null;
                        try {
                            
                newItem entityClass.newInstance();
                        } catch (
                Exception e) {
                            
                log.error("failed to create item instance"e);
                        }
                        
                String newItemString converter.getAsString(FacesContext.getCurrentInstance(), nullnewItem);
                        
                String itemString converter.getAsString(FacesContext.getCurrentInstance(), nullentityItem);
                        if (!
                newItemString.equals(itemString)) {
                            
                createSetup();
                        }
                    }

                    
                /*
                     * (non-Javadoc)
                     *
                     * @see is.webui.EntityCrud#createSetup()
                     */
                    
                public String createSetup() {
                        
                reset(false);
                        
                entityItem newInstance();
                        return 
                outcomePrefix "_create";
                    }

                    
                /**
                     * Persist the current entity item to the database
                     */
                    
                public String create() {
                        try {
                            
                dao.create(entityItem);
                            
                jsfService.addMessage("Item was successfully created.");
                        } catch (
                Exception e) {
                            
                jsfService.addError(e.getMessage());
                            return 
                null;
                        }
                        return 
                listSetup();
                    }

                    
                /*
                     * (non-Javadoc)
                     *
                     * @see is.webui.EntityCrud#detailSetup()
                     */
                    
                public String detailSetup() {
                        return 
                scalarSetup(outcomePrefix "_detail");
                    }

                    
                /*
                     * (non-Javadoc)
                     *
                     * @see is.webui.EntityCrud#editSetup()
                     */
                    
                public String editSetup() {
                        return 
                scalarSetup(outcomePrefix "_edit");
                    }

                    
                /**
                     * Update a persisted entity
                     */
                    
                public String edit() {
                        
                // convert the current entity item to a string
                        
                String itemString converter.getAsString(FacesContext.getCurrentInstance(), nullentityItem);
                        
                String itemId jsfService.getReqParam("itemId");
                        
                // verify the edited item is valid
                        
                if (itemString == null || itemString.length() == 0
                                
                || !itemString.equals(itemId)) {
                            
                String outcome editSetup();
                            if ((
                outcomePrefix "_edit").equals(outcome)) {
                                
                jsfService.addError("Could not edit item. Try again.");
                            }
                            return 
                outcome;
                        }
                        
                // attempt to update
                        
                try {
                            
                dao.update(entityItem);
                            
                jsfService.addMessage("Item was successfully updated.");
                        } catch (
                Exception e) {
                            
                jsfService.addError(e.getMessage());
                            return 
                null;
                        }
                        return 
                detailSetup();
                    }

                    
                /**
                     * Remove/delete an entity from persistence
                     */
                    
                public String delete() {
                        
                T persistentObject converter.getAsObject(FacesContext.getCurrentInstance(), nulljsfService.getReqParam("itemId"));
                        try {
                            
                dao.delete(persistentObject);
                            
                jsfService.addMessage("Item was successfully deleted.");
                        } catch (
                Exception e) {
                            
                jsfService.addError(e.getMessage());
                            return 
                null;
                        }
                        return 
                listSetup();
                    }

                    @
                SuppressWarnings("unchecked")
                    protected 
                String scalarSetup(String outcome) {
                        
                reset(false);
                        
                entityItem = (TjsfService.getObjViaReqParam("itemId"converternull);
                        if (
                entityItem == null) {
                            
                String itemId jsfService.getReqParam("itemId");
                            
                jsfService.addError("The item with id " itemId
                                    
                " no longer exists.");
                        }
                        return 
                outcome;
                    }

                    
                /*
                     * (non-Javadoc)
                     *
                     * @see is.webui.EntityCrud#next()
                     */
                    
                public String next() {
                        
                reset(false);
                        
                getPager().nextPage();
                        return 
                outcomePrefix "_list";
                    }

                    
                /*
                     * (non-Javadoc)
                     *
                     * @see is.webui.EntityCrud#prev()
                     */
                    
                public String prev() {
                        
                reset(false);
                        
                getPager().previousPage();
                        return 
                outcomePrefix "list";
                    }

                    
                /*
                     * (non-Javadoc)
                     *
                     * @see is.webui.EntityCrud#getItem()
                     */
                    
                public T getItem() {
                        if (
                entityItem == null) {
                            
                entityItem newInstance();
                        }
                        return 
                entityItem;
                    }

                    
                /*
                     * (non-Javadoc)
                     *
                     * @see is.webui.EntityCrud#getPagedItems()
                     */
                    
                public List<TgetPagedItems() {
                        if (
                pagedItems == null) {
                            
                pagedItems dao.findPaged(pager.getPageIncrement(), pager.getPageIndex());
                        }
                        return 
                pagedItems;
                    }

                    public 
                SelectItem[] getSelectItems() {
                        return 
                jsfService.getSelectItems(dao.findAll());
                    }
                    
                    
                /*
                     * Return SelectItem for a subset of enitities depending on the value of a
                     * property being searched on
                     */
                    
                public SelectItem[] getSelectItemsByProperty(String propertyNameObject value) {
                        return 
                jsfService.getSelectItems(dao.findListByProperty(propertyNamevalue));
                    }

                    
                /*
                     * (non-Javadoc)
                     *
                     * @see is.webui.EntityCrud#setConverter(javax.faces.convert.Converter)
                     */
                    
                public void setConverter(EntityConverter<Tconverter) {
                        
                this.converter converter;
                    }

                    
                /*
                     * (non-Javadoc)
                     *
                     * @see is.webui.EntityCrud#getConverter()
                     */
                    
                public EntityConverter<TgetConverter() {
                        return 
                converter;
                    }

                    public 
                void setItem(T entityItem) {
                        
                this.entityItem entityItem;
                    }
                    


                And the bean declaration is like so:

                PHP Code:
                ... 
                    <
                bean id="locationVO" class="is.vo.LocationVO"
                       <
                property name="locationCrudImpl" ref="locationCrud" /> 
                    </
                bean
                ... 
                Thanks, hope this helps

                Comment

                Working...
                X