Sunday, December 25, 2011

Running Broadleaf Ecommerce 1.5.0 Demo in JBoss 7.1.0.CR1b

A bit more complicated as it should be in the beginning, where JBoss changes the protocol name from vfszip to vfs,

1. so I had to build the latest Compass trunk (rev 3940) from http://svn.compass-project.org/svn/compass/trunk/

2. Modify http://svn.compass-project.org/svn/compass/trunk/src/main/src/org/compass/core/config/binding/scanner/ScannerFactoy.java
to:

else if ( url.getProtocol().equals("vfszip") || 
url.getProtocol().equals("vfs") ) {
            url = new URL(urlString);
            return new JarScanner(basePackage, url.openStream(), filter);
        }

3. Replaced the broadleaf's supplied compass-2.2.0.jar with the newly built Compass jar file ( available from http://www.multiupload.com/AY0F7UPKX6 as of Dec 25 2011)

4. Start JBoss (in standalone mode), everything should work fine!!




/*
 * Copyright 2004-2009 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.compass.core.config.binding.scanner;

import java.io.File;
import java.io.IOException;
import java.net.URL;

/**
 * @author kimchy
 */
public class ScannerFactoy {

    public static Scanner create(String basePackage, URL url, Filter filter) throws IOException {
        String urlString = url.toString();
        urlString = urlString.substring(0, urlString.lastIndexOf(basePackage));
        if (urlString.endsWith("!/")) {
            urlString = urlString.substring(4);
            urlString = urlString.substring(0, urlString.length() - 2);
            url = new URL(urlString);
        }


        if (!urlString.endsWith("/")) {
            return new JarScanner(basePackage, url.openStream(), filter);
        } else if (url.getProtocol().equals("file")) {
            File f = new File(url.getPath());
            if (f.isDirectory()) {
                return new FileScanner(basePackage, f, filter);
            } else {
                return new JarScanner(basePackage, url.openStream(), filter);
            }
        } else if ( url.getProtocol().equals("vfszip") || 
url.getProtocol().equals("vfs") ) {
            url = new URL(urlString);
            return new JarScanner(basePackage, url.openStream(), filter);
        } else {
            throw new IOException("Protocol [" + url.getProtocol() + "] is not supported by scanner");
        }
    }
}

3 comments:

  1. Hi Lydonchandra, your tweak was wonderful and help me deploying a war that uses compass 2.2.0 in Jboss 7.1.1!!! Thank you very much!

    ReplyDelete
  2. Dear Anonymous,
    Could you please help me with the JBOSS and broadleaf versions you used.
    I have tried the above solution but did not help.

    ReplyDelete
  3. Hi Lydonchandra, can you please revisit this section by deploying BroadLeaf 2.2 Version on jBoss 7.1.1

    ReplyDelete