java - Gemfire startup with gfsh: ClassNotFound error in gfsh start server -
i have following environment:os - windows7
environment variables set:
classpath = c:\myworkspace\pivotal_gemfire_800_b48398_windows\lib\gemfire.jar;c:\myworkspace\pivotal_gemfire_800_b48398_windows\lib\antlr.jar;c:\myworkspace\pivotal_gemfire_800_b48398_windows\lib\gfsh-dependencies.jar;c:\myworkspace\pivotal_gemfire_800_b48398_windows\lib\gfsecurityimpl.jar;c:\myworkspace\pivotal_gemfire_800_b48398_windows\lib\jackson-core-2.2.0.jar;c:\myworkspace\pivotal_gemfire_800_b48398_windows\lib\commons-logging-1.1.1.jar;c:\myworkspace\pivotal_gemfire_800_b48398_windows\lib\tomcat-embed-core.jar;c:\myworkspace\pivotal_gemfire_800_b48398_windows\lib\tomcat-embed-jasper.jar;c:\myworkspace\pivotal_gemfire_800_b48398_windows\lib\tomcat-embed-logging-juli.jar;%java_home%\lib\tools.jar;c:\myworkspace\repository\org\springframework\data\spring-data-gemfire\1.5.1.release\spring-data-gemfire-1.5.1.release.jar;%classpath% gemfire = c:\myworkspace\pivotal_gemfire_800_b48398_windows gf_java = %java_home%\bin\java.exe java_home = c:\myworkspace\jdk8\jdk1.8.0_31 maven_home = c:\myworkspace\maven\apache-maven-3.3.1 path = %java_home%\bin;%eracom_home%;%cryptoki%;%was_home%\bin;%maven_home%\bin;c:\windows\system32;c:\windows;c:\otherprogramfiles\nodejs\;%gemfire%\bin;
my simple project files: cache-xml-file:cache.xml
<cache> <region name="apps"> <region-attributes> <cache-listener> <class-name>mypackage.listener.testlistener</class-name> </cache-listener> </region-attributes> </region> <initializer> <class-name>org.springframework.data.gemfire.support.springcontextbootstrappinginitializer</class-name> <parameter name="contextconfiglocations"> <string>spring-application-context.xml</string> </parameter> </initializer> </cache>
mypackage.listener.testlistener
public class testlistener implements cachelistener, declarable { @ override public void init(properties arg0) { system.out.println("inside testlistener.init()"); } ... //other overridden methods . . . }
spring-application-context.xml: contains single bean:
<?xml version="1.0" encoding="utf-8" ?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:gfe="http://www.springframework.org/schema/gemfire" xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> <bean id="mytestcacheloader" class="mypackage.loader.mytestcacheloader"> </bean> </beans>
**mypackage.loader.mytestcacheloader:
public class mytestcacheloader implements cacheloader, declarable { @ override public void close() { } @ override public object load(loaderhelper arg0) throws cacheloaderexception { system.out.println("inside mytestcacheloader.load()"); return null; } @ override public void init(properties arg0) { } }
steps: 1. start gfsh directory - c:\myworkspace\pivotal_gemfire_800_b48398_windows
start locator: start locator --name=locator1 --port=10334
start server:
start server --name=server1 --server-port=40411 --cache-xml-file=c:\myworkspace\codebase\contentservices\content-loaderwriter\src\test\resources\cache-loader-writer.xml --classpath=c:\myworkspace\codebase\contentservices\content-loaderwriter\target\content-loaderwriter-0.0.1-snapshot.jar
but throwing: java.lang.classnotfoundexception: org.springframework.data.gemfire.support.springcontextbootstrappinginitializer
i added gemfire jars above spring-data-gemfire jar (from repo) in classpath variable. still getting exception. seems not resolve maven dependencies/classpath.
- if try provide multiple jars in classpath in gfsh start server command:
start server --name=server1 --server-port=40411 --cache-xml-file="c:\myworkspace\codebase\contentservices\content-loaderwriter\src\test\resources\cache-loader-writer.xml" --classpath="c:\myworkspace\repository\org\springframework\data\spring-data-gemfire\1.5.1.release\spring-data-gemfire-1.5.1.release.jar:c:\myworkspace\codebase\contentservices\content-loaderwriter\target\content-loaderwriter-0.0.1-snapshot.jar"
i still classnotfoundexception. not resolving jars provided in classpath.
can please help?
i think problem have ':' separator character in class path. windows wants ';' here. not need set classpath environment variable in case.
however, need other jars spring-data-gemfire depends upon. looks using maven here easy way class path of project dependencies including transitive ones.
in project directory, run "mvn -dexcludeartifactids=gemfire dependency:build-classpath". give of dependencies other gemfire (which provided automatically). add application jar resulting classpath , should have need.
also, based on doing, interested in "--spring-xml-location" option added "gfsh start" command in 8.1. allows dispense "cache.xml" , define in spring context file using "gfe" namespace provided spring-data-gemfire.
Comments
Post a Comment