This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Cattle Drive and the fly likes Trouble with Jenny Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Trouble with Jenny" Watch "Trouble with Jenny" New topic
Author

Trouble with Jenny

Matt Fry
Ranch Hand

Joined: Mar 06, 2006
Posts: 60
I am having trouble getting Jenny to run. I copied the build.xml code exactly as it appears on the assignment page, created a jenny.properties file in my home dir, and have added the jrcommon jar file to my classpath. Each time I try to run Jenny, I get a class not found error. Any ideas what I'm doing wrong.
[ April 06, 2007: Message edited by: Matt Fry ]
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9046
    
  10
Please copy and paste the exact error message. Thanks.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Matt Fry
Ranch Hand

Joined: Mar 06, 2006
Posts: 60
Marilyn,

I apologize for taking so long to get back with you on this. I've been trying to wrap up a big (for me) programming project at work and having to squeeze the Cattle Drive in whenever I could. Plus, since it was Easter, I didn't do anything remotely related to work over the weekend.

Anyway, here is the error message I got:



I have jrcommon-2-bin.jar in my classpath. I'm sure it's probably something simple I'm doing wrong, but I'm just not sure what at this point. I will try to devote more time to this now that my project is about wrapped up (at least I hope it is).

Thanks for all your help!
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9046
    
  10
That's one advantage of the Cattle Drive... You can work on your own schedule and not have to follow one that someone else told you to follow.

I should have asked for more info besides just the error message. I'd like the command line too. Like

C;\java\java com.javaranch.....Jenny ...
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Jenny is not found in jrcommon-2-bin.jar. It's in jenny-dev.jar, which is found in jenny.zip, downloaded from here.


"I'm not back." - Bill Harding, Twister
Matt Fry
Ranch Hand

Joined: Mar 06, 2006
Posts: 60


I downloaded the files that Jim mentioned, added them to my classpath and still the same result.

I also have the following set up:


I've had some problems with packages before so I don't know if that's the problem or not.

Thanks for all your help.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9046
    
  10
True, Jim. This instruction is included in the JDBC 2b Assignment page. The jrcommon-2-bin.jar instructions I gave Matt (and Carol) are to avoid conflicts with the previous version of Jenny.

Matt, please type
<pre>echo %CLASSPATH% </pre>
at the command line and post your results here (just to verify).
[ April 10, 2007: Message edited by: Marilyn de Queiroz ]
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9046
    
  10
Are you trying to run Jenny from the command line or using the ant script?
Matt Fry
Ranch Hand

Joined: Mar 06, 2006
Posts: 60
I modified build.xml as per the JDBC 2-b assignment. Now I'm not too sure how I was trying to run it. I've been a bit confused by ant (and the various property files) the whole time I've been using it. So I can't say exactly how/what I've been trying to run. I just typed in what I found here which is also the same I found here


[ April 10, 2007: Message edited by: Matt Fry ]
Carol Murphy
village idiot
Bartender

Joined: Mar 15, 2001
Posts: 1195
Originally posted by Matt Fry:
I modified build.xml as per the JDBC 2-b assignment. Now I'm not too sure how I was trying to run it. I've been a bit confused by ant (and the various property files) the whole time I've been using it.


Oh Matt! You have no idea how glad I am to read your post. It is exactly how I feel about all this. I'm doing it, but I don't quite see the whole picture yet. I'm too close to see abything but what is directly before me. I'm waiting with baited breath to see how it turns out!
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
It looks like some of the jenny instructions have out-of-date information. The package com.javaranch.db does not exist anymore (not in the recent versions of the jenny project, anyway) - the package name is now com.javaranch.jenny. So anyplace you find com.javaranch.db, just replace the db with jenny. I'll fix the Jenny instructions now, but in case I miss any, that's what you have to do.

Note that you can always find out what's really in a jar file by doing one of two things: (a) open it with a zip program like WinZip, or (b) execute the command "jar tvf jarfilename.jar". The jar executable is part of your JDK, so if the JDK has been installed, the command should work. If not, you may need to modify your PATH (Not CLASSPATH but PATH) to include the bin directory of your JDK installation... e.g. C:\Program Files\Java\jdk1.5.0. You should get a listing that tells you exactly what classes (and what packages) are present in the jar file. Useful for diagnosing errors like NoClassDefFoundError.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9046
    
  10
Jenny can be run from the command line. For example:

C:\java\java com.javaranch.jenny.dev.Jenny jenny.properties

but ...

I suggest that for these assignments, you should use ant to run Jenny. For example, my output looks like this:

C:\<path_to_the_dir_containing_the_src_dir_which_contains_the_*.java_files_for_your_assignment>ant jenny
Buildfile: build.xml

init:

jenny:
[java] Running Jenny...

BUILD SUCCESSFUL
Total time: 3 seconds
[ April 10, 2007: Message edited by: Marilyn de Queiroz ]
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9046
    
  10
<pre> ,;"c:\Documents and Settings\Matt\Desktop\jenny\jenny-dev.jar";"c:\Documents and Settings\Matt\Desktop\jenny\jenny-prod.jar"</pre>

I think that, rather than a comma, you want that first character to be a period.
[ April 10, 2007: Message edited by: Marilyn de Queiroz ]
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9046
    
  10
Originally posted by Matt Fry:
I've been a bit confused by ant (and the various property files) the whole time I've been using it.


Originally posted by Carol Murphy:
It is exactly how I feel about all this. I'm doing it, but I don't quite see the whole picture yet. I'm too close to see anything but what is directly before me.


Maybe someone can post some specific questions about ant in another thread. (I'm thinking that students who are just starting with ant/servlets stuff might not read this thread). The goal here is to learn, and if you're confused about something, chances are that someone else is too.
Matt Fry
Ranch Hand

Joined: Mar 06, 2006
Posts: 60
Originally posted by Marilyn de Queiroz:

I think that, rather than a comma, you want that first character to be a period.


I'm sorry about that Marilyn, it was a period in my command line


When I type

the response I get is:






Carol, I'm glad my confusion is helping someone. I'm starting to understand ant more as I use it, but the learning curve has seemed quite steep.

Thank you Marilyn and Jim for all your help. I really appreciate it!
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9046
    
  10
Where did the "and" come from.
Matt Fry
Ranch Hand

Joined: Mar 06, 2006
Posts: 60
Originally posted by Marilyn de Queiroz:
Where did the "and" come from.


I have no idea. But that's what it says.

Also, as an experiment, I changed my classpath to point to the two jenny jar files in other locations and get different error messages. When I type "ant ffbuild deploy", I get

When I type "ant jenny", I get

I change the classpath back to point to the two jenny jars in my %home% directory and get the "and was unexpected at this time".

I have no idea what's going on.

I do however appreciate your patience in working with me.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9046
    
  10
[I]Also, as an experiment, I changed my classpath to point to the two jenny jar files in other locations and get different error messages. When I type "ant ffbuild deploy", I get[/I]

That is expected. The gen-src directory is populated by Jenny.

[I]When I type "ant jenny", I get [/I]

Ah. You've found another error in the documentation.

Change your build script to


Be sure the jars are in the proper directories (i.e. put jenny-prod.jar into the C:\mattjava\videos\lib\development dir, etc) and try again to run the "ant jenny" script.

I change the classpath back to point to the two jenny jars in my %home% directory and get the "and was unexpected at this time".

Ah ha! I think I've got it. Your home directory contains spaces... and the word "and" ... "C:\Documents and Settings\..." We had a discussion about this issue just recently in this thread

I do however appreciate your patience in working with me.

I appreciate your questions.
[ April 12, 2007: Message edited by: Marilyn de Queiroz ]
Matt Fry
Ranch Hand

Joined: Mar 06, 2006
Posts: 60
I think it's working now! I finally got a build successful message.

Anything I need to look for in the filesystem or should I assume everything is OK?
Matt Fry
Ranch Hand

Joined: Mar 06, 2006
Posts: 60
As I said in the post above, everything seems to be running successfully (at least that's the message I get after running ant). But, I can't seem to find any generated source files. "c:\mattjava\videos\build\gen-src\" is empty. So is "c:\mattjava\videos\src\java\com\javaranch\drive\videos" except for vidoedata.java and vidoeservlet.java. Is this right?

Also, I tried running "ant db" just to see what happens and nothing is changed in my vidoes table.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9046
    
  10
The way to test "ant db" is to add some rows to your table, then run ant db and see if you get a clean table (with no rows)

After you run Jenny, you should see 2 files in a subdir (gen-src\com\javaranch\db\soup\com\javaranch\db\soup) in gen-src ... SoupFacade.java and VideosTable.java

VideoData.java and VideoServlet.java are in the correct place.
Matt Fry
Ranch Hand

Joined: Mar 06, 2006
Posts: 60
Sorry I haven't posted any more on this issue. I have been unable to get it to work since I made the post. I think it's a classpath issue, but I'm not sure what I'm doing wrong now and what I did right back when it seemed to work. If I have to set my classpath to "c:\mattjava\videos\jenny\dev\" before I can get it to do anything other than say anything other than
BUILD FAILED
C:\mattjava\videos\build.xml:82: Could not find com.javaranch.jenny.dev.Jenny. Make sure you have it in your classpath


Then, when I run this, it seems to not be able to find the jrcommon files need to compile. If I change my classpath in ANY way, it isn't able to find the Jenny files (error message reads
c:\mattjava\videos\build.xml:82: Could not find com.javaranch.jenny.dev.Jenny. Make sure you have it in your classpath
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9046
    
  10
Originally posted by Matt Fry:
BUILD FAILED
C:\mattjava\videos\build.xml:82: Could not find com.javaranch.jenny.dev.Jenny. Make sure you have it in your classpath


Please email me your build.xml file.

Your file structure should look like this:
Matt Fry
Ranch Hand

Joined: Mar 06, 2006
Posts: 60
O.K. I got it to give a "Build Successful" message like I did before. I had to set my classpath EXACTLY to
c:\mattjava\videos>set classpath=.;c:\mattjava\videos\lib\production\jrcommon-2-bin.jar;c:\mattjava\videos\jenny\


Any deviation from the above and it either couldn't find the jrcommon files or it couldn't find jenny.

Now, it still doesn't seem to be doing much. It does build videos.war and places it in the right directory (FYI, I deleted the existing videos.war file and ran it to make sure this part was functioning). However, nothing is being generated in ..\gen-src. Also, when I type "ant db", nothing happens. The same record I added to the database a couple of weeks ago is still there. I can manual run the dropAllTables.sql file and it will work, but not when I use jenny to do it.

BTW, Marilyn, I sent the build.xml file to you.

Thanks!
[ May 01, 2007: Message edited by: Matt Fry ]
Carol Murphy
village idiot
Bartender

Joined: Mar 15, 2001
Posts: 1195
Matt, I'm going to stand back and let you take point on this assignment. I just don't think I can handle any more frustration in my life right now. I'm still getting caught up with my "new" system, and I think I'm dogging it a bit because Jenny looms very large on the horizon! ( That and working 48+ hours a week right now )
Good luck!
Matt Fry
Ranch Hand

Joined: Mar 06, 2006
Posts: 60
Sounds like a plan, Carol. I'm going to get this thing figured out eventually. I'm getting close to the end of the drive and I really want to finish it. It's been hard here lately trying to find time to do it but it looks like I may be able to find some time now. My computer at home is old and slow so I prefer to work on it here at work when I can.

I'm enjoying the database part of the drive. I think I've got most of the stuff figured out, I just have to get the hang of ant and Jenny.

Good luck to you as well!
Matt Fry
Ranch Hand

Joined: Mar 06, 2006
Posts: 60
Originally posted by Matt Fry:
O.K. I got it to give a "Build Successful" message like I did before. I had to set my classpath EXACTLY to

Any deviation from the above and it either couldn't find the jrcommon files or it couldn't find jenny.

Now, it still doesn't seem to be doing much. It does build videos.war and places it in the right directory (FYI, I deleted the existing videos.war file and ran it to make sure this part was functioning). However, nothing is being generated in ..\gen-src. Also, when I type "ant db", nothing happens. The same record I added to the database a couple of weeks ago is still there. I can manual run the dropAllTables.sql file and it will work, but not when I use jenny to do it.

BTW, Marilyn, I sent the build.xml file to you.

Thanks!

[ May 01, 2007: Message edited by: Matt Fry ]



Any idea(s) what's going on here?
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9046
    
  10
I got it, Matt. Just haven't had a chance to look at it yet. Very soon.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Trouble with Jenny