- This topic has 11 replies, 4 voices, and was last updated 14 years, 8 months ago by Scott Anderson.
-
AuthorPosts
-
MorkParticipantI am trying to debug the problem I posted below that Support did not reply to (NullPointerException on @Resource WebServiceContext wsContext;)
I tried to create a new web service using the tutorial.
I copied in my single Java web service program with its various methods.
I generated a “new web service” using the MyE facility saying to use a bottom-up approach and to generate the wsdl.
I then deployed to Tomcat 6.
However, when I try to get the wsdl in the browser, I get this:
type Status report
message
description The requested resource () is not available.’
——-
Seems to be a jaxws problem of some type.
What am I doing wrong?
Why can’t MyE generate the artifacts from my single Web Service logic (the code is successfully deployed elsewhere).
SUPPORT – Please respond, OK????
Thank you.
— M
Scott AndersonParticipantMork,
Sorry for the delay in response. Unfortunately, we multi-task our developers onto 2nd level support and basically this question needs research at that level and those guys are tied up with the MyEclipse 8.5 release (which should go out tomorrow). I’m not trying to make an excuse, just explain a bit about why we sometimes get slow on the forums.
As for replicating what you’re seeing, without your “single Java web service program with its various methods”, it’s going to be difficult. Do you perhaps have a simplified test case you can share that exhibits your question without sharing anything proprietary? With something like that we should be able to get to the bottom of this and see what’s going on.
Scott AndersonParticipantMork,
Sorry for the delay in response. Unfortunately, we multi-task our developers onto 2nd level support and basically this question needs research at that level and those guys are tied up with the MyEclipse 8.5 release (which should go out tomorrow). I’m not trying to make an excuse, just explain a bit about why we sometimes get slow on the forums.
As for replicating what you’re seeing, without your “single Java web service program with its various methods”, it’s going to be difficult. Do you perhaps have a simplified test case you can share that exhibits your question without sharing anything proprietary? With something like that we should be able to get to the bottom of this and see what’s going on.
MorkParticipantThanks for your reply.
I posted a more complete description of the problem in the “bugs” forum today and in one o the other forums.
I really need your help!
I’m not sure it’s MyEclipse, but it’s a standard web service, as vanilla as you can get, but the injection is not happening.
Please advise.
I can email you the MyEcipse project file as well as the exploded war file (for both service and client projects).
Look forward to hearing back soon.
Thanks again.
M
Scott AndersonParticipantMork,
Actually a zip of the project would really be helpful. Hopefully it’s referencing the library containers and doesn’t have the library jars copied directly into it. Can you zip it and check the size of it? If it’s just a few meg or less we can take it by email to support at myeclipseide.com. If larger than that, please remove any embedded libs and let us know what they were in your email. Also, to help tie all this together, will you please include the links to all your forum posts on this issue so we can get replies back to the right place? The people doing the research won’t be familiar with the case.
crisswaddleMemberI have a similar problem.
In my case, it appears the Annotation Processing is not working. In the past, I would configure the build path, turn off annotation processing, build the project, then turn it back on, and it would generate the ‘apt_generated’ classes. However, now, that doesn’t even work. Also, another issue I have (I am not sure it is a bug) is if I update a class, the apt_generated classes didn’t update. For example, let’s say I have a class Person, and another class say PersonMgr with a method that returns Person object, if I changed the return type to say Employee, the apt_generated classes would not update appropriately. In short, how can I update the WS without recreating a webervice? could I just modify the annotations somewhere? and lastly, do I have an option not to use annotations?
MorkParticipant
bsumnMemberHi. Gonna just jump in here and describe how I got things to work. I didn’t just go with the built-in Tomcat deployment. I downloaded Tomcat 6 and Sun Metro 1.5. Then ran the Ant script that came with Metro to install the Metro WS stack into Tomcat. You can just create another config inside MyEclipse to point to the other Tomcat server. If you like you can also replace the .jar files that come with MyEclipse with the Metro 1.5 .jars, if they are newer, so that your efforts to use the MyEclipse built-in features use those instead.
The automated tools in MyEclipse work fine but there are a few things that may hinder you. It’s ok to clean the project and do the File/New/Web Service Project over again. That should clean out the annotations created in .apt_generated (visible in the Navigator view).
Gradually, I shifted my efforts over to Ant which allows more control. Just remember that MyEclipse will create it’s files in .apt_generated while the Ant tasks will create them where you indicate. So, if you use both the Ant tasks and the automated MyEclipse features you’ll end up with two sets of the same .java files and red X’s in your project until you clean out one set.
I usually appreciate examples so here goes: The following is an example Ant build.xml file that shows how to, compile schema’s into .java files (usually the input/output parameters to your web service operations), create a web service from a .java file, create the .war etc. I tried to add lots of comments. Hope it helps someone who is having trouble getting started.
<?xml version=”1.0″ encoding=”UTF-8″?>
<project name=”Service” default=”” basedir=”.”><!– Couple of quick Ant basics. A lot of this is probably very basic
for most but there are still many just starting out.<target name=”init”> is an example of an Ant ‘task’. Just think of it
as an individual script that you run.If you run the Ant tasks from within MyEclipse then the paths will be
relative to the root of your project. If not then they are relative
to your DOS environment, uglier in my opinion.The ‘depends’ attributes in the task opening statements means to first
run the other target before running this one, ie. depends=”init” means
run the “init” target then the one that you actually started to run.
These can become difficult to follow depending upon how they are used.
You can also run other Ant tasks from within an Ant task that are
actually contained in other files etc, to the point that you will go
mad trying to follow it.The <path id=””> elements is a different way to help you define a
classpath where some needed .jar files are located. Below an
attribute (sunClassfishJars) is created that points to the location
where the Sun Metro .jar files are. This is easier to use later
when running the individual .class files that create the service,
compile schema’s etc. It just makes it easier to say where the .jar
file is that contains the .class you are trying to run (the classpath).
So, here is as good a place as any to detail how this connects
together. The following is about the smallest target from below but
they are all constructed basically the same.1. Create an Ant target called “compile_schemas” that can be run.
2. When I run this first run the “build_setup” target.
3. Inside this target create a task called “xjc” which is actually
going to run the XJCTask.class file.
4. Tell the task where to find the XJCTask.class file via the
classpath element that was defined earlier, in this case the
build-setup target did it.
5. Run the XJCTask.class file feeding it the parameters that this
executable class needs to run by the element name you specified
(xjc).<target name=”compile_schemas” depends=”build_setup”>
<taskdef name=”xjc” classname=”com.sun.tools.xjc.XJCTask”>
<classpath refid=”sunGlassfishJars” />
</taskdef>
<xjc destDir=”${src.dir}” package=”com.sfiles” removeOldOutput=”yes”>
<schema dir=”${schema.dir}” includes=”Input.xsd, Output.xsd” />
</xjc>
</target>Nothing I have mentioned here goes into the Annotations in the .java
file you are creating a service from. First try just putting the minimal
amount of annotations.So, finally. the Ant build.xml file below, if you ran the “create_war_tc”
Ant task it would actually run the tasks in the following order.a. init
b. clean
c. compile_schemas
d. compile_web_service
e. create_war_tc
–><!– **************************** SETUP ********************************** –>
<!– Define some class paths to where things are or where they should go.
Glassfish1.5 is where I put the Sun Metro .jar files. The values of
these are accessed later via the syntax ${src.dir} where you need to
access the ./src directory in your project, etc. –>
<target name=”init”>
<property name=”src.dir” location=”./src” />
<property name=”classes.dir” location=”./WebRoot/WEB-INF/classes” />
<property name=”schema.dir” location=”./schema” />
<property name=”sun.lib.dir” location=”D:\workspace80\Glassfish1.5″ />
<property name=”war.tc” location=”./war_tc” />
</target><!– Delete the last compiled .class files and generated wsdl etc. –>
<target name=”clean” depends=”init”>
<delete>
<fileset dir=”${classes.dir}” includes=”**/*.class” />
<fileset dir=”./WebRoot/WEB-INF/wsdl” includes=”**/*.xsd, **/*.wsdl” />
</delete>
</target><target name=”build_setup” depends=”clean”>
<path id=”sunGlassfishJars”>
<fileset dir=”${sun.lib.dir}”>
<include name=”**/*.jar” />
</fileset>
</path>
</target><!– ************************* COMPILE SCHEMA’S ***************************** –>
<!– This just shows how to compile two schemas that represent the input and output
parameters to this example web service. If your input/output are simple
types you probably have no use for this. For this to work correctly you
should compile all the schemas at the same time with the same xjc
command.
–>
<target name=”compile_schemas” depends=”build_setup”>
<taskdef name=”xjc” classname=”com.sun.tools.xjc.XJCTask”>
<classpath refid=”sunGlassfishJars” />
</taskdef>
<xjc destDir=”${src.dir}” package=”com.sfiles” removeOldOutput=”yes”>
<schema dir=”${schema.dir}” includes=”Input.xsd, Output.xsd” />
</xjc>
</target><!– *********************** COMPILE WEB SERVICE *********************** –>
<!– Note: while running the compile Ant tasks, if the IDE has not been
refreshed to display the current files created by the compile schemas
task the first time the compile task runs it may fail. If running Ant
from within MyEclipse set the parameter for the Ant task that compiles
the schema’s Refresh tab to refresh resources on completion. Access
this from the second Ant Build menu selection from the MyEclipse Ant
view when you right-click on the target.First compile the source files so that the .class file the service
is being created from will be there. Yes, the task that creates the web
service runs against the compiled .class file not the .java file. This
example compiles everything to the WebRoot folder structure created
when you set up the Web Service project with MyEclipse.You may notice that this uses the same destination (destdir) as the
classpath to find the compiled .class file the service is being
made from (MyAlbums), ie. reading and writing to the same place.If your not playing with schemas you could just say replace “compile_
schemas” in the depends statement with “build_setup” etc.
–><target name=”compile_service” depends=”compile_schemas”>
<javac srcdir=”${src.dir}”
destdir=”${classes.dir}”
debug=”true”
/>
<!– The .java class used to create the Web Service and where it is
located. –>
<taskdef name=”sunCompile” classname=”com.sun.tools.ws.ant.WsGen”>
<classpath refid=”sunGlassfishJars” />
</taskdef>
<sunCompile
sei=”com.service.MyAlbums”
classpath=”${classes.dir}”
destdir=”${classes.dir}”
resourcedestdir=”WebRoot/WEB-INF/wsdl”
sourcedestdir=”src”
keep=”true”
verbose=”true”
genwsdl=”true”
protocol=”soap1.1″
servicename=”{http://service.com/}MyAlbumsService”
portname=”{http://service.com/}MyAlbumsServicePort”
>
<classpath refid=”sunGlassfishJars” />
</sunCompile>
</target><!– *********************** CREATE WAR FILE *********************** –>
<target name=”create_war_tc” depends=”compile_service”>
<war destfile=”${war.tc}/Service.war” webxml=”WebRoot/WEB-INF/web.xml”>
<fileset dir=”WebRoot”/>
</war>
</target></project>
Scott AndersonParticipantbsumn,
Thank you VERY much for taking the time to post this excellent example! I think this will go a long way toward helping Mork work through the issues with the application he’s creating. Awesome job!
MorkParticipantPlease understand that the Web Service WORKS PERFECTLY until I add the @Resource tag.
This is where the NullPointerException occurs.
Therefore, it’s not a configuration issue.
The WS code appears to also match the JAX-WS spec.
I hope the MyEclipse team will take a quick look at the projects I sent them (twice) as promised.
Thanks for your reply.
– M
MorkParticipantPlease ignore my reply directly above. I had mistakenly thought this was a reply to the @Resource posting.
The problem I was actually having (with this posting) was I had forgotten to add the JAX-WS libs into the build path.
Thanks.
– M
Scott AndersonParticipantM,
Glad you figured it out.
-
AuthorPosts