Meaningless Drivel is fun!*
The moose likes Ant, Maven and Other Build Tools and the fly likes Unable to parse setupCmdLine: null\bin\setupCmdLine.bat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Unable to parse setupCmdLine: null\bin\setupCmdLine.bat" Watch "Unable to parse setupCmdLine: null\bin\setupCmdLine.bat" New topic
Author

Unable to parse setupCmdLine: null\bin\setupCmdLine.bat

Jay Abrahm
Ranch Hand

Joined: May 28, 2008
Posts: 183
I have an application developer on RAD 7 IDE. I am trying to setup ant using a ant snippet that I got online. However I get the following error.

BUILD FAILED
build.xml:52: Unable to parse setupCmdLine: null\bin\setupCmdLine.bat (The system cannot find the path specified.)

I tried setting the user.install.root to C:\Program Files/IBM/SDP70/runtimes/base_v61/ and restarting RAD but it still does not solve the problem.

This is the ant script that I have used. Is there some other environment variables that I need to set

Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

You're mixing your forward slashes and backwards slashes for a start....


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5823
    
    7

Don't use backwards slashes in Ant strings - a backwards slash is an escape character used in combination with the following character (to see what happens, do an 'echo' of property 'was_home'). Change them all to forward slashes.


JBoss In Action
Jay Abrahm
Ranch Hand

Joined: May 28, 2008
Posts: 183
I know this is a really delayed response. Sorry about that and thanks for responding. Got stuck in some other issues (Yep I know 1 month is too long to get stuck)

I fixed the backslash issue as shown in the build file below



But I still get the following error


Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

I'm not 100% sure where this .bat file is supposed to reside (I can't see it referenced directly in your build script). I assume its hte WAS home that it's not resolving, this _may_ have something to do with the fact that you have a space in your CLASSPATH e.g. "c:/Program Files/..."
Jay Abrahm
Ranch Hand

Joined: May 28, 2008
Posts: 183
Thanks.. I started searching for that file and this is what I found

http://www-01.ibm.com/support/docview.wss?uid=swg1PK07628

C:\Program Files\IBM\SDP70\runtimes\base_v61\profiles\AppSrv01\bin>ws_ant -buildfile C:\Project\ProjectWeb\src\build.xml runs fine.

Still waiting for the run to complete


Jay Abrahm
Ranch Hand

Joined: May 28, 2008
Posts: 183
The deployment didn't complete. I ran into a new issue

Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

I'm quite suspicious of the the whole shortening of paths e.g. "C:\DOCUME~1\132522\LOCALS~1\Temp\wsant45684jacl" and the spaces in directory names, I've had a lot of problems with that in the past (with various app servers). That's about the only advice I can give on this I'm afraid.
Jay Abrahm
Ranch Hand

Joined: May 28, 2008
Posts: 183
Ahaa !! Thanks you did lead me there... application.xml did not match build.xml in the ear names... Build is now successful.



Now all I need to figure out is the right folder to place the ear in



Any idea on where this needs to go. I deployed using RAD and searched for all the locations of the ear and this is what I got. Which one should I place the generated ear in.
C:\Program Files\IBM\SDP70\runtimes\base_v61\profiles\AppSrv01\installedApps\01hw081678Node01Cell
C:\Program Files\IBM\SDP70\runtimes\base_v61\profiles\AppSrv01\config\cells\01hw081678Node01Cell\applications
C:\Program Files\IBM\SDP70\runtimes\base_v61\profiles\AppSrv01\temp\01hw081678Node01\server1
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

I would guess 1 or 2, the 3rd choice looks like the app server temp working space.
Jay Abrahm
Ranch Hand

Joined: May 28, 2008
Posts: 183
I tried both the locations but it doesn't seem to work.

How do I verify if it is installed properly, currently I just check the application to see if it is running (which in my case throws a 404).

Would the installed application show up in the WAS admin console opened up from RAD ?

Any idea on how to proceed ?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

Helpful hints:

1. Forward slashes work for both Windows and the various Unix OS's in Java and you won't get burned by having them misinterpreted as escape characters. Actually, they probably work for ALL OS's supporting hierarchical filesystems, but those are pretty much the only 2 left standaing now that the Mac is basically Unix. Even more - Windows itself will often honor forward slashes in filepaths as though they were backslashes. Obviously that doesn't include cases where the slash might be interpreted as a command-line switch, but in internal app code, you might be surprised. This has been the case since NT 4.0.

2. Pay attention to upper/lower case. While Windows itself is insensitive, Java code almost universally isn't - regardless of OS. And PLEASE, it's
WEB-INF", not "web-inf" or "Web-inf". That kind of sloppiness has caused me more problems, because it works on Windows, but if you deploy to Linux/Solaris, it doesn't. And when an IDE project gets transferred, Unix-style systems may end up with components splattered between 2 (or more!) different directories, depending on who/what put them there and under which OS.

3. Pathnames with embedded spaces in them are major pain, Since the command-line parsers use spaces as token breaks, a command like:

ERASE C:\PROGRAM FILES\MYPROGRAM\FILE.EXE

Actually looks to the erase function as though you'd typed:

ERASE C:\PROGRAM
ERASE FILES\MYPROGRAM\FILE.EXE

Which obviously isn't what you wanted. This problem can be especially bad in scripts where you didn't explicitly type the path, but it was inferred by the script. Use the short filename version, instead. And don't assume that "PROGRAM FILES" will always shorten to "PROGRA~1". The actual algorithm varies between different flavors of Windows, but it's not an absolute conversion, and it's not done dynamically. Instead, an alias shortname entry is created in the directory when the long-named file/directory is created. So if there had already been a C:\PROGRAM DATA directory, PROGRAM FILES might end up as "PROGRA~2", instead. This actually has happened to me, by the way.


Customer surveys are for companies who didn't pay proper attention to begin with.
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

I'll shift this to a forum that might be able to provide better assistance
Jay Abrahm
Ranch Hand

Joined: May 28, 2008
Posts: 183
Thanks Martijn for all your help.

Tim, I did face most of what you have mentioned and have gone past them. I am able to build the ear properly and use com.ibm.websphere.ant.tasks.InstallApplication without any errors.

Guess, my issue to is know "where to place the ear" and "how to test" if the ear is working right (other than trying the URL)
Jay Abrahm
Ranch Hand

Joined: May 28, 2008
Posts: 183
I think I have been able to answer some of my questions

where to place the ear ? Any location. was install picks it up and moves it to the required destination folder
C:\Program Files\IBM\SDP70\runtimes\base_v61\profiles\AppSrv01\config\cells\01hw081678Node01Cell\applications

How do we test the ant deployed app? What got me confused is that I assumed that the server view will also be refreshed with the deployed projects but WAS does not do that. Ant tasks will only update the server view to show whether the server is started. In order to see when the application has been deployed and started, the admin console needs to be used.

I still get a 404 error for the application and these are the logs that I get (C:\Program Files\IBM\SDP70\runtimes\base_v61\profiles\AppSrv01\logs\ffdc\server1_4b5c4b5c_09.03.10_13.10.28_2.txt)



Any inputs on how to troubleshoot would be helpful.
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

How is your EAR file laid out? How is your context root for your web app defined? The error message is telling you it can't find /Main/welcome.action, so you need to check your paths, layout, context root carefully.
Jay Abrahm
Ranch Hand

Joined: May 28, 2008
Posts: 183
If it was a problem with the way the context root was defined then won't the application not work if I start the application using RAD's administrative console. But it does work !!

I have listed the application structure which has 3 projects within the workspace(which builds into the project EAR). Please let me know if I need to provide any additional information.

Business
|--src
|--application.properties
DAO
|--src
|--dao.properties
PROJECT
|--META-INF
|--application.xml
PROJECTWeb
|--src
|--build.xml
|--struts.xml

I might be going off track here - Before I had got a different 404 error. I had got a lot of compilation errors for which I had added two more src folders to the javac as below.



Is this definition wrong or am I missing something.
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Where is the welcome.action file?
Jay Abrahm
Ranch Hand

Joined: May 28, 2008
Posts: 183
That would be in

ProjectWeb
|--src
|--com.project.WelcomeAction.java
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Hmm, this seems like a servlet mapping or struts mapping problem now, check your web.xml and struts.xml to make sure that your URL maps correctly to the action.

Disclaimer, long time ago since I looked at struts and servlets, hopefully someone else chimes in as well.
Jay Abrahm
Ranch Hand

Joined: May 28, 2008
Posts: 183
I should have heeded the "ear laid out" advice earlier. My ear structure is different. When I use RAD to generate the ear it contains
Business.jar
Dao.jar
META-INF
ProjectWeb.war

But the ear that I have created using ant does not have these two jars.
META-INF
ProjectWeb.war

I used this ear created from RAD to run WAS tasks installApplication,stopServer,startServer,startApplication and the application works fine!!! Thanks again for the words of wisdom :-)

So working on fixing up my EAR creation task in ant. Is there any particular ant task that I need to be using for this ?
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Congrats! Yes there is help within Ant, see here
Jay Abrahm
Ranch Hand

Joined: May 28, 2008
Posts: 183
Its not over yet ;-)



This does not seem to pick up the src file inside the DAO project which is required to compile the Business project. I get a
package com.project.dao does not exist exception
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Items on the classpath need to be compiled classes and/or jars, not source code
Jay Abrahm
Ranch Hand

Joined: May 28, 2008
Posts: 183
Thanks again.. the code below works now



The application works fine if I use Ant to install the application using the ear that I generated from RAD.
But I get a 404 for the ear that I have generated from Ant. As you had posted earlier I had gone through the ear's as best as I could but didn't find anything amiss. Any idea what I need to be looking for ? I get the feeling that the error message isn't reflecting what the underlying problem is


Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

OK, well it seems to not be loading the JAR with the UserService class.

1.) Double check that the JAR is in the EAR at hte appropriate location
2.) Generate the EAR from RAD and then from ANT
3.) 'Unzip' the EARs from both builds and use a diff utility to see what the difference between them is

I suspect that the RAD generation of the EAR probably does some extra magic (maybe adds some config) that you need to effectively replicate in the ANT build.

Hope that made sense!
Jay Abrahm
Ranch Hand

Joined: May 28, 2008
Posts: 183
Makes sense but seems very painful ;-).

I have started doing a diff and also ripped open the ear. Will replace jar/folder at a time to see what makes it fail.

Not fun !!
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

It's definitely brute force, but you EAR files must be differing somehow and if eyeballing it doesn't work then sometimes diff is the only answer
Jay Abrahm
Ranch Hand

Joined: May 28, 2008
Posts: 183
Very very painful but I eventually got the wrong doer. EAR\ProjectWeb\META-INF\MANIFEST.MF had

instead of


So updated the code to


Alright, I am all done. I am mighty pleased with myself or should I be since I took some time to get this up and running.

Thanks Martijn, I owe you a beer !!. Also, I wouldn't want all this effort wasted. Do you think this post makes more sense in the Ant forum. Maybe I could post my complete Ant script later on, once I get to clean it up or is there someplace else that I can put up my scripts.

Again, thanks for all the help.
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Glad to hear it's all worked out! I will move this to the ANT forum as most of your issues were related to that

Happy coding!
Jay Abrahm
Ranch Hand

Joined: May 28, 2008
Posts: 183
Hopefully someone else would benefit from the Ant scripts below.
http://techreviewer-reviewland.blogspot.com/2009_03_01_archive.html

Also, comments/best practices, on how these scripts could be improved are always welcome.


 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Unable to parse setupCmdLine: null\bin\setupCmdLine.bat