Results 1 to 4 of 4

Thread: jee:jndi-lookup error: no declaration can be found for element 'jee:jndi-lookup'

  1. #1
    Join Date
    Jul 2010
    Posts
    18

    Default jee:jndi-lookup error: no declaration can be found for element 'jee:jndi-lookup'

    Hi,

    When I'm trying to obtain remote reference to EJB usind JNDI or remote-slsb the following error occurs:

    Code:
    Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 19 in XML document from class path resource [pl/edu/uj/spring/ejb/remote/context.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'jee:jndi-lookup'.
    Here is code (very simple):
    Code:
    package pl.edu.uj.spring.ejb.remote;
    
    import javax.ejb.Stateless;
    
    @Stateless
    public class MyBean implements MyRemoteBean {
        public String getSomeString() {
            return "SOME STRING";
        }
    }
    Code:
    package pl.edu.uj.spring.ejb.remote;
    
    import javax.ejb.Remote;
    
    @Remote
    public interface MyRemoteBean {
        String getSomeString();
    }
    Code:
    package pl.edu.uj.spring.ejb.remote;
    
    public class MySpringComponent {
        private MyRemoteBean myBeanRemoteReference;
    
        public void setMyBeanRemoteReference(MyRemoteBean bean) {
            this.myBeanRemoteReference = bean;
        }
    
        public String service() {
            return myBeanRemoteReference.getSomeString();
        }
    }
    Code:
    package pl.edu.uj.spring.ejb.remote;
    
    import org.springframework.context.ApplicationContext;
    import org.springframework.context.support.ClassPathXmlApplicationContext;
    
    public class SpringApplication {
        public static void main(String[] args) {
            ApplicationContext ctx = new ClassPathXmlApplicationContext("pl/edu/uj/spring/ejb/remote/context.xml");
            MySpringComponent component = ctx.getBean("mySpringComponent", MySpringComponent.class);
            System.out.println(component.service());
    
        }
    }
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:context="http://www.springframework.org/schema/context"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:tool="http://www.springframework.org/schema/tool/"
           xmlns:jee="http://www.springframework.org/schema/jee"
           xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                               http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
    
        <!-- remote-slsb also doesn't work. the same exception :(
        org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict,
        but no declaration can be found for element 'jee:remote-slsb'
    
        <jee:remote-slsb id="myStatelessRemoteBean" jndi-name="MyBean/remote"
                        business-interface="pl.edu.uj.spring.ejb.remote.MyRemoteBean"/>
    
        -->
        
        <jee:jndi-lookup id="myStatelessRemoteBean" jndi-name="MyBean/remote"/>
    
        <bean id="myComponent" class="pl.edu.uj.spring.ejb.remote.MySpringComponent">
            <property name="myBeanRemoteReference">
                <ref local="myStatelessRemoteBean"/>
            </property>
        </bean>
    
    </beans>

    I'm using the lates version of Spring framework (3.0.3) and (if it has any impact) IntelliJ IDEA. What I did wrong?
    Thanks in advance!

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,629

    Default

    The exception is pretty clear imho... YOu don't have a declaration for the jee namespace...

    The only 2 namespaces which are correctly defined are the beans and context namespace.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Jul 2010
    Posts
    18

    Default

    Shame on me...
    Thank you very much. Here is working version for other newbies
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"      
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:jee="http://www.springframework.org/schema/jee"
           xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                               http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
                               ">

  4. #4

    Default

    Thanks, i was struggling from hours !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •