Hello Gert.

Thank you very much for your help. 
Now it works fine.

Greerings.


Gert Vanthienen wrote:
> 
> L.S.,
> 
> (Replying to the user list as well so other users can find this answer)
> 
> When we moved from ServiceMix 3.2.3 to ServiceMix 3.3 we also decided
> to move the JBI components into a separate project.  At that time, we
> found out that some of the components were depending on
> container-specific code, like e.g. this Destination API.
> 
> That's  why, for ServiceMix 3.3 and higher, we have this project
> called servicemix-utils
> (http://svn.apache.org/repos/asf/servicemix/utils/) which contains the
> code that needs to be shared between container and components.  That's
> where you will find this org.apache.servicemix.jbi.api.Destination
> class now, the 'old' org.apache.servicemix.client.Destination has been
> marked deprecated.
> 
> BTW, servicemix-bean can also inject a suitable Destination instance
> if you annotate the field with @ExchangeTarget like what is done in
> http://servicemix.apache.org/dist/servicemix-3.1-incubating/site/deployables/serviceengines/servicemix-bean/xref-test/org/apache/servicemix/bean/beans/ConsumerBean.html.
> 
> Regards,
> 
> Gert Vanthienen
> ------------------------
> Open Source SOA: http://fusesource.com
> Blog: http://gertvanthienen.blogspot.com/
> 
> 
> 
> 2009/11/20 atr <[email protected]>:
>>
>> Hello.
>>
>> I have custom code for Servicemix 3.2.2 and want to change Servicemix to
>> version 3.3. Doing so I get following compilation error within a java
>> bean.
>> Does anyone can help me in this issue?
>> I have already changed the jbi-maven-plugin-version in ServiceAssemblies
>> pom.xml's the way you can watch below.
>> I don't know where the org.apache.servicemix.client.ServiceMixClient is
>> located in the new Servicemix and how the call
>> this.archive = this.client.createDestination(ARCHIVE_ENDPOINT);
>> should point to or should look like.
>>
>> Below you'll find the compilation error, the code to be compilated and
>> the
>> Maven pom.xml.
>>
>> Thank you really for help!
>>
>> Compilation error:
>> ======================================
>> ======================================
>> ======================================
>> [INFO] Compiling 2 source files to D:\Eigene
>> Dateien\MMS\Demandware\Dev\2.6.4\workspace\ESB_tenants\Sources\SM_Order\SM_Order_BeanServices\..\..\build
>> \SPSI\SM_Order_BeanServices\classes
>> [INFO]
>> ------------------------------------------------------------------------
>> [ERROR] BUILD FAILURE
>> [INFO]
>> ------------------------------------------------------------------------
>> [INFO] Compilation failure
>>
>> D:\Eigene
>> Dateien\MMS\Demandware\Dev\2.6.4\workspace\ESB_tenants\Sources\SM_Order\SM_Order_BeanServices\src\main\java\de\mmsdresden\sportscheck\beans\
>> ArchiveBean.java:[88,46] incompatible types
>> found   : org.apache.servicemix.jbi.api.Destination
>> required: org.apache.servicemix.client.Destination
>>
>>
>> Bean java code:
>> ======================================
>> ======================================
>> ======================================
>> package de.mmsdresden.sportscheck.beans;
>>
>> import java.io.FileNotFoundException;
>> import java.io.IOException;
>> import java.util.Properties;
>>
>> import javax.annotation.PostConstruct;
>> import javax.annotation.Resource;
>> import javax.jbi.component.ComponentContext;
>> import javax.jbi.messaging.DeliveryChannel;
>> import javax.jbi.messaging.ExchangeStatus;
>> import javax.jbi.messaging.InOnly;
>> import javax.jbi.messaging.MessageExchange;
>> import javax.jbi.messaging.MessagingException;
>> import javax.jbi.messaging.NormalizedMessage;
>> import javax.xml.transform.TransformerException;
>> import javax.xml.transform.stream.StreamSource;
>>
>> import org.apache.commons.logging.Log;
>> import org.apache.commons.logging.LogFactory;
>> import org.apache.servicemix.MessageExchangeListener;
>> import org.apache.servicemix.client.Destination;
>> import org.apache.servicemix.client.ServiceMixClient;
>> import org.apache.servicemix.client.ServiceMixClientFacade;
>> import org.apache.servicemix.components.util.DefaultFileMarshaler;
>>
>> import de.mmsdresden.sportscheck.utils.FileNameUtils;
>> import de.mmsdresden.sportscheck.utils.MessageExchangeCache;
>> import de.mmsdresden.sportscheck.utils.MessageExchangeCacheImpl;
>> import de.mmsdresden.sportscheck.utils.ServiceMixUtils;
>>
>> /**
>>  * @author Andreas Lutz
>>  * @since 23.07.2009
>>  */
>> public class ArchiveBean implements MessageExchangeListener {
>>
>>        /**
>>         * @see javax.jbi.messaging.DeliveryChannel
>>         */
>>       �...@resource
>>        private DeliveryChannel channel;
>>
>>        /**
>>         * @see javax.jbi.component.ComponentContext
>>         */
>>       �...@resource
>>        private ComponentContext context;
>>
>>        /**
>>         * @see org.apache.servicemix.client.ServiceMixClient
>>         */
>>        private ServiceMixClient client;
>>
>>        // Destinations to write files
>>        // ----
>>        /**
>>         * @see org.apache.servicemix.client.Destination
>>         */
>>        private Destination archive;
>>
>>        private static final String SERVICE_NAMESPACE =
>> "service:http://sportscheck.com/services/orders/";;
>>
>>        private static final String ARCHIVE_ENDPOINT = SERVICE_NAMESPACE +
>> "archive";
>>
>>        private Log log = LogFactory.getLog(this.getClass());
>>
>>        private MessageExchangeCache exchangeCache;
>>
>>        /**
>>         * This init method checks that the needed artifacts are
>> initialized
>>         *
>>         * @throws IOException
>>         * @throws FileNotFoundException
>>         * @throws MessagingException
>>         */
>>       �...@postconstruct
>>        public void init() throws FileNotFoundException, IOException,
>> MessagingException {
>>                if (this.context == null || this.channel == null) {
>>                        throw new IllegalStateException("Bean not
>> initialized");
>>                }
>>
>>                /*
>>                 * Create client to get the destination (where to send the
>> files)
>>                 */
>>                this.client = new ServiceMixClientFacade(this.context);
>>
>>                this.archive =
>> this.client.createDestination(ARCHIVE_ENDPOINT);
>>
>>                this.exchangeCache = new MessageExchangeCacheImpl();
>>        }
>>
>>        /*
>>         * (non-Javadoc)
>>         *
>>         * @see
>>         *
>> org.apache.servicemix.MessageExchangeListener#onMessageExchange(javax
>>         * .jbi.messaging.MessageExchange)
>>         */
>>        public void onMessageExchange(MessageExchange exchange) throws
>> MessagingException {
>>                this.log.debug("Received exchange: " +
>> exchange.getExchangeId());
>>
>>                // process message //
>>                if (exchange.getStatus().equals(ExchangeStatus.DONE)) {
>>                        MessageExchange oldExchange =
>> this.exchangeCache.remove(exchange.getExchangeId());
>>                        ServiceMixUtils.sendMessage(oldExchange,
>> ExchangeStatus.DONE,
>> this.channel);
>>                } else if
>> (exchange.getStatus().equals(ExchangeStatus.ERROR)) {
>>                        MessageExchange oldExchange =
>> this.exchangeCache.remove(exchange.getExchangeId());
>>                        ServiceMixUtils.sendMessage(oldExchange,
>> ExchangeStatus.ERROR,
>> this.channel);
>>                } else {
>>                        process(exchange);
>>                }
>>                this.log.debug("Exchanges in cache: " +
>> this.exchangeCache.size());
>>        }
>>
>>        private void process(MessageExchange exchange) throws
>> MessagingException {
>>                InOnly inExchange = (InOnly) exchange;
>>                NormalizedMessage message = inExchange.getInMessage();
>>
>>                String fileName = ServiceMixUtils.getFileName(message);
>>                String filePath = ServiceMixUtils.getFilePath(message);
>>
>>                // copy to archive //
>>                StreamSource content;
>>                try {
>>                        content =
>> ServiceMixUtils.getMessagePayload(message);
>>
>>                        if (ServiceMixUtils.isTestDir(filePath)) {
>>                                fileName = "test_" + fileName;
>>                        }
>>
>>                        Properties props = new Properties();
>>                        props.put(DefaultFileMarshaler.FILE_NAME_PROPERTY,
>> FileNameUtils.getArchiveFilename(fileName, ""));
>>                        MessageExchange out =
>> ServiceMixUtils.sendMessage(this.archive, content,
>> props, this.client);
>>                        this.exchangeCache.put(out.getExchangeId(),
>> inExchange);
>>                } catch (TransformerException e) {
>>                        this.log.error(e);
>>                } catch (IOException e) {
>>                        this.log.error(e);
>>                }
>>        }
>>
>> }
>>
>> Pom.xml:
>> ======================================
>> ======================================
>> ======================================
>> <?xml version="1.0" encoding="UTF-8"?>
>> <project>
>>        <parent>
>>                <artifactId>SM_Order</artifactId>
>>                <groupId>de.mmsdresden.sportscheck</groupId>
>>                <version>1.0</version>
>>        </parent>
>>        <modelVersion>4.0.0</modelVersion>
>>        <groupId>de.mmsdresden.sportscheck</groupId>
>>        <artifactId>SM_Order_BeanServices
>>        </artifactId>
>>        <packaging>jbi-service-unit</packaging>
>>        <name>Servicemix :: SM_Order :: BeanServices</name>
>>        <version>1.0</version>
>>        <url>http://www.myorganization.org</url>
>>        <build>
>>
>>                <directory>../../build/SPSI/${artifactId}</directory>
>>              
>>  <outputDirectory>../../build/SPSI/${artifactId}/classes</outputDirectory>
>>                <sourceDirectory>src/main/java</sourceDirectory>
>>
>>                <resources>
>>                        <resource>
>>                                <directory>src/main/resources</directory>
>>                                <includes>
>>                                        <include>**/*</include>
>>                                </includes>
>>                        </resource>
>>                </resources>
>>                <plugins>
>>                        <plugin>
>>                              
>>  <artifactId>maven-compiler-plugin</artifactId>
>>                                <configuration>
>>                                        <source>1.5</source>
>>                                        <target>1.5</target>
>>                                </configuration>
>>                        </plugin>
>>                        <plugin>
>>                                <groupId>org.apache.servicemix.tooling
>>                                </groupId>
>>                                <artifactId>jbi-maven-plugin</artifactId>
>>                                <version>4.0</version>
>>                                <extensions>true</extensions>
>>                        </plugin>
>>                </plugins>
>>        </build>
>>        <repositories>
>>                <repository>
>>                        <id>codehaus.m2.snapshots</id>
>>                        <url>http://snapshots.repository.codehaus.org
>>                        </url>
>>                        <releases>
>>                                <enabled>false</enabled>
>>                        </releases>
>>                </repository>
>>                <repository>
>>                        <releases />
>>                        <snapshots>
>>                                <enabled>false</enabled>
>>                        </snapshots>
>>                        <id>apache</id>
>>                        <name>Apache Repository</name>
>>                      
>>  <url>http://people.apache.org/repo/m2-ibiblio-rsync-repository
>>                        </url>
>>                </repository>
>>                <repository>
>>                        <releases>
>>                                <enabled>false</enabled>
>>                        </releases>
>>                        <snapshots />
>>                        <id>apache.snapshots</id>
>>                        <name>Apache Snapshots Repository</name>
>>                      
>>  <url>http://people.apache.org/repo/m2-snapshot-repository
>>                        </url>
>>                </repository>
>>        </repositories>
>>        <pluginRepositories>
>>                <pluginRepository>
>>                        <releases />
>>                        <snapshots>
>>                                <enabled>false</enabled>
>>                        </snapshots>
>>                        <id>apache</id>
>>                        <name>Apache Repository</name>
>>                      
>>  <url>http://people.apache.org/repo/m2-ibiblio-rsync-repository
>>                        </url>
>>                </pluginRepository>
>>                <pluginRepository>
>>                        <releases>
>>                                <enabled>false</enabled>
>>                        </releases>
>>                        <snapshots />
>>                        <id>apache.snapshots</id>
>>                        <name>Apache Snapshots Repository</name>
>>                      
>>  <url>http://people.apache.org/repo/m2-snapshot-repository
>>                        </url>
>>                </pluginRepository>
>>        </pluginRepositories>
>>        <dependencies>
>>                <dependency>
>>                        <groupId>org.apache.servicemix</groupId>
>>                        <artifactId>servicemix-bean</artifactId>
>>                        <version>2008.01</version>
>>                </dependency>
>>                <dependency>
>>                        <groupId>org.apache.servicemix</groupId>
>>                        <artifactId>servicemix-core</artifactId>
>>                        <version>${servicemix-version}</version>
>>                        <scope>provided</scope>
>>                </dependency>
>>                <dependency>
>>                        <groupId>de.mmsdresden.sportscheck</groupId>
>>                        <artifactId>sportscheck_utils</artifactId>
>>                        <version>${sportscheck-version}</version>
>>                        <type>jar</type>
>>                        <scope>compile</scope>
>>                </dependency>
>>                <dependency>
>>                        <groupId>de.mmsdresden.sportscheck</groupId>
>>                        <artifactId>orders_mapping</artifactId>
>>                        <version>${sportscheck-version}</version>
>>                        <type>jar</type>
>>                        <scope>compile</scope>
>>                </dependency>
>>                <dependency>
>>                        <groupId>commons-io</groupId>
>>                        <artifactId>commons-io</artifactId>
>>                        <version>1.4</version>
>>                        <scope>provided</scope>
>>                </dependency>
>>                <dependency>
>>                        <groupId>org.milyn</groupId>
>>                        <artifactId>milyn-smooks-core</artifactId>
>>                        <version>${milyn.smooks.version}</version>
>>                        <scope>provided</scope>
>>                </dependency>
>>        </dependencies>
>>        <properties>
>>                <milyn.smooks.version>1.1-SNAPSHOT
>>        </milyn.smooks.version>
>>                <servicemix-version>3.3</servicemix-version>
>>                <sportscheck-version>1.0</sportscheck-version>
>>        </properties>
>> </project>
>> --
>> View this message in context:
>> http://old.nabble.com/Problems-migrating-Servicemix-3.2.2-to-3.3-tp26442642p26442642.html
>> Sent from the ServiceMix - Dev mailing list archive at Nabble.com.
>>
>>
> 
> 
> -----
> ---
> Gert Vanthienen
> http://gertvanthienen.blogspot.com
> 

-- 
View this message in context: 
http://old.nabble.com/Problems-migrating-Servicemix-3.2.2-to-3.3-tp26442642p26478780.html
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.

Reply via email to