This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Web Services Certification (SCDJWS/OCEJWSD) and the fly likes Setting up Eclipse and GlassFish for executing Web services program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Web Services Certification (SCDJWS/OCEJWSD)
Bookmark "Setting up Eclipse and GlassFish for executing Web services program" Watch "Setting up Eclipse and GlassFish for executing Web services program" New topic
Author

Setting up Eclipse and GlassFish for executing Web services program

Jolly Tiwari
Ranch Hand

Joined: Mar 26, 2006
Posts: 77
Hi!

I was trying to configure environment for running ivan's guide code snippet.
Can any body guide me which version of Eclipse and Glass Fish , I should download to make them run.
I am totally new to GlassFish and please tell me how i can integrate glass fish with Eclipse.


Thanks & Regards
Jolly




Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
When writing the notes I used GlassFish 2.1, which at that time seemed to be the most complete, stable release of GlassFish. I suspect that v3 should be fine too, but I haven't verified it with the programs in the study notes.
I suggest you to get the most recent version of Eclipse and then you need to install the GlassFish plugin, which you can install using the following update URL:
http://ajax.dev.java.net/eclipse
Note that you probably have to use the above, workaround, update site. At least I had problems with the original update site from which the GlassFish plugin was supposed to be downloaded.
Here is a tutorial that shows you how to develop for GlassFish in Eclipse (Ganymede): http://weblogs.java.net/blog/2008/06/27/glassfish-eclipse-ganymede
Let me know if you run into any other problems!
Best wishes!
nav katoch
Ranch Hand

Joined: May 02, 2008
Posts: 246

Hi Ivan,

Thanks for your time. I am practicing your webservices example from your study notes but I am not able to plugin xjc generator in eclipse 3.4. Any help will be appreciated.

@ Moderators, I think this is a part of this thread per my opinion. Please never mind for not starting a new thread.

Thanks again for any inputs by anybody.

Naveen Katoch
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hello!
Have you seen this webpage: https://jaxb-workshop.dev.java.net/plugins/eclipse/xjc-plugin.html
What kind of problems do you have?
Personally, I have never had any problems with the XJC plugin, even though it is not entirely new.
Note that you want to use version 1.1 of the Eclipse plugin,which is based on JAXB 2.1.
Best wishes!
nav katoch
Ranch Hand

Joined: May 02, 2008
Posts: 246

Hi Ivan,

Thanks for your reply. I appreciate it. I have followed the same link and steps but when I right the XmlServiceSchema.xsd file in the eclipse 3.4 it doesn't show the JAXB 2.1 → Run XJC. This is the problem I am facing. If you have any idea please make me understand.

Thanks and kind regards,

Naveen Katoch
nav katoch
Ranch Hand

Joined: May 02, 2008
Posts: 246

@Ivan, I fixed it. When I unzipped the plugin in the eclipse's plugin folder and it created one more folder of plugin folder under plugin of eclipse. So It was not loading that plugin in the eclipse and when I just put one file from new plugin folder in eclipse's plugin folder, then its working fine.

Thanks for your time and nice study materials.

Naveen Katoch
Jolly Tiwari
Ranch Hand

Joined: Mar 26, 2006
Posts: 77
Hi! Ivan,


I have downloaded glassfish tools bundle for Eclipse 1.1 and have installed it.I started trying out
First code from your guide(First code from sec 4.7 creating web services with JAX-WS)
As i am new to this IDE environment my questions may seem a bit trivial to you people,i had been coding
on textpad and using Web logic as a app server.Any ways..

Inside my workspace I am able to see four directories .settings,build,src,WebContent

I have written a file through IDE, com.instinct.Calc(.java ) and it is placed in src directory

I wrote a build.xml file following your instructions and placed it within src/com/instinct/

So I have got 2 files inside src/com/instinct/
calc.java(SIB)
build.xml

After right clicking on the build.xml file and then clicking on Ant build file the files
are generated in the designated locations mentioned in the build file.

Now my concerns are regarding this:

<!-- Default output directory for artifacts generated by wsgen. -->
<property name="wsgen-outdir" value="${basedir}/build/wsgen-output/"/>
(Section from build.xml from your guide)

After execution of build.xml ,I am able to see two directories in build directory.
classes folder and wsgen-output folder
I am able to see requestWrapper and responseWrapper classes in wsgen-output directory

1. As you have told to edit them i am not able to view them inside my IDE so shall i update them
out of the IDE and compile them separately?


2. As these wsgen classes are residing in the wsgen-output folder inside build folder.and classes folder is also
at the same level at wsgen-output.So will the runtime environment able to find those classes as they are not
within classes folder.


3. When I am trying to deploy this project by clicking on RunAs it fails saying Unable to find CalcSrvc.wsdl even
though CalcSrvc.wsdl has been generated within WebContent/WEB-INF folder


Please guide me in getting started and please correct me where ever I have commited some mistake during all this .


Thanks and Regards

Jolly
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Sorry about the delayed response, I did not see the question until now.

1. As you have told to edit them i am not able to view them inside my IDE so shall i update them
out of the IDE and compile them separately?

No, note that the source output directory is set to the src directory in the root of the Eclipse project. You should thus be able to see the generated source code files in the Eclipse project browser. This may require that you refresh the project view for the project in question - right-click on it and select Refresh.
If you do not see the source files after having refreshed, please verify that the source directory of the Eclipse project indeed is src in the root of the project.

2. As these wsgen classes are residing in the wsgen-output folder inside build folder.and classes folder is also
at the same level at wsgen-output.So will the runtime environment able to find those classes as they are not
within classes folder.

See the answer for 1. There should be generated source code files, which Eclipse will compile and place the classes files in the proper location.

3. When I am trying to deploy this project by clicking on RunAs it fails saying Unable to find CalcSrvc.wsdl even
though CalcSrvc.wsdl has been generated within WebContent/WEB-INF folder

Note that the Ant script in my notes is to write the generated WSDL file to the WEB-INF/wsdl/ folder in the project.
I suspect that because of the above problems, the project will have problems when being deployed.
If you still have problems after having fixed the issues under 1 and 2, please ask again!
Best wishes!
Jolly Tiwari
Ranch Hand

Joined: Mar 26, 2006
Posts: 77
Thanks Ivan...

your piece of advice really worked

Actually i was not refreshing the work bench but why was it not reloading the whole environment
when we reopen it after closing, I mean it should take the current configuration and show all
the artifacts.
Anyway i am able to run basic Web service now using Eclipse and glass fish.
I have few more queries regarding it:

1.following your example i made a wsgen-output directory inside the build folder (now i am having two directories inside build:-classes and wsgen-output).
build
|
---classes
|
---wsgen-output
in this wsgen-output directory i am clearly viewing those wrapper classes .
Though my program is running fine , But i want to understand how server Run time environment is able to
use those generated classes when they are not even inside the classes folder.I mean how does it pick those wsgen generated classes residing in wsgen-output folder inside build?

2. Where can we find that bundled(archieved) file for the web service application inside the glassfish server environment.it would be keeping it somewhere at the time of deployment.I am not able to find out that.

3.I am using glassfish tools bundle for Eclipse 1.1 to try out your code snippets.
it contains two server versions
glassfish server v2.1
glassfish server v3 preclude

I am using glassfish server v2.1.is it fine?

Please guide me on the above mentioned points..

Thanks and Regards

Jolly


Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Jolly Tiwari wrote:your piece of advice really worked
Actually i was not refreshing the work bench

Good to hear!
I have my Eclipse configured to auto-refresh the work bench, so I forgot about it.


Though my program is running fine , But i want to understand how server Run time environment is able to
use those generated classes when they are not even inside the classes folder.I mean how does it pick those wsgen generated classes residing in wsgen-output folder inside build?

As I said before, the source code output directory of the wsgen command is set to the source code directory of the Eclipse project, so the generated code will "magically" appear in your project. Note that what appears in the build/classes directory are the compiled class-files of the generated classes.

2. Where can we find that bundled(archieved) file for the web service application inside the glassfish server environment.it would be keeping it somewhere at the time of deployment.I am not able to find out that.

Look in the domains/domain1/applications or domains/domain1/autodeploy directories in the GlassFish installation directory. This assumes that your domain is named "domain1".


I am using glassfish server v2.1.is it fine?

That is the one I have been using when developing the examples for my study notes, so it should be just fine!
Best wishes!
Jolly Tiwari
Ranch Hand

Joined: Mar 26, 2006
Posts: 77
Hi! Ivan,

Note that what appears in the build/classes directory are the compiled class-files of the generated classes.


Perhaps i am not able to claear my query.Actually my concern is about the generated wrapper classes which
are residing in the wsgen-output dierctory which is inside build directory but outside classes directory.
how does these wrapper classes generated by wsgen get bundled (being outside classes directory)

Regards

Jolly
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Yes, I understood your question. I don't know what you have done in your project, but the way I set things up when writing the tutorial, the source files are to be generated to the source directory (src) in an Eclipse project. If you use a different setup or development environment, then you can either:
- Modify the Ant script so that the source code is generated to the proper location.
or
- Copy the generated source code files from the location where they were generated to the location where you want them to be.

This is not something that happens automatically, you have to use one of the above approaches.
Best wishes!
vasu mannem
Ranch Hand

Joined: Dec 11, 2003
Posts: 38
Ivan,

I am trying to run the examples given in your study notes.. installed glassfish tool bundle with eclipse ide.

https://jaxb-workshop.dev.java.net/plugins/eclipse/xjc-plugin.html


to create java bean classes from XSD, trying to download XJC plug in for eclipse but the given link/url is not working..

do you know where I can get the XJC plugin to run the example from 9.4 section of your notes.

thanks


VasuM.
SCJP, SCBCD,ITIL
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Already answered this here: http://www.coderanch.com/t/522497/java-Web-Services-SCDJWS/certification/Environment-setup-SCDJWS
vasu mannem
Ranch Hand

Joined: Dec 11, 2003
Posts: 38
Hi

any one from javaranch can help me to do the best setup to prepare the scdjws 5 exam

your help would be appriciatable....

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Setting up Eclipse and GlassFish for executing Web services program