Results 1 to 7 of 7

Thread: Simple UDP inbound server "Cannot resolve the name 'integration:adv" error

  1. #1
    Join Date
    Sep 2012
    Location
    India
    Posts
    7

    Default Simple UDP inbound server "Cannot resolve the name 'integration:adv" error

    HI,

    I want make UDP server which receives bytes data on data gram socket. My requirement is that UDP server receives byte data continuously and use it for further implementations.

    Right now i have done with this requirement in plain java code using threading. The plain java code is working for me. Plain java code of reading data gram packets as per below

    Code:
                while (RunContinuous) {
    
    /* Read the Packets */
    
                    byte[] buf = new byte[30];
                    DatagramPacket pack = new DatagramPacket(buf, 30);
                    try (DatagramSocket dgramsock = new DatagramSocket(8080)) {
                        dgramsock.setReceiveBufferSize(30);
                        dgramsock.receive(pack);
                    }
    
                    dataRecd = pack.getData();
    
                     /*  OTHER CODE GOES HERE */                
    
                    }

    So for achieve same requirement in spring i am trying spring integration UDP inbound channel adapter.

    But its not working for me, Because i must be wrong in implementation.

    My spring implementation code:

    1. spring-int.xml (Spring integration configuration xml file)

    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:p="http://www.springframework.org/schema/p"
           xmlns:aop="http://www.springframework.org/schema/aop"
           xmlns:tx="http://www.springframework.org/schema/tx"
           xmlns:mvc="http://www.springframework.org/schema/mvc"
           xmlns:context="http://www.springframework.org/schema/context"
           xmlns:task="http://www.springframework.org/schema/task"
           xmlns:int="http://www.springframework.org/schema/integration"
           xmlns:int-ip="http://www.springframework.org/schema/integration/ip"
           
           xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
           http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
           http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
           http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd
           http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
        http://www.springframework.org/schema/integration/ip http://www.springframework.org/schema/integration/ip/spring-integration-ip.xsd">
    
    
        <int:channel id="channel" />
        
        <int-ip:udp-inbound-channel-adapter id="udpIn"
                                            channel="channel"
                                            multicast="false"
                                            port="8080"/>
    	
        <int:service-activator input-channel="channel" ref="objUPDDataReader" method="printTheByetsData">
        </int:service-activator>
            
        <bean id="objUPDDataReader" class="com.a.b.thread.UDPDataReader"></bean>
            
    </beans>

    2. UDPDataReader.java (data transformer / print the byte data)
    Code:
    package com.a.b.thread;
    
    public class UDPDataReader {
        
         public void printTheByetsData(byte[] buffer) {
            String[] data = new String(buffer).split(",");
    
            for (int i = 0; i < data.length; i++) {
                String strLoopByteData = data[i];
                System.out.println("data " + i + " = " + strLoopByteData);
            }
        }
        
    }

    When i run this my SPRING MVC project it's gives me below error

    Code:
    SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
    org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 88 in XML document from ServletContext resource [/WEB-INF/spring-int.xml] is invalid; nested exception is org.xml.sax.SAXParseException; systemId: http://www.springframework.org/schema/integration/ip/spring-integration-ip.xsd; lineNumber: 88; columnNumber: 121; src-resolve: Cannot resolve the name 'integration:adviceChainType' to a(n) 'type definition' component.


    Please let me correct where things are going wrong.

    Your help is appreciable for me.

    Regards,
    Abhijit
    Last edited by abhijitaitwade; Oct 11th, 2012 at 01:48 AM.

  2. #2
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,146

    Default

    Cannot resolve the name 'integration:adviceChainType' to a(n) 'type definition' component.
    You appear to have mismatched versions of Spring Integration modules on your classpath. This element was added to the IP schema in M4, and references a type definition in the core schema. I am guessing you have spring-integration-ip version 2.2.0.M4 or 2.2.0.RC1 but your spring-integration-core is 2.2.0.M3 or earlier.

    You must always use the same versions of all Spring Integration modules.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  3. #3
    Join Date
    Sep 2012
    Location
    India
    Posts
    7

    Default

    Hi,

    Your right sir!

    I have used spring-integration-ip-2.0.0.RELEASE.jar file instead of spring-integration-ip-2.2.0.RC1.jar.

    I have update the xml schema location URLS to as per below

    "
    http://www.springframework.org/schema/integration http://www.springsource.org/schema/i...ration-2.0.xsd
    http://www.springframework.org/schema/integration/ip http://www.springsource.org/schema/i...ion-ip-2.0.xsd
    "

    Now it working for me and issue is solved.

    Thanks for this appreciable help.

  4. #4
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,146

    Default

    2.0.0.RELEASE is a VERY old release. I recommend you use the current version - 2.1.3.RELEASE.

    We also recommend removing the "-2.0" from the XSD so that the current version from the jar is always used.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  5. #5
    Join Date
    Sep 2012
    Location
    India
    Posts
    7

    Default

    Resp. sir,

    Thanks for reply and correct guidance.

    I have used the latest 2.1.3.RELEASE jar instead of 2.0.0 for spring integration.

    But i am facing with different issue. My MVC application works fine my PC connected to internet. When my PC disconnects with internet my application stops to working. Its cant deploy. Its give me below error while deploy:

    Code:
    org.xml.sax.SAXParseException; lineNumber: 14; columnNumber: 33; schema_reference.4: Failed to read schema document 'http://www.springsource.org/schema/integration/spring-integration.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
    Oct 13, 2012 11:25:43 AM org.apache.catalina.core.StandardContext startInternal
    SEVERE: Error listenerStart
    Oct 13, 2012 11:25:43 AM org.apache.catalina.core.StandardContext startInternal....
    spring-int.xml spring integration configuration file

    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:context="http://www.springframework.org/schema/context"
           xmlns:int="http://www.springframework.org/schema/integration"
           xmlns:int-ip="http://www.springframework.org/schema/integration/ip"
           
           xsi:schemaLocation="
           http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
           http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
           http://www.springframework.org/schema/integration http://www.springsource.org/schema/integration/spring-integration.xsd
           http://www.springframework.org/schema/integration/ip http://www.springsource.org/schema/integration/ip/spring-integration-ip.xsd">
        
        <int:channel id="channel" />
        
        <int-ip:udp-inbound-channel-adapter id="udpIn"
                                            channel="channel"
                                            multicast="false"
                                            port="#{objUdpManager.dataGramPortForReceiveData}"
                                            lookup-host="false"
                                            pool-size="10"
         />
    
        
        	
        <int:service-activator input-channel="channel" ref="objUdpDataRecevier" method="manageReceivedUdpBytes">
        </int:service-activator>
            
            
        <bean id="objUdpDataRecevier" class="com.a.b.c.thread.UdpDataRecevier">
            <constructor-arg index="0">
                <ref bean="objDataStatusManager"/>
            </constructor-arg>        
        </bean>
        
    </beans>
    i have tried this solution also for resolve schema download issue http://stackoverflow.com/questions/1...net-connection.


    Please help for resolve this issue.

  6. #6
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,146

    Default

    Sounds like a classpath problem - are you repackaging any of the jars?

    Spring finds the schemas on the classpath using files in META-INF; it does not get them from the internet.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  7. #7
    Join Date
    Sep 2012
    Location
    India
    Posts
    7

    Default

    Yes sir,
    Your right its classpath problem.

    i have solved it and application is now working fine.

    Once again thanks and i am appreciate for this help.

Posting Permissions

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