Thank you very much Eric - I'll try that tomorrow.

On Wed, Oct 5, 2016 at 7:57 PM, Erick Erickson <erickerick...@gmail.com>
wrote:

> John:
>
> The simple answer is "cheat"....
>
> It takes a little fiddling, but here's what I do in IntelliJ:
>
> 1> use IntelliJ to create an "artifact" that's just the jar WITHOUT
> the associated Solr jar dependencies, just the compiled output
> 1a> Find the bits in <1>. It's usually under my project somewhere
> ...out/artifacts/whatever/whatever.jar
> 1aa> use something like "tar -xvf yourjar.jar" to verify the classes
> are in it that you expect.
> 1b> Be sure when creating the "artifacts" to check the (non obvious)
> "build on make" checkbox OR be sure you use "build artifacts" from the
> build menu when you want to debug.
> 1c> execute "ant server dist" first. The "dist"directory (and possibly
> the solrj-lib below it) will contain all of the Solr jars you should
> need.
> 2> Now change solrconfig.xml to add a <lib.../> directive to point to <1a>.
> 3> At this point, you don't have to copy anything around anywhere.
> Every time you rebuild your project/plugin the new jar is picked up
> when you restart Solr. All the Solr jars you depend on for your plugin
> are loaded and available when Solr starts. If you have suspend=y set
> in your start command, you can set breakpoints in your initialization
> (or anywhere else) in your plugin (or anywhere in Solr).
>
> HINT: If at all possible and you can write a Junit test, it's easier
> to just debug _that_ than go all the stuff above, you can debug
> individual junit tests..
>
> FWIW,
> Erick
>
> On Wed, Oct 5, 2016 at 2:12 PM, John Bickerstaff
> <j...@johnbickerstaff.com> wrote:
> > I've found this much in build.xml...
> >
> >  I'm assuming Ant puts the compiled jars into the paths listed below.
> >
> > Further hints gratefully accepted if someone knows specifically how to
> set
> > this up from top to bottom. I assume the Eclipse build path puts the jars
> > into the referenced directories...?
> >
> > <target name="dist"
> >
> >           description="Creates the Webapp folder for distribution."
> >
> >           depends="dist-core, dist-solrj, lucene-jars-to-solr">
> >
> >     <ant dir="${common-solr.dir}" inheritall="false" target=
> > "contribs-add-to-webapp"/>
> >
> >     <mkdir dir="${server.dir}/solr-webapp/webapp"/>
> >
> >     <copy todir="${server.dir}/solr-webapp/webapp">
> >
> >       <fileset dir="web" excludes="${exclude.from.webapp}"/>
> >
> >       <fileset dir="${dest}/web" excludes="${exclude.from.war}"/> <!--
> > contribs' additions -->
> >
> >     </copy>
> >
> >     <mkdir dir="${server.dir}/solr-webapp/webapp/WEB-INF/lib"/>
> >
> >     <copy todir="${server.dir}/solr-webapp/webapp/WEB-INF/lib">
> >
> >       <fileset dir="${common-solr.dir}/core/lib" excludes=
> > "${exclude.from.webapp},${common.classpath.excludes}"/>
> >
> >       <fileset dir="${common-solr.dir}/solrj/lib" excludes=
> > "${exclude.from.webapp},${common.classpath.excludes}"/>
> >
> >       <fileset dir="${lucene-libs}" excludes=
> > "${exclude.from.webapp},${common.classpath.excludes}" />
> >
> >       <fileset dir="${dist}" excludes=
> > "${exclude.from.webapp},${common.classpath.excludes}">
> >
> >         <include name="solr-solrj-${version}.jar" />
> >
> >         <include name="solr-core-${version}.jar" />
> >
> >       </fileset>
> >
> >     </copy>
> >
> >   </target>
> >
> > On Wed, Oct 5, 2016 at 1:30 PM, John Bickerstaff <
> j...@johnbickerstaff.com>
> > wrote:
> >
> >> OK - I'm running now in debug mode.  My intent is to add and test a
> "hello
> >> world" plugin to prove everything is wired up and that I can debug all
> the
> >> way into the plugin I wrote...
> >>
> >> I want to test plugins/addons which, as I understand it go here if
> you're
> >> adding them to an installed version of Solr.
> >>
> >> solr-6.x.x/server/solr-webapp/webapp/WEB-INF/lib/
> >>
> >> So - to get that all working (build and seeing source when in debug
> >> mode)...
> >>
> >> 1. Where, exactly, should I place the source code for a new plugin that
> is
> >> NOT a part of the Solr distribution if I want to be able to debug
> through
> >> that code as well?  (I understand that the appropriate entries will
> need to
> >> be in the correct xml files in the core/collection configurations)
> >>
> >> 2. Will I need to change the build.xml files in some way?  If yes,
> please
> >> tell me how, I'm unfamiliar with Ant.
> >>
> >> 3. In case I'm in "X/Y problem mode" here - My goal is: Add plugin
> source
> >> code, build, make config changes where needed, and see source when I
> put a
> >> breakpoint in code.
> >>
> >>
> >>
> >> On Wed, Oct 5, 2016 at 12:04 PM, John Bickerstaff <
> >> j...@johnbickerstaff.com> wrote:
> >>
> >>> Thanks Mikhail!
> >>>
> >>> On Wed, Oct 5, 2016 at 11:29 AM, Mikhail Khludnev <m...@apache.org>
> >>> wrote:
> >>>
> >>>> ok. it's "run-example" [ ..@solr]$ant -p
> >>>>  run-example                  Run Solr interactively, via Jetty.
> >>>> -Dexample.debug=true to en
> >>>> able JVM debugger
> >>>> I have it in master and branch_6x
> >>>>
> >>>> On Wed, Oct 5, 2016 at 5:51 PM, John Bickerstaff <
> >>>> j...@johnbickerstaff.com>
> >>>> wrote:
> >>>>
> >>>> > Mikhail -- which version of Solr are you using to do this [ant
> example
> >>>> > -Dexample.debug=true]
> >>>> >
> >>>> > I may be wrong, but it seems that "example" no longer works with
> >>>> 6.x...?
> >>>> >
> >>>> > On Wed, Oct 5, 2016 at 1:14 AM, Mikhail Khludnev <m...@apache.org>
> >>>> wrote:
> >>>> >
> >>>> > > launching ant example -Dexample.debug=true from Exlipse works to
> me.
> >>>> > > It takes a while for useless compile checks, then you can debug
> >>>> remotely
> >>>> > to
> >>>> > > 5005.
> >>>> > > Jetty process need to be terminated separately. SolrAdmin works,
> >>>> > debugging
> >>>> > > with sources works too.
> >>>> > > However, there is no cores my default, you need to create them
> >>>> manually.
> >>>> > >
> >>>> > > Probably the better way is to launch ant server, and then
> bin{\}solr
> >>>> > start
> >>>> > > -e ... -a ... and connect debugger remotely.
> >>>> > >
> >>>> > > On Wed, Oct 5, 2016 at 7:19 AM, Erick Erickson <
> >>>> erickerick...@gmail.com>
> >>>> > > wrote:
> >>>> > >
> >>>> > > > Warning: I use IntelliJ, but I think Eclipse works similarly.
> >>>> > > >
> >>>> > > > I'm a bit confused. Are you trying to _start_ Solr from
> >>>> > > > within Eclipse? Or starting it from a command prompt?
> >>>> > > >
> >>>> > > > I do the latter and then attach a remote debugging session
> >>>> > > > from within the IDE, which is what I think that link suggests
> too.
> >>>> > > >
> >>>> > > > I also build 'ant server dist' from the install_dir/solr
> directory
> >>>> > first.
> >>>> > > > The 'ant eclipse' target just builds the project structure for
> >>>> Eclipse,
> >>>> > > > it doesn't build Solr.
> >>>> > > >
> >>>> > > > YMMV of course since you're using a different IDE.
> >>>> > > >
> >>>> > > > Best,
> >>>> > > > Erick
> >>>> > > >
> >>>> > > >
> >>>> > > > On Tue, Oct 4, 2016 at 5:27 PM, John Bickerstaff
> >>>> > > > <j...@johnbickerstaff.com> wrote:
> >>>> > > > > Thanks!
> >>>> > > > >
> >>>> > > > > This works...
> >>>> > > > >
> >>>> > > > > I'm getting a (possibly unrelated?) warning and can't hit the
> >>>> Admin
> >>>> > > page
> >>>> > > > (I
> >>>> > > > > get a 503).  I DO see eclipse "hook into" the debug session
> >>>> which is
> >>>> > > > > excellent.
> >>>> > > > >
> >>>> > > > > The warning resolves to this:
> >>>> > > > >
> >>>> > > > > java.io.FileNotFoundException:
> >>>> > > > > /Users/.../.../workspace/solr-6.2.1/solr/server/solr-webapp/
> >>>> webapp
> >>>> > > > >
> >>>> > > > > Full stack trace below...
> >>>> > > > >
> >>>> > > > > I built the project using ant and ivy for eclipse.
> >>>> > > > >
> >>>> > > > > ant eclipse (inside the solr6.x.x directory per the
> instructions
> >>>> I
> >>>> > > > > referenced)
> >>>> > > > >
> >>>> > > > > I did not see a way to build the jetty portion - and perhaps
> >>>> that's
> >>>> > > what
> >>>> > > > > the problem is -- although the instructions here (
> >>>> > > > > http://opensourceconnections.com/blog/2013/04/13/how-to-
> >>>> > > > debug-solr-with-eclipse/)
> >>>> > > > > about building jetty don't seem to work with this version of
> >>>> Solr...
> >>>> > > > >
> >>>> > > > > Any suggestions welcome.  It seems to me the jetty jars are
> all
> >>>> there
> >>>> > > but
> >>>> > > > > maybe I'm missing something.  Especially since the stack
> trace is
> >>>> > > > > complaining about "Web application not found"
> >>>> > > > >
> >>>> > > > > I'll dig into it more tomorrow...
> >>>> > > > >
> >>>> > > > > =========
> >>>> > > > >
> >>>> > > > > stack trace:
> >>>> > > > >
> >>>> > > > > 220  WARN  (main) [   ] o.e.j.w.WebInfConfiguration Web
> >>>> application
> >>>> > not
> >>>> > > > > found
> >>>> > > > > /Users/.../Documents/workspace/solr-6.2.1/solr/
> >>>> > > server/solr-webapp/webapp
> >>>> > > > > 221  WARN  (main) [   ] o.e.j.w.WebAppContext Failed startup
> of
> >>>> > context
> >>>> > > > > o.e.j.w.WebAppContext@3b0090a4
> >>>> > > > > {/solr,null,null}{/Users/jbickerstaff/Documents/
> >>>> > > > workspace/solr-6.2.1/solr/server/solr-webapp/webapp}
> >>>> > > > > java.io.FileNotFoundException:
> >>>> > > > > /Users/.../Documents/workspace/solr-6.2.1/solr/
> >>>> > > server/solr-webapp/webapp
> >>>> > > > > at
> >>>> > > > > org.eclipse.jetty.webapp.WebInfConfiguration.unpack(
> >>>> > > > WebInfConfiguration.java:497)
> >>>> > > > > at
> >>>> > > > > org.eclipse.jetty.webapp.WebInfConfiguration.preConfigure(
> >>>> > > > WebInfConfiguration.java:72)
> >>>> > > > > at
> >>>> > > > > org.eclipse.jetty.webapp.WebAppContext.preConfigure(
> >>>> > > > WebAppContext.java:480)
> >>>> > > > > at org.eclipse.jetty.webapp.WebAppContext.doStart(
> >>>> > > > WebAppContext.java:516)
> >>>> > > > > at
> >>>> > > > > org.eclipse.jetty.util.component.AbstractLifeCycle.
> >>>> > > > start(AbstractLifeCycle.java:68)
> >>>> > > > > at
> >>>> > > > > org.eclipse.jetty.deploy.bindings.StandardStarter.processBin
> >>>> ding(
> >>>> > > > StandardStarter.java:41)
> >>>> > > > > at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(
> >>>> > > > AppLifeCycle.java:188)
> >>>> > > > > at
> >>>> > > > > org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(
> >>>> > > > DeploymentManager.java:499)
> >>>> > > > > at
> >>>> > > > > org.eclipse.jetty.deploy.DeploymentManager.addApp(
> >>>> > > > DeploymentManager.java:147)
> >>>> > > > > at
> >>>> > > > > org.eclipse.jetty.deploy.providers.ScanningAppProvider.
> >>>> > > > fileAdded(ScanningAppProvider.java:180)
> >>>> > > > > at
> >>>> > > > > org.eclipse.jetty.deploy.providers.WebAppProvider.
> >>>> > > > fileAdded(WebAppProvider.java:458)
> >>>> > > > > at
> >>>> > > > > org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fil
> >>>> eAdded(
> >>>> > > > ScanningAppProvider.java:64)
> >>>> > > > > at org.eclipse.jetty.util.Scanner.reportAddition(
> Scanner.java:6
> >>>> 10)
> >>>> > > > > at org.eclipse.jetty.util.Scanner.reportDifferences(
> >>>> > Scanner.java:529)
> >>>> > > > > at org.eclipse.jetty.util.Scanner.scan(Scanner.java:392)
> >>>> > > > > at org.eclipse.jetty.util.Scanner.doStart(Scanner.java:313)
> >>>> > > > > at
> >>>> > > > > org.eclipse.jetty.util.component.AbstractLifeCycle.
> >>>> > > > start(AbstractLifeCycle.java:68)
> >>>> > > > > at
> >>>> > > > > org.eclipse.jetty.deploy.providers.ScanningAppProvider.
> >>>> > > > doStart(ScanningAppProvider.java:150)
> >>>> > > > > at
> >>>> > > > > org.eclipse.jetty.util.component.AbstractLifeCycle.
> >>>> > > > start(AbstractLifeCycle.java:68)
> >>>> > > > > at
> >>>> > > > > org.eclipse.jetty.deploy.DeploymentManager.startAppProvider(
> >>>> > > > DeploymentManager.java:561)
> >>>> > > > > at
> >>>> > > > > org.eclipse.jetty.deploy.DeploymentManager.doStart(
> >>>> > > > DeploymentManager.java:236)
> >>>> > > > > at
> >>>> > > > > org.eclipse.jetty.util.component.AbstractLifeCycle.
> >>>> > > > start(AbstractLifeCycle.java:68)
> >>>> > > > > at
> >>>> > > > > org.eclipse.jetty.util.component.ContainerLifeCycle.
> >>>> > > > start(ContainerLifeCycle.java:132)
> >>>> > > > > at org.eclipse.jetty.server.Server.start(Server.java:405)
> >>>> > > > > at
> >>>> > > > > org.eclipse.jetty.util.component.ContainerLifeCycle.
> >>>> > > > doStart(ContainerLifeCycle.java:114)
> >>>> > > > > at
> >>>> > > > > org.eclipse.jetty.server.handler.AbstractHandler.
> >>>> > > > doStart(AbstractHandler.java:61)
> >>>> > > > > at org.eclipse.jetty.server.Server.doStart(Server.java:372)
> >>>> > > > > at
> >>>> > > > > org.eclipse.jetty.util.component.AbstractLifeCycle.
> >>>> > > > start(AbstractLifeCycle.java:68)
> >>>> > > > > at org.eclipse.jetty.xml.XmlConfiguration$1.run(
> >>>> > > > XmlConfiguration.java:1510)
> >>>> > > > > at java.security.AccessController.doPrivileged(Native Method)
> >>>> > > > > at org.eclipse.jetty.xml.XmlConfiguration.main(
> >>>> > > > XmlConfiguration.java:1435)
> >>>> > > > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> >>>> > > > > at
> >>>> > > > > sun.reflect.NativeMethodAccessorImpl.invoke(
> >>>> > > > NativeMethodAccessorImpl.java:62)
> >>>> > > > > at
> >>>> > > > > sun.reflect.DelegatingMethodAccessorImpl.invoke(
> >>>> > > > DelegatingMethodAccessorImpl.java:43)
> >>>> > > > > at java.lang.reflect.Method.invoke(Method.java:498)
> >>>> > > > > at org.eclipse.jetty.start.Main.invokeMain(Main.java:214)
> >>>> > > > > at org.eclipse.jetty.start.Main.start(Main.java:457)
> >>>> > > > > at org.eclipse.jetty.start.Main.main(Main.java:75)
> >>>> > > > > 240  INFO  (main) [   ] o.e.j.s.ServerConnector Started
> >>>> > > > > ServerConnector@68e5eea7{HTTP/1.1,[http/1.1]}{0.0.0.0:8983}
> >>>> > > > > 240  INFO  (main) [   ] o.e.j.s.Server Started @18534ms
> >>>> > > > >
> >>>> > > > >
> >>>> > > > >
> >>>> > > > > On Tue, Oct 4, 2016 at 4:45 PM, Jihwan Kim <
> jihwa...@gmail.com>
> >>>> > wrote:
> >>>> > > > >
> >>>> > > > >> I read your first reference and run the following command on
> the
> >>>> > > > >> Solr_Installed Dir.  I am using v. 6.2.0 and 4.10.4.  both
> >>>> works.
> >>>> > > > >>
> >>>> > > > >> bin/solr start -f -a "-Xdebug
> >>>> > > > >> -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=
> 7666"
> >>>> > > > >>
> >>>> > > > >> On Tue, Oct 4, 2016 at 5:26 PM, John Bickerstaff <
> >>>> > > > j...@johnbickerstaff.com
> >>>> > > > >> >
> >>>> > > > >> wrote:
> >>>> > > > >>
> >>>> > > > >> > All,
> >>>> > > > >> >
> >>>> > > > >> > I've found some hints, but can't get Solr running in debug
> >>>> mode in
> >>>> > > > >> eclipse
> >>>> > > > >> > with the instructions
> >>>> > > > >> >
> >>>> > > > >> > Here:
> >>>> > > > >> > http://opensourceconnections.com/blog/2013/04/13/how-to-
> >>>> > > > >> > debug-solr-with-eclipse/
> >>>> > > > >> >
> >>>> > > > >> > or Here: http://wiki.apache.org/solr/HowToConfigureEclipse
> >>>> > > > >> >
> >>>> > > > >> > When I run this command from the wiki : java -Xdebug
> >>>> > > > >> > -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=
> 7666
> >>>> > -jar
> >>>> > > > >> > start.jar
> >>>> > > > >> >
> >>>> > > > >> > I get an error: WARNING: Nothing to start, exiting ...
> >>>> > > > >> >
> >>>> > > > >> > I can't start the jar file "normally" either and it turns
> out
> >>>> to
> >>>> > be
> >>>> > > a
> >>>> > > > >> > symlink.
> >>>> > > > >> >
> >>>> > > > >> > I'm thinking that things are different now given that the
> way
> >>>> to
> >>>> > > start
> >>>> > > > >> Solr
> >>>> > > > >> > is this way:
> >>>> > > > >> >
> >>>> > > > >> > bin/solr start -e cloud -noprompt
> >>>> > > > >> >
> >>>> > > > >> > Can anyone point me at documentation or drop a hint?
> >>>> > > > >> >
> >>>> > > > >>
> >>>> > > >
> >>>> > >
> >>>> > >
> >>>> > >
> >>>> > > --
> >>>> > > Sincerely yours
> >>>> > > Mikhail Khludnev
> >>>> > >
> >>>> >
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> Sincerely yours
> >>>> Mikhail Khludnev
> >>>>
> >>>
> >>>
> >>
>

Reply via email to