google-code-export / webserviceservlet

Automatically exported from code.google.com/p/webserviceservlet
1 stars 1 forks source link

Problem loading schema1.xsd when deployed to GAE #1

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I am using the webserviceservlet in GAE. When I invoke the 

localhost:8888/wss?wsdl

I get this error 
Failded to create SchemaGenerator in GET: java.lang.NullPointerException
schemaFilePath: schema1.xsd

Regardless of the path of schema1.xsd, I get this error. I think this may be 
related to class loading, since the wss servlet is not able to locate the 
schema file.

I have also attached the stacktrace.

Original issue reported on code.google.com by itskushi...@gmail.com on 29 Jan 2011 at 7:06

Attachments:

GoogleCodeExporter commented 9 years ago
Hi,

WebService servlet searches the schema1.xsd file (or if you have renamed this 
to other name in web.xml) from jar your deploy to gae. So this file should 
locate in WEB-INF/classes and your path in web.xml should point to this 
location in your jar.

Depending on how you have "set" your schema1.xsd into your project this file 
might disappear in every compile you make with eclipse. I guess the best way to 
do this is to add schema1.xsd into your src so it will placed automatically 
into WEB-INF/calsses directory too.

Original comment by michael....@vnetcon.org on 29 Jan 2011 at 7:26

GoogleCodeExporter commented 9 years ago
Michael, thanks for the response. The schema file is under web_inf/classes. I 
tried placing it
Directly under web-inf/classes a well as under a package structure under 
web-inf/classes. It fails to locate it in either case. It is not missing when I 
am deploying the app. My take is that it could be an issue related to class 
loading on the GAE. So that the class reading the schema file is not able to 
see that file.I could be wrong.

Original comment by itskushi...@gmail.com on 29 Jan 2011 at 7:39

GoogleCodeExporter commented 9 years ago
Hi,

Strange... Maybe this help, this is a working configuration I'm currently using.
schema1.xsd locates at 

WEB-INF\classes\org\vnetcon\blobdb\database\ws\schema1.xsdschema1.xsd

and in web.xml I have following configuration

<init-param>
   <param-name>SchemaFilePath</param-name>
   <param-value>/org/vnetcon/blobdb/database/ws/schema1.xsd</param-value>
</init-param>

...and this work without any problems. Hope this help.

br,
-michael

Original comment by michael....@vnetcon.org on 29 Jan 2011 at 8:36

GoogleCodeExporter commented 9 years ago
Michael: Even with your suggestion that does not work. It gives me the same 
error with the new path name you suggested (I did create the suggested package 
structure for the schema file).

Original comment by itskushi...@gmail.com on 31 Jan 2011 at 11:23

GoogleCodeExporter commented 9 years ago
Hi,

In attach zip there is an quickly made Eclipse WebApplication test and I get it 
up and running on my dev environment. What I did was

1. I created an Eclipse Web Application Project (= Google App Engine project)
2. I downloaded the wss-0.7b.jar and placed it into WEB-INF/lib
3. I created a source package org.vnetcon.test
4. I created WebService.java and Employee.java files
5. I generated the schema file from Employee.java using following command
    schemagen org.vnetcon.test.Employee
6. I copied the generated schema1.xsd into 
    WebServiceServletTest\war\WEB-INF\classes\org\vnetcon\test
7. I started the WebServiceServletTest by right clicking the project and from
   there navigate to Run As -> WebApplication
8. I point my browser at 
    http://localhost:8888/test/ws?wsdl ( this shows the wsdl )
    http://localhost:8888/test/ws?xsd=1  ( this shows the schema )

I also tested the the client side generation using following command

   wsimport http://localhost:8888/test/ws?wsdl

And I didn't get any errors. I'm run this test on GAE 1.4. For looking xsd and
schema with browser I use IE or Mozilla (Chrome shows only blank pages).

If you can't get this up and running with these could you please give me your
source so I could watch it little bit closer.

br,
-michael

Original comment by michael....@vnetcon.org on 1 Feb 2011 at 4:37

Attachments:

GoogleCodeExporter commented 9 years ago
Forgot to say in my last post that I also edited the web.xml of course :)

Original comment by michael....@vnetcon.org on 1 Feb 2011 at 5:04

GoogleCodeExporter commented 9 years ago
I just made an end to end test so that I created a real WebService client using 
Eclipse wizard. During this test I noticed that that on GAE 1.4 it seems that 
xalan libraries are also neede. These can be downloaded at 
http://xml.apache.org/xalan-j/

When I get little bit time I think I will write better wiki pages how to use 
WebServiceServlet with step by step instructions....

Original comment by michael....@vnetcon.org on 1 Feb 2011 at 8:24

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Michael: 

I did not have any luck with xalan libraries, I see the same error. I was able 
to get your example running, at least to see the WSDL.

I noticed in your GreetingServiceImpl you extend RemoteServiceServlet and 
implements the GreetingService which extends RemoteService interface, both of 
which are from GWT. Is this required? I followed your example instructions from 
the document, and it does not include implementing it in this manner.

Original comment by itskushi...@gmail.com on 1 Feb 2011 at 7:52

GoogleCodeExporter commented 9 years ago
The GreetingServiceImpl in not necessary at all - it was auto generated when I 
created the example project - so you can delete those. 

WebServiceServlet is a stand alone servlet which needs following things:

1. Servlet engine to run it (e.g. GAE, Tomcat, Glassfish etc.)
2. Normal java class which public methods are treated as WebService methods
3. Schema1.xsd (or you can name this other way) for defining classes WebService 
uses

So in practice this mean that you don't need in your web project anything else 
than wss-0.7b.jar, your normal java class and schem file. Your web project 
could be also as simple as only a one html page just as long you can deploy 
your project to servlet engine.

If you could see already the wsdl then I think you are quite close :) I attach 
the xalan libraries I have used - hope they will work with you too. These files 
must locate in WEB-INF/lib folder. It is not enough (or necessary) to add them 
using Build Path from Eclipse.

br,
-michael

Original comment by michael....@vnetcon.org on 2 Feb 2011 at 3:48

Attachments: