velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carlos Baez Ruiz <carlos.b...@i2cat.net>
Subject Velocity with Fuse - osgi container
Date Wed, 25 May 2011 13:28:12 GMT
Hi all,

I am working in project where we are using OSGi bundles in an Equinox
container. and we are using velocity to load some necessary templates. Our
project with includes all the methods and classes to work with velocity,
also it has a velocity.properties from which we load our classloader. The
file is this:

runtime.log.logsystem.class=org.apache.velocity.runtime.log.SimpleLog4JLogSystem
runtime.log.logsystem.log4j.category=org.apache.velocity.runtime.log.SimpleLog4JLogSystem

resource.loader= class

class.resource.loader.description=Personalize Resource Loader
class.resource.loader.class=net.i2cat.mantychore.commandsets.junos.velocity.PersonalizeClassLoader

My problem is that when we are loading the properties (the
velocity.properties was read fine),  the PersonalizeClassLoader couldnt be
loadee

My method to initialize velocity:

        InputStream velocityPropFile =
getClass().getResourceAsStream(VELOCITY_PROPS);
        if (velocityPropFile == null)
            throw new ResourceNotFoundException("Cannot load: " +
VELOCITY_PROPS);

        Properties prop = new Properties();
        prop.load(velocityPropFile);

        Velocity.init(prop);

Error:

 [error] Problem instantiating the template loader:
net.i2cat.mantychore.commandsets.junos.velocity.PersonalizeClassLoader.
Look at your properties file and make sure the
name of the template loader is correct.
net.i2cat.mantychore.commandsets.junos.velocity.PersonalizeClassLoader
java.lang.ClassNotFoundException:
net.i2cat.mantychore.commandsets.junos.velocity.PersonalizeClassLoader
    at
org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506)
    at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
    at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
    at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at org.apache.velocity.util.ClassUtils.getClass(ClassUtils.java:77)
    at
org.apache.velocity.util.ClassUtils.getNewInstance(ClassUtils.java:96)
    at
org.apache.velocity.runtime.resource.loader.ResourceLoaderFactory.getLoader(ResourceLoaderFactory.java:49)
    at
org.apache.velocity.runtime.resource.ResourceManagerImpl.initialize(ResourceManagerImpl.java:134)
    at
org.apache.velocity.runtime.RuntimeInstance.initializeResourceManager(RuntimeInstance.java:661)
    at
org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:251)
    at
org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:589)
    at
org.apache.velocity.runtime.RuntimeSingleton.init(RuntimeSingleton.java:229)
    at org.apache.velocity.app.Velocity.init(Velocity.java:107)
    at
net.i2cat.mantychore.commandsets.junos.velocity.VelocityEngine.init(VelocityEngine.java:48)
    at
net.i2cat.mantychore.commandsets.junos.velocity.VelocityEngine.mergeTemplate(VelocityEngine.java:53)
    at
net.i2cat.mantychore.actionsets.junos.actions.JunosAction.prepareVelocityCommand(JunosAction.java:31)
    at
net.i2cat.mantychore.actionsets.junos.actions.SetInterfaceAction.prepareMessage(SetInterfaceAction.java:46)
    at
net.i2cat.mantychore.actionsets.junos.actions.JunosAction.execute(JunosAction.java:53)
    at
net.i2cat.mantychore.queuemanager.QueueManager.execute(QueueManager.java:68)
    at
net.i2cat.mantychore.capability.chassis.shell.SetInterfaceCommand.doExecute(SetInterfaceCommand.java:68)
    at
org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:41)
    at
org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35)
    at
org.apache.felix.gogo.runtime.shell.CommandProxy.execute(CommandProxy.java:50)
    at org.apache.felix.gogo.runtime.shell.Closure.execute(Closure.java:229)
    at
org.apache.felix.gogo.runtime.shell.Closure.executeStatement(Closure.java:162)
    at org.apache.felix.gogo.runtime.shell.Pipe.run(Pipe.java:101)
    at org.apache.felix.gogo.runtime.shell.Closure.execute(Closure.java:79)
    at
org.apache.felix.gogo.runtime.shell.CommandSessionImpl.execute(CommandSessionImpl.java:71)
    at org.apache.karaf.shell.console.jline.Console.run(Console.java:180)
    at java.lang.Thread.run(Thread.java:662)



It is very curious because we had been testing this project from pax-exam
tool which emulate a equinox container and it worked fine...

Link to our osgi container -
http://fusesource.com/products/enterprise-servicemix/
Link to pax-exam tool - http://wiki.ops4j.org/display/paxexam/Pax+Exam

Has some person an idea?

While, i will read osgi documentation to undertand why it is not working....

Regads,
Carlos





-- 
Carlos Baez Ruiz

Network Technologies Cluster (CTX)
Fundació i2Cat, Internet i Innovació Digital a Catalunya
C/ Gran Capità 2 - 4, Nexus I building, 1st floor, office 109
08034 Barcelona, Catalonia, Spain


P: +34 93 567 9927
F: +34 93 553 2520



-- 
Carlos Baez Ruiz

Network Technologies Cluster (CTX)
Fundació i2Cat, Internet i Innovació Digital a Catalunya
C/ Gran Capità 2 - 4, Nexus I building, 1st floor, office 109
08034 Barcelona, Catalonia, Spain


P: +34 93 567 9927
F: +34 93 553 2520

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message