Java error running "rake sunspot:solr:run" on Windows
Reported by plind | June 17th, 2010 @ 09:01 AM | in Bugs
I wanted to start using SunSpot. On my Windows machine, I ran into a problem, however, trying to get the server to run. I get the following error when running "rake sunspot:solr:run":
Exception in thread "main" java.lang.NoClassDefFoundError: '-Djava/util/logging/config/file=C:/DOCUME~1/pli/LOCALS~1/Temp/logging/properties20100617-11284-furc4v-0'
Caused by: java.lang.ClassNotFoundException: '-Djava.util.logging.config.file=C:.DOCUME~1.pli.LOCALS~1.Temp.logging.properties20100617-11284-furc4v-0'
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: '-Djava.util.logging.config.file=C:/DOCUME~1/pli/LOCALS~1/Temp/logging.properties20100617-11284-furc4v-0'. Program will exit.
After some debugging I found that the problem lies in the run operation in server.rb. The "exec(Escape.shell_command(command))" puts single quotes around "-Djava/util/logging/config/file=C:/DOCUME~1/pli/LOCALS~1/Temp/logging/properties20100617-11284-furc4v-0" resulting in the following command being executed:
java -Djetty.port=8982 -Dsolr.data.dir=E:/ruby-projects/guru/solr/data/development -Dsolr.solr.home=E:/ruby-projects/guru/solr '-Djava.util.logging.config.file=C:/DOCUME~1/pli/LOCALS~1/Temp/logging.properties20100617-13196-er87ke-0' -jar start.jar
This does not work on the Windows command line. What does work is replacing the single quotes with double quotes. I tested it by changing the "exec(Escape.shell_command(command))" instruction on line 74 in the server.rb with "exec(Escape.shell_command(command).gsub("'",'"'))". Once I did that, all worked fine.
Anyway, this does not seem like a viable final solution, but I don't know what is the best solution either. Can you look into this?
Comments and changes to this ticket
-

plind June 17th, 2010 @ 09:13 AM
- Title changed from Java error running "rake solr:sunspot:run" on Windows to Java error running "rake sunspot:solr:run" on Windows
-

mat July 14th, 2010 @ 11:24 AM
- Milestone set to Bugs
- Milestone order changed from 0 to 0
-

mat July 14th, 2010 @ 11:42 AM
- State changed from new to wontfix
I don't use Windows and never will; I'm happy to accept a patch that fixes this, but it needs to be tested to make sure it works on bash-like command shells as well (previous attempts to fix this problem have broken linux/mac).
-

plind July 15th, 2010 @ 02:00 PM
All I can say is that I just tested the solution (the changed line 74) on my Mac and it works fine.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
Awesome Solr interaction for Ruby
Referenced by
-
#84 "sunspot-solr run" doesn't start on windows
What worked for me is adding .gsub("'",'"') on line 74, a...