[GLASSFISH-18751]  wsgen and wsimport do not work due to tool.jar not found error Created: 22/May/12  Updated: 20/Dec/16  Resolved: 11/Feb/13

Status: Resolved
Project: glassfish
Component/s: web_services
Affects Version/s: 3.1
Fix Version/s: 4.0_dev

Type: Bug Priority: Major
Reporter: tak09 Assignee: Lukas Jungmann
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


Issuezilla Id: 13,762
Tags: metro2_2_1-waived

 Description   

run those command will show some messages, but we couldn't find them in
glassfish workspace:

C:\glassfish3\glassfish\bin>wsgen
JDK's tools.jar was not found in C:\Program Files\Java\lib\tools.jar. Usually th
is means you are running JRE, not JDK. Please use the java command in JDK 5.0 or
later (not JRE.)

  • This command executes com.sun.tools.ws.WsGen could not find iWsGen.java in
    source code
    -------------------------------------------------

C:\glassfish3\glassfish\bin>wsimport
JDK's tools.jar was not found in C:\Program Files\Java\lib\tools.jar. Usually th
is means you are running JRE, not JDK. Please use the java command in JDK 5.0 or
later (not JRE.)

-same, could not find com.sun.tools.ws.WsImport.java
-------------------------------------------------

C:\glassfish3\glassfish\bin>schemagen
JDK's tools.jar was not found in C:\Program Files\Java\lib\tools.jar. Usually th
is means you are running JRE, not JDK. Please use the java command in JDK 5.0 or
later (not JRE.)

-same, could not find com.sun.tools.jxc.SchemaGeneratorFacade.java



 Comments   
Comment by tak09 [ 22/May/12 ]

wsimport and wsgen do not work due to tool.jar not found error. I found GLASSFISH-13762 and the status is resolved but it's still not working.

GlassFish version is 4.0 b36

Comment by tak09 [ 22/May/12 ]

With version 4.0, wsimport and wsgen fails with this error, but schemagen works.

C:\glassfish\glassfish-4.0-b36\glassfish3\glassfish\bin>wsimport
JDK's tools.jar was not found in C:\Program Files\Java\lib\tools.jar. Usually this means you are run
ning JRE, not JDK. Please use the java command in JDK 5.0 or later (not JRE.)

C:\glassfish\glassfish-4.0-b36\glassfish3\glassfish\bin>wsgen
JDK's tools.jar was not found in C:\Program Files\Java\lib\tools.jar. Usually this means you are run
ning JRE, not JDK. Please use the java command in JDK 5.0 or later (not JRE.)

C:\glassfish\glassfish-4.0-b36\glassfish3\glassfish\bin>schemagen
Usage: schemagen [-options ...] <java files>
Options:
-d <path> : specify where to place processor and javac generated class files
-cp <path> : specify where to find user specified files
-classpath <path> : specify where to find user specified files
-encoding <encoding> : specify encoding to be used for annotation processing/javac invocation
-episode <file> : generate episode file for separate compilation
-version : display version information
-fullversion : display full version information
-help : display this usage message

Comment by emailnbw [ 22/May/12 ]

This is broken in 3.1.2 FCS as well. I am running JDK 1.7.0_03 x64 on Windows 7.

As a work around I was able to use \Program Files\Java\jdk1.7.0_03\bin\wsimport.exe instead.

Comment by Lukas Jungmann [ 22/May/12 ]

could be related to space in path (..."program files"...) as I was not able to reproduce this earlier today while having JDK in "d:\java\sdk\jdk1.7.0_04", will try again with JDK in the default location

Comment by tak09 [ 23/May/12 ]

My JDK is installed in C:\Program Files\Java\jdk1.6.0_26

I copied the C:\Program Files\Java\jdk1.6.0_26\lib to C:\Program Files\Java\lib as a workaround.

Comment by Lukas Jungmann [ 11/Feb/13 ]

a try to fix this issue - if asadmin is working properly, ws tools should be working as well as they're now using same $JAVA_HOME:

http://java.net/projects/glassfish/sources/svn/revision/59360

Comment by tak09 [ 26/Mar/13 ]

Hi Lukas,

I've downloaded glassfish-4.0-b81-03_20_2013, but it's not working for me.

C:\>C:\glassfish\glassfish-4.0-b81-03_20_2013\glassfish4\glassfish\bin\wsimport.bat
JDK's tools.jar was not found in C:\Program Files\Java\lib\tools.jar. Usually this means you are run
ning JRE, not JDK. Please use the java command in JDK 5.0 or later (not JRE.)

When wsimport is executed from other directory, it looks working. However, JDK's wsimport is called. It's not glassfish wsimport.

C:\>"C:\Program Files\Java\jdk1.7.0_17\bin\wsimport.exe"
Missing WSDL_URI

Usage: wsimport [options] <WSDL_URI>

where [options] include:
-b <path> specify jaxws/jaxb binding files or additional schemas
(Each <path> must have its own -b)
-B<jaxbOption> Pass this option to JAXB schema compiler
.....

Comment by Lukas Jungmann [ 26/Mar/13 ]

Is asadmin.bat working?
if you run 'echo %PATH%' what is printed out?
if you run 'echo %JAVA_HOME%' what is printed out?
if you run 'where java.*' what is printed out?
if you run 'where wsimport.*' what is printed out?

Comment by tak09 [ 26/Mar/13 ]

Hi Lukas,

asadmin is working. Please see below for the outputs.

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\>where asadmin.bat
C:\glassfish\glassfish-4.0-b81-03_20_2013\glassfish4\glassfish\bin\asadmin.bat

C:\>asadmin start-domain
Waiting for domain1 to start ...............................
Successfully started the domain : domain1
domain Location: C:\glassfish\glassfish-4.0-b81-03_20_2013\glassfish4\glassfish\domains\domain1
Log File: C:\glassfish\glassfish-4.0-b81-03_20_2013\glassfish4\glassfish\domains\domain1\logs\server
.log
Admin Port: 4848
Command start-domain executed successfully.

C:\>echo %PATH%
C:\SFWCLNT\JDBC\fjjdbc\bin;C:\Program Files\CollabNet\Subversion Client;C:\Program Files (x86)\Commo
n Files\NetSarang;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\Window
sPowerShell\v1.0\;C:\Program Files\CA\SharedComponents\ScanEngine;C:\Program Files\CA\SharedComponen
ts\CAUpdate\;C:\Program Files\CA\SharedComponents\ThirdParty\;C:\Program Files\CA\SharedComponents\S
ubscriptionLicense\;C:\Program Files\CA\eTrustITM;C:\Program Files (x86)\Borland\StarTeam SDK 9.3\Li
b;C:\Program Files (x86)\Borland\StarTeam SDK 9.3\Bin;C:\Program Files (x86)\Enterprise Vault\EVClie
nt\;C:\Program Files (x86)\Mozilla Firefox;C:\Program Files\Java\jdk1.7.0_17\bin;c:\ant\bin;C:\Progr
am Files (x86)\Gow\bin;c:\ntutil\bin;c:\usr\bin;C:\Program Files (x86)\Hidemaru;C:\Program Files\Tor
toiseSVN\bin;C:\SFWCLNT\ESQL\BIN;C:\Windows\ESQL\BIN;C:\SFWCM\CM\BIN;C:\glassfish\glassfish-4.0-b81-
03_20_2013\glassfish4\glassfish\bin;C:\Program Files (x86)\QuickTime\QTSystem\;C:\SeleniumIEdriver;C
:\Program Files\TortoiseGit\bin

C:\>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.7.0_17

C:\>where java.*
C:\Windows\System32\java.exe
C:\Program Files\Java\jdk1.7.0_17\bin\java.exe

C:\>where wsimport.*
C:\Program Files\Java\jdk1.7.0_17\bin\wsimport.exe
C:\glassfish\glassfish-4.0-b81-03_20_2013\glassfish4\glassfish\bin\wsimport
C:\glassfish\glassfish-4.0-b81-03_20_2013\glassfish4\glassfish\bin\wsimport.bat

C:\>where wsgen.*
C:\Program Files\Java\jdk1.7.0_17\bin\wsgen.exe
C:\glassfish\glassfish-4.0-b81-03_20_2013\glassfish4\glassfish\bin\wsgen
C:\glassfish\glassfish-4.0-b81-03_20_2013\glassfish4\glassfish\bin\wsgen.bat

C:\>

Comment by Lukas Jungmann [ 26/Mar/13 ]

Thanks!

So it's clear that on your path there is JDK/bin first, glassfish/bin second - if you change the order, does it help?

btw: one thing I've just noticed and cannot check it immediately - you run C:\>C:\glassfish\glassfish-4.0-b81-03_20_2013\glassfish4\glassfish\bin\wsimport.bat - if you do 'cd C:\glassfish\glassfish-4.0-b81-03_20_2013\glassfish4\glassfish\bin' and then call wsimport - does it change anything?

Comment by tak09 [ 26/Mar/13 ]

I changed the order of path. It is now glassfish/bin first, then JDK/bin.

Please see the output.

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\>echo %PATH%
C:\SFWCLNT\JDBC\fjjdbc\bin;C:\Program Files\CollabNet\Subversion Client;C:\Program Files (x86)\Commo
n Files\NetSarang;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\Window
sPowerShell\v1.0\;C:\Program Files\CA\SharedComponents\ScanEngine;C:\Program Files\CA\SharedComponen
ts\CAUpdate\;C:\Program Files\CA\SharedComponents\ThirdParty\;C:\Program Files\CA\SharedComponents\S
ubscriptionLicense\;C:\Program Files\CA\eTrustITM;C:\Program Files (x86)\Borland\StarTeam SDK 9.3\Li
b;C:\Program Files (x86)\Borland\StarTeam SDK 9.3\Bin;C:\Program Files (x86)\Enterprise Vault\EVClie
nt\;C:\Program Files (x86)\Mozilla Firefox;C:\glassfish\glassfish-4.0-b81-03_20_2013\glassfish4\glas
sfish\bin;C:\Program Files\Java\jdk1.7.0_17\bin;c:\ant\bin;C:\Program Files (x86)\Gow\bin;c:\ntutil\
bin;c:\usr\bin;C:\Program Files (x86)\Hidemaru;C:\Program Files\TortoiseSVN\bin;C:\SFWCLNT\ESQL\BIN;
C:\Windows\ESQL\BIN;C:\SFWCM\CM\BIN;C:\Program Files (x86)\QuickTime\QTSystem\;C:\SeleniumIEdriver;C
:\Program Files\TortoiseGit\bin

C:\>wsimport
JDK's tools.jar was not found in C:\Program Files\Java\lib\tools.jar. Usually this means you are run
ning JRE, not JDK. Please use the java command in JDK 5.0 or later (not JRE.)

C:\>C:\glassfish\glassfish-4.0-b81-03_20_2013\glassfish4\glassfish\bin\wsimport.bat
JDK's tools.jar was not found in C:\Program Files\Java\lib\tools.jar. Usually this means you are run
ning JRE, not JDK. Please use the java command in JDK 5.0 or later (not JRE.)

C:\>cd C:\glassfish\glassfish-4.0-b81-03_20_2013\glassfish4\glassfish\bin\

C:\glassfish\glassfish-4.0-b81-03_20_2013\glassfish4\glassfish\bin>wsimport
JDK's tools.jar was not found in C:\Program Files\Java\lib\tools.jar. Usually this means you are run
ning JRE, not JDK. Please use the java command in JDK 5.0 or later (not JRE.)

C:\glassfish\glassfish-4.0-b81-03_20_2013\glassfish4\glassfish\bin>

Comment by tak09 [ 29/Apr/13 ]

When are you fixing this one? I have downloaded Glassfish b87 04_25_2013 but this bug is not fixed yet.

Generated at Thu Jan 19 00:40:05 UTC 2017 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.