You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by TomazM <to...@arnes.si> on 2009/10/06 16:20:21 UTC

Re: hibernate and axis2

robert lazarski wrote:
> On Wed, Sep 30, 2009 at 9:53 AM, Andreas Veithen
> <an...@gmail.com> wrote:
>>> I suggest you don't put all these jar's in the aar, put them in
>>> WEB-INF/lib . hibernate uses the TCCL and that won't work directly in
>>> an aar without some extra effort.
>> It should be enough to add the following parameter to the service:
>>
>> <parameter name="ServiceTCCL" locked="false">composite</parameter>
>>
>>

So where to put Hibernate persistance.xml in axis2 dir structure per one service?

Regards, Tomaz

>> Andreas
>>
> 
> Right. With only one end user aar and without the OP showing a need to
> have a hibernate session isolated to axis2, however, its probably
> overkill. Its possible to do spring and/or hibernate per aar, I just
> think it rarely makes sense. Just my 2 brazilian centavos :-) .
> 
> - R


Now that the web services are working, the boss wants a change!

Posted by ANTHONY ENNIS <to...@insightbb.com>.
I got my web services working using I believe an 'old school' (java 1.4?) method of building the services (java2wsdl etc)

Now the boss decided we should use the more lightweight 1.6 WsGen method.

 I added in the standard cheesy main that allows the 1.6 jvm to run as a lightweight server.  I ran  WsGen on the service
which made some class files in the jaxws subdirectory.  All good.

Here's an except of the service:

@WebServicepublic class Snapshot {    private static final Logger log = Logger.getLogger(Snapshot.class);    public Snapshot() {    }    @WebMethod    public String retrieveSurvey(String surveyTypeName, String surveyVersionName) {        return (String) serviceWrapper(new SurveyFetcher(surveyTypeName, surveyVersionName));    }    @WebMethod    public LoadResult submitSurvey(SurveyAnswers surveyAnswers) {        return (LoadResult) serviceWrapper(new SurveyChecker(surveyAnswers));    }

    public static void main(String[] args) {
        Endpoint.publish("http://localhost:9090/snapshot", new Snapshot());
    }


When I run the main from the IDE.  It sits there and listens to port 9090.  I expect to be able to browse to http://localhost:9090/snapshot?wsdl and see a wsdl.
Instead, I get the following in all cases:

<Exception>org.apache.axis2.AxisFault: The service cannot be found for the endpoint reference (EPR) /services/    at org.apache.axis2.engine.DispatchPhase.checkPostConditions(DispatchPhase.java:65)    at org.apache.axis2.engine.Phase.invoke(Phase.java:334)    at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:251)    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:160)    at org.apache.axis2.transport.http.util.RESTUtil.invokeAxisEngine(RESTUtil.java:135)    at org.apache.axis2.transport.http.util.RESTUtil.processURLRequest(RESTUtil.java:130)    at org.apache.axis2.transport.http.HTTPWorker.service(HTTPWorker.java:246)    at org.apache.axis2.transport.http.server.AxisHttpService.doService(AxisHttpService.java:281)    at org.apache.axis2.transport.http.server.AxisHttpService.handleRequest(AxisHttpService.java:187)    at org.apache.axis2.transport.http.server.HttpServiceProcessor.run(HttpServiceProcessor.java:82)    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)    at java.lang.Thread.run(Thread.java:619)</Exception>I don't know why it is referring to /services.  The 'Hello World' test program I ran didn't.

I don't believe the web service is loaded properly.  I have no idea why not. I have tried lots of combinations of things.  Nothing makes
a difference.  Here's an except of the logs showing the web service container's fixation with /services

2009-10-06 16:56:35,608 DEBUG [HttpListener-9090-1] (DefaultConnectionListener.java:81) - Incoming HTTP connection from /127.0.0.1:22952009-10-06 16:56:35,624 DEBUG [HttpListener-9090-1] (DefaultConnectionListener.java:78) - Waiting for incoming HTTP connection2009-10-06 16:56:35,624 DEBUG [HttpConnection-9090-1] (HttpServiceProcessor.java:78) - New connection thread2009-10-06 16:56:35,639 DEBUG [HttpConnection-9090-1] (AxisHttpService.java:135) - Remote address of the connection : 127.0.0.12009-10-06 16:56:35,639 DEBUG [HttpConnection-9090-1] (AxisHttpConnectionImpl.java:139) - >> GET /services/ HTTP/1.12009-10-06 16:56:35,639 DEBUG [HttpConnection-9090-1] (AxisHttpConnectionImpl.java:141) - >> Host: localhost:90902009-10-06 16:56:35,639 DEBUG [HttpConnection-9090-1] (AxisHttpConnectionImpl.java:141) - >> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.32009-10-06 16:56:35,639 DEBUG [HttpConnection-9090-1] (AxisHttpConnectionImpl.java:141) - >> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.82009-10-06 16:56:35,639 DEBUG [HttpConnection-9090-1] (AxisHttpConnectionImpl.java:141) - >> Accept-Language: en-us2009-10-06 16:56:35,639 DEBUG [HttpConnection-9090-1] (AxisHttpConnectionImpl.java:141) - >> Accept-Encoding: gzip,deflate2009-10-06 16:56:35,639 DEBUG [HttpConnection-9090-1] (AxisHttpConnectionImpl.java:141) - >> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.72009-10-06 16:56:35,639 DEBUG [HttpConnection-9090-1] (AxisHttpConnectionImpl.java:141) - >> Keep-Alive: 3002009-10-06 16:56:35,639 DEBUG [HttpConnection-9090-1] (AxisHttpConnectionImpl.java:141) - >> Connection: keep-alive2009-10-06 16:56:35,655 DEBUG [HttpConnection-9090-1] (AxisHttpService.java:243) - Request method: GET2009-10-06 16:56:35,655 DEBUG [HttpConnection-9090-1] (AxisHttpService.java:244) - Target URI: /services/2009-10-06 16:56:35,655 DEBUG [HttpConnection-9090-1] (BuilderUtil.java:365) - Input contentType (application/x-www-form-urlencoded)2009-10-06 16:56:35,655 DEBUG [HttpConnection-9090-1] (BuilderUtil.java:381) - CharSetEncoding defaulted (UTF-8)2009-10-06 16:56:35,655 DEBUG [HttpConnection-9090-1] (RequestURIBasedServiceDispatcher.java:50) - [MessageContext: logID=urn:uuid:CEFF3F714B8C44A6EB1254862595665] Checking for Service using target endpoint address : /services/2009-10-06 16:56:35,655 DEBUG [HttpConnection-9090-1] (Utils.java:201) - parseRequestURLForServiceAndOperation : [/services/][/services]

Any ideas on what I am doing wrong?


Re: hibernate and axis2

Posted by Andreas Veithen <an...@gmail.com>.
On Tue, Oct 6, 2009 at 16:20, TomazM <to...@arnes.si> wrote:
> robert lazarski wrote:
>> On Wed, Sep 30, 2009 at 9:53 AM, Andreas Veithen
>> <an...@gmail.com> wrote:
>>>> I suggest you don't put all these jar's in the aar, put them in
>>>> WEB-INF/lib . hibernate uses the TCCL and that won't work directly in
>>>> an aar without some extra effort.
>>> It should be enough to add the following parameter to the service:
>>>
>>> <parameter name="ServiceTCCL" locked="false">composite</parameter>
>>>
>>>
>
> So where to put Hibernate persistance.xml in axis2 dir structure per one service?
>
> Regards, Tomaz

In the META-INF folder at the same location where your entity classes
reside, i.e. depending on where you put them, in
WEB-INF/classes/META-INF or the META-INF folder inside the AAR.

Andreas

>>> Andreas
>>>
>>
>> Right. With only one end user aar and without the OP showing a need to
>> have a hibernate session isolated to axis2, however, its probably
>> overkill. Its possible to do spring and/or hibernate per aar, I just
>> think it rarely makes sense. Just my 2 brazilian centavos :-) .
>>
>> - R
>
>

Re: hibernate and axis2

Posted by robert lazarski <ro...@gmail.com>.
On Tue, Oct 6, 2009 at 11:20 AM, TomazM <to...@arnes.si> wrote:
> robert lazarski wrote:
>> On Wed, Sep 30, 2009 at 9:53 AM, Andreas Veithen
>> <an...@gmail.com> wrote:
>>>> I suggest you don't put all these jar's in the aar, put them in
>>>> WEB-INF/lib . hibernate uses the TCCL and that won't work directly in
>>>> an aar without some extra effort.
>>> It should be enough to add the following parameter to the service:
>>>
>>> <parameter name="ServiceTCCL" locked="false">composite</parameter>
>>>
>>>
>
> So where to put Hibernate persistance.xml in axis2 dir structure per one service?
>
> Regards, Tomaz
>

For just one service I'd say WEB-INF/classes , ie, the same location
if you weren't using axis2. Axis2 should be able to use any class at
that classloader level . See the spring guide for more info as the
concepts are similar.

- R