Hi,
I am trying to run Spring via Daemon service as stand alone application ofcourse.
I have configured run.sh script and added to it all Spring jars framework.
Now i am trying to execute my starting point class from the Daemon classes this way:
Code:public class FeedDaemon implements Daemon { public FeedDaemon() { } protected final static Logger log = LoggerFactory.getLogger(FeedDaemon.class); protected boolean shouldBeRunning = false; protected ProviderFactory runner = null; @Override public void destroy() { runner = null; } @Override public void init(DaemonContext arg0) throws Exception { runner = new ProviderFactory(); } public void start() throws RuntimeError, ConfigError { log.info("Starting daemon"); runner.start(); } public void stop() throws Exception { log.info("Starting Shutting daemon ..."); runner.stop(); } }
And I get this error:Code:package com.spring.test; import org.apache.log4j.Logger; import org.apache.log4j.PropertyConfigurator; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.spring.aspect.Spring3HelloWorld; import com.spring.beans.ParkingCar.CarBean; import com.spring.beans.ParkingCar.CarMaker; import com.spring.beans.ParkingCar.FourWheelsVechile; import com.spring.beans.ParkingCar.TwoWheelsVechile; import com.spring.beans.ParkingCar.Vechile; import com.spring.beans.ParkingCar.VechileDetails; import com.spring.beans.calculator.CalculateNumbersHolderBean; import com.spring.beans.calculator.CalculateStrategyBean; import com.spring.beans.calculator.CalculatorBean; public class Spring3HelloWorldTest { static Logger logger = Logger.getLogger(Spring3HelloWorldTest.class); public static void execute() { try { ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); logger.debug("3"); Vechile fourWheelsVechile = (FourWheelsVechile) context.getBean("Ambulance"); fourWheelsVechile.drive(); CarMaker carMaker = (CarMaker) context.getBean("carMaker"); CarBean carBean = carMaker.createNewCar(); carBean.driveCar(); } catch (Throwable e) { logger.error(e); } } }
Code:java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.commons.daemon.support.DaemonLoader.load(DaemonLoader.java:164) Caused by: java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContext at com.spring.runner.FeedDaemon.init(FeedDaemon.java:37) ... 5 more Caused by: java.lang.ClassNotFoundException: org.springframework.context.ApplicationContext at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) ... 6 more Cannot load daemon Service exit with a return value of 3
thats my run.sh script:
export JAVA_HOME=/../
FIXGW=/../FIXGW
CLASSPATH=$FIXGW/lib/FeedHandler.jar:$FIXGW/lib/FixSpring.jar:$FIXGW/lib/org.springframework.web-sources-3.1.1.RELEASE.jar:$FIXGW/lib/org.springframework.web.struts-sources-3.1.1.RELEASE.jar:$FIXGW/lib/org.springframework.web.servlet-sources-3.1.1.RELEASE.jar:$FIXGW/lib/org.springframework.web.portlet-sources-3.1.1.RELEASE.jar:$FIXGW/lib/org.springframework.test-sources-3.1.1.RELEASE.jar:$FIXGW/lib/org.springframework.orm-sources-3.1.1.RELEASE.jar:$FIXGW/lib/org.springframework.jms-sources-3.1.1.RELEASE.jar:$FIXGW/lib/org.springframework.jdbc-sources-3.1.1.RELEASE.jar:$FIXGW/lib/org.springframework.context.support-sources-3.1.1.RELEASE.jar:$FIXGW/lib/org.springframework.aspects-sources-3.1.1.RELEASE.jar:$FIXGW/lib/org.springframework.transaction-sources-3.1.1.RELEASE.jar:$FIXGW/lib/org.springframework.oxm-sources-3.1.1.RELEASE.jar:$FIXGW/lib/org.springframework.instrument-sources-3.1.1.RELEASE.jar:$FIXGW/lib/org.springframework.instrument.tomcat-sources-3.1.1.RELEASE.jar:$FIXGW/lib/org.springframework.expression-sources-3.1.1.RELEASE.jar:$FIXGW/lib/org.springframework.core-sources-3.1.1.RELEASE.jar:$FIXGW/lib/org.springframework.context-sources-3.1.1.RELEASE.jar:$FIXGW/lib/org.springframework.beans-sources-3.1.1.RELEASE.jar:$FIXGW/lib/org.springframework.asm-sources-3.1.1.RELEASE.jar:$FIXGW/lib/org.springframework.aop-sources-3.1.1.RELEASE.jar:$FIXGW/lib/commons-daemon-1.0.3.jar
cd $FIXGW
/../jsvc -user fox \
-XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:SurvivorRatio=16 \
-Dlog4j.configuration=file:$FIXGW/conf/log4j.properties \
-outfile /dev/null \
-errfile $FIXGW/logs/error.log \
-verbose -classpath $CLASSPATH \
com.spring.runner.FeedDaemon
Any idea?
thanks,
ray.


Reply With Quote
