Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Deploy javax.xml.endpoint in a jar in J2EE container  RSS feed

 
Jim Akmer
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have posted this question to java.net.forums, but since I got no reply I will ask here.
I read that a javax.xml.endpoint is disallowed to be published in a J2EE container. Is this accurate?
So, if I have a jar that deploys a web service via an javax.xml.endpoind, can this jar be part of another regular web application with JSPs etc that essentially uses in the backend the web service, or there is this restriction in containers to not deploy the endpoint and as a result the web application will fail to function properly because of the jar?

I this is the case, why is there such a restriction? Is it because of the use of the underlying http server the javax.xml.endpoint uses under the cover, or some other reason? Is there any work-around?

Thank you
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
If you deploy a web service (or any other application) in a container, for instance Tomcat or GlassFish, then you do it because you want the container to help you share and manage resources that are used by all your applications (in the container). Running an application that circumvents the container's management mechanisms in a container makes little sense since you prevent the container from doing the job it was designed to perform.
The Endpoint class is, as far as I know, not designed to run in a container and will thus not use or consider things like, for instance, a thread pool used to handler requests to applications in the container.
I think you have two options:
- Adapt the application to adhere to the standards used when deploying applications in a container and run it in a container.
- Run the application as a standalone application.
Hope this makes things more clear!
 
Jim Akmer
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ivan,

I understand what you are saying, but I have a library (the jar file) that uses the javax.xml.endpoint as an embedded server to deploy a web service as part of the functionality of the jar.
My library is used by a desktop application. So far ok.
I want to know if I could reuse my library (i.e. the functionality provided by it) as part of a web application as well.
Are you saying that it is not possible?
That I should have a different library for web application, which has the web service deployed by the contaner?
But I do not need the features provided by the container in this case.
Is what I am asking non-sensical? There is no kind of work arround on this?

Thank you
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Ah, now I understand! Sorry for being slightly slow.
I feel that you should be able to use the library in your web application.
If you do not use the Endpoint class, then I see no problems. That is, there may be code in the JAR that uses the Endpoint class, but it is never executed.
Best wishes!
 
Jim Akmer
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry Ivan, I don't understand you answer.
I want to use the functionality offered by the jar in my wep app. This functionality to work must have a web service deployed by an Endpoint. So I need the Endpoint from the jar deployed.
So you are saying that I can not reuse the jar, correct?
If I changed to another embedded server, instead of using an Endpoint in my jar, e.g. Jetty, I still would have the same problem? If yes is there a solution to this?

 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Let me see if I have understood things correct:
- You want to use your JAR and deploy it in a container.
- You do not want to change your JAR, but still use the Endpoint class to expose the service.
If this is the case, then my first answer still stands.

However, if you want to use the functionality offered by your library from your webapplication, then why not use it as a standard library without taking the detour over HTTP and SOAP etc.?
If you could call the JAR from the web application using regular method calls, then your problems are solved and you can rest assured that there is a minimum of overhead calling the JAR.

If you insist on exposing the functionality as a web service, then you could create some kind of wrapper service that is deployed to the container in a normal manner. The wrapper then calls, using local method calls, the implementation code in the JAR.
Best wishes!
 
Jim Akmer
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ivan, I still would like to use the Endoint inside the jar. So according to your first answer, this is not possible.
My question is, if the problem lies in the jaw-ws endpoint, and if I used a different embedded server e.g. Jetty I would not have this problem.
Or there is no kind of embedded server, from any framework, I could use in my jar, that would make it possible to still be deployed from the container, and so my jar would be reused by both desktop applications and web applications.
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
I haven't said that it is not possible, just that it is not a good idea.
In the end you do whatever you please and if it works for you, then everything is good and well!
Good luck!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!