Debugging a jax-ws client in eclipse - java

I am writing a java client for a web service. I used wsimport to generate the proxies. Copied them over to my workspace project (in eclipse). Wrote a simple program using couple of ws calls. Now when I want to step into a soap call, eclipse says that source code for the file was not found (com.sun.xml.internal.ws.client.sei.SEIStub.class). It's using this class from rt.jar which is pointing to the src.zip that came with the installation. I noticed that src.zip does not contain the missing java files, so I downloaded them separately and tried adding them to zip file. I also tried copying them over to my project to see if I can trick eclipse into accepting them as the source file.
I don't write/debug Java on a regular basis so please help me out here. I really want to debug and see what jax-ws is doing differently from axis as the call works in the later implementation.

I believe that you can set the following System property to put JAX-WS in debug mode.
com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump=true
See JAX-WS Guide - Logging.

Related

How to get Google GIN working with Google-Eclipse plugin in DevMode?

I am experimenting with my first GWT app that uses GIN. I am essentially mimicking the exact same source code example found in their Getting Started tutorial. At the end of that tutorial, the author mentions that you need to supply the the GWT compiler with a classpath pointing to the compiled Java binaries. The example they use for doing this is done using an Ant target.
Although I will have an automated (Ant-driven) build that also emulates this build task, I want to be able to run/debug my GWT apps from inside of Eclipse without having to kick off an Ant build.
So I ask: when running my GWT app inside Eclipse (Dev Mode), how do I configure the GIN library to point to the compiled classes? Thanks in advance!
All you should need to do is add the gin.jar (and dependencies, probably just guice.jar) to your project's classpath.
It should not be required to copy these to WEB-INF/lib/, though depending on your server setup, you may require guice.jar there, but never gin.jar.

Lotus Domino Java Script Library Compile Error

I had an issue where I was getting the following error in the Problems view when attempting to save/compile a Java script library in a DB held on a server. I'm using DDE 8.5.3 (Note, I've changed the app and the lib names):
Project 'app_name.nsf.java-lib-name.javalib' is missing required library: 'C:\lotus\notes8\jvm\lib\axis\axis.jar'
It's worth noting that I'm using the Eclipse based Java editor, this issue doesn't happen if I use the traditional editor.
My script library had a number of JAR files associated, however none of them were included via the path which appeared to be causing the issue. Also it couldn't have been some deeply concealed dependency thing as all of the included JARs are custom built and none of them user or require Axis.
I also did a test creating a fresh library without pulling any external JARs in and the same error occurred.
It turns out the problem was being caused by the use of "JavaUserClassesExt" in my local notes.ini. I've recently been using a LN client app which depends on Axis and part of the install process includes dropping the relevant Axis files into a custom directory within jvm/lib/ext and then updating the ini to include those files using "JavaUserClassesExt" when launching the JVM.
I guess the issue has only shown up now because I've recently had to change the location of my LN install from the path indicated above (lotus\notes8) to something slightly different (lotus\notes853). I copied my ini across from the original install location which is why it still references the old path. Once I removed the references to the wrong path, the error cleared up.
So I can kind of understand what is happening, the JVM is attempting to load all required files on the classpath but is running into an issue because the files being requested via "JavaUserClassesExt" can no longer be found.
What I don't understand is why it's throwing this error when I'm attempting to edit a script library in a completely different database which has nothing to do with the Axis framework. I'd expect a compile error if trying to import anything to do with Axis based on it being on my local classpath, but to throw this error when the library has nothing to do with Axis seems confusing and incorrect to me.
As I mentioned, this only happens when using the Eclipse based Java editor so I presume this is a bug with that version of the editor.
Has anyone come across anything similar? Would this be classed as expected behaviour or can anyone confirm if this is a bug?
I realise this is a pretty edge case issue but would be interested in any insight.
Cheers,
Lee

Eclipse Java Remote Debug: How do I ensure that the code I've got in my project is the same as the code running in the JVM?

I've got some existing source code, and jars for a webapp. I am attempting to run the webabb using tomcat and then remote debugging the tomcat server using eclipse to figure out what is happening with the webapp.
For some reason however, eclipse refuses to trap any breakpoints. I've compared the md5sums of the jars on the server with the ones I've got in my debug project, and they match.
Is there some way I can ask eclipse to reconcile the java classes in the remote JVM with the java classes in the local jars and make sure they correspond. Or, perhaps, more specifically, whether the code associated with breakpoints I've set have actually be loaded into the remote JVM?
Check that on the Java Compiler properties page for the java projects in question that the class file options are all checked (you only need the first three but having all five checked is a good thing for debugging)

How to wadl2java these days?

I have real difficulty finding commandline tool to convert WADL to java. No matter how much I try to google, follow blogs or java.net doc, there is no real download link. (links are broken or obsolete).
What particular vendor, community group is supplying this tool ? Does free download link exist ?
The generated code should be able to reconstruct POJOs from XML responses and survive inside Tomcat 7.
Thank you
Answer: (this works only after June 2011):
Take Apache-CXF-2.4.1.zip (not any of the earlier versions)
Extract it to root folder
Take Apache-CXF-2.4.1.src.zip
Search for folder named distribution inside src
Extract ditribution folder and merge it with no overwrites to root folder
goto bin and spot the wadl2java.bat
run wadl2java.bat from command prompt
continue with no brainer details
Apache CXF recently added support for WADL-first development of REST services. For more background information on its wadl2java tool, this blog entry by one of the CXF committers should help.
I had some trouble using the CXF 2.5.4 wadl2java tool. It kept complaining of a missing "resources" element in my WADL file, even though it contained one.
wadl.java.net has a download of wadl2java that worked for me.
Just to give an update with CXF version 3.2.1 it worked for me.
Steps are
Download anywhere
Unzip
Go to /bin
Run wadl2java to get the usage
Run wadl2java -p com.x.y.z wadl-file.xml to generate your classes in current directory.
By the way I noticed that it created a class with a space in the name and also created classes with name starting with digits :)
As of Apache CXF version 2.7.11 just download the binary zip / tar.gz, set CXF_HOME env-var to /path/to/apache-cxf-x.y.z and wadl2java is available at $CXF_HOME/bin
For generating client side stubs from WADL, use a tool wadl2java.
Download wadl tool from here:-
http://search.maven.org/remotecontent?filepath=org/jvnet/ws/wadl/wadl-dist/1.1.5/wadl-dist-1.1.5-bin.zip.
For genearting client side java stubs(POJOs), use this command:
\wadl2java -o .\src -p com.test.client WADL_FILE_LOCATION
If you are using maven project then you can use wadl2java maven plugin for this work.

How do I reference libraries in NetBeans?

I have a Java Web Services project that was created in an older version of NetBeans, and I haven't accessed it in many months, so my paths and installed libraries are different.
When I try to open the project, I get a "Resolve Reference Problems" dialog, and two Reference Problems are listed:
"metro" library could not be found
"JAX-WS-ENDORSED" library could not be found
I have a fresh installation of JDK 6 Update 25 with NetBeans 7.0, and am running Windows 7.
What steps can I take to solve this? I don't even know where to start, as every approach I've taken so far hasn't gotten me anywhere.
Note: JAX-WS-ENDORSED does not appear in my Libraries listing, so I can't remove it. Something hidden is referencing it. How would I find this?
I just came across this issue and found some help from http://netbeans.org/bugzilla/show_bug.cgi?id=187145. Apparently, Netbeans will create the JAX-WS-ENDORSED library when a new web service is created. So go to File > New File, choose Web Service > Web Service Client and fill in dummy values (this can be done in a throwaway project). This client can then be removed, and Netbeans will have created the library with the following classpath entries:
java/modules/ext/jaxws22/api/jaxws-api.jar
ide/modules/ext/jaxb/api/jaxb-api.jar
These are relative to your Netbeans install directory (on OS X will be located in Contents/Resources/Netbeans within the .app). Alternatively, you could create the library manually using the entries above.
This only needs to be done once, as the library will be added to Netbeans Global Libraries list.
The best solution is to edit project.properties file and replace below piece of code.
Original property: endorsed.classpath=\${libs.JAX-WS-ENDORSED.classpath}
Replace with: endorsed.classpath=\${lib.JAX-WS 2.2.classpath}
In older versions of Netbeans there is JAX-WS-ENDORSED library in libs location.
Newer versions of Netbeans having JAX-WS 2.2 library in lib folder
** ALL THE BEST **
If it is still needed, I had the same situation when opened a netbeans 6.9 project in netbeans 7. There is no way to resolve the 'jaxb-endorsed' (in my case was jaxb and not jaxws) reference using the libraries window.
I found a endorsed.classpath property in the nbproject/project.properties file.
I still not sure what is its purpose, but in this property I found the bad reference to jaxb-endorsed.classpath, so I deleted, closed netbeans and opened again, and the reference problem has gone.
I already have Jaxb 2.2 library added to my project, so it is working good with the modification I did to the project.properties.
I hope it helps.
I had a similar problem : DO NOT DELETE THE JAX-WS-ENDORSED - remind me to downvote. I had to go to the imported project > resolve reference
problems dialogue > delete the references from there which were pointing to the old NB folders - pic :
and then create the throwaway web service as suggested by William Scott and then add the newly created jars :
Netbeans maintains a set of libraries, which are simply a convenient way to manage groups of related jar files. Start by clicking Tools > Libraries. You will see the library manager window.
You will see the options to add your own libraries if you have jar files downloaded. If you do not see the library that you are looking for you can download them and add them your self. Once the library exist in Netbeans you can go to the Project Explorer window and right click on the Libraries tab of your project. Select Add Library and you will have the chance to add the library that you added in the library manager.
You may want to right click on your project, go to properties -> Libraries.
Remove the JAX-WS-ENDORSED library, and try using JAX-WS 2.2
Also remove metro and try adding METRO 2.0
That may solve your problem.
You may also want to right-click on your web service references and select
Edit Web Service Attributes
Then on wsimport Options tab see if xendorsed is set to true.
UPDATE
You may need to close netbeans and then open it again, and it may work. I was having a problem similar and I just did that and it worked.
The only difference, and it may not be needed, is that I also added the JAXB 2.2 library, but that was because I was trying to solve a compilation error.
I had same problem and Fix it by install soap webservice and and resful webservice in netbeans plugin
I fix it:
unistall netbeans.
delete HOME/.netbeans and HOME/.nbi
then install netbeans again
Old thread, different and effective solution... I just moved some projects from one system to another and got this error. With NetBeans v7.3+, go to Tools>Plugins, Available Plugins, then search for "SOAP". You should see "SOAP Web Services". On loading this library you'll get the JAX-WS-ENDORSED library. Restart NetBeans and you should be able to get a Clean Build.
Loading this package brings in a number of other libraries. On restarting the IDE you may get a notification that other packages now have available updates.
Do the following ( BTW in my case its NetBeans 6.9.1 )
1 Why this appeared now ?
Because i tried to open project on other pc with fresh copy of net bean
2 How the problem looks like ?
Jar Lib Not Found for JAX-WS-ENDORSED
3 Why it was needed at the first place and what its used for?
Well i have a webservice on same server/domain e.g localhost , so of course
it will work if i removed the web service from the folder in sources but i need it
4 What to do?
Try to add dummy any online free web service in form wsdl
like Some test web service or search for any other one
This is the source of my public free to use wsdl
5 What then ?
Just add it please
Now what ?
Wait for scanning project stuff it should be ok
you can re check from library properties of project
or see that there is no red/ or resolve references problem
in project properties
So what happened exactly?
Note: JAX-WS-ENDORSED it will be added automatically to your libraries
same methodology can solve other problems as well

Categories

Resources