简体   繁体   中英

Glassfish 4.1: war inside ear does not expose webservices

I am currently working on upgrading an application from Java7 running on Glassfish 3.1.2.2 , to Java8 running on Glassfish 4.1 . The application is packaged as an ear -file, containing an ejb-jar , and a war . The war in turn contains some webservices .

In Glassfish 3.1.2.2 , deploying the ear will lead to the war exposing a number of webservices . But, when I deploy the ear in Glassfish 4.1 , no webservice are exposed. When listing the components for the ear in Glassfish , the war does not list webservices (only web ) in 4.1 (but does in 3.1.2.2 ).

I have tried deploying the war -file as a standalone application, and when doing this the webservices becomes available.

Does anyone know if there is a known bug with regards to deploying webservices through an ear -file with Glassfish 4.1?

When it comes to changes, I have upgraded some dependencies, but as far as I know there is nothing that should affect this.

My application.xml :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application PUBLIC
    "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
    "http://java.sun.com/dtd/application_1_3.dtd">
<application>
  <display-name>myApplication-ear</display-name>
  <description>myApplication</description>
  <module>
    <ejb>myApplication-ejb-5.2-SNAPSHOT.jar</ejb>
  </module>
  <module>
    <web>
      <web-uri>myApplication-war-5.2-SNAPSHOT.war</web-uri>
      <context-root>/myApplication-war</context-root>
    </web>
  </module>
</application>

The problem was an old dependency:

  <dependency>
    <groupId>com.sun.xml.ws</groupId>
    <artifactId>jaxws-rt</artifactId>
    <version>2.2.7</version>
  </dependency>

I removed it because it is already included in rt.jar in the java installation. Somehow Glassfish didn't handle this at all, the webservices simply didn't work and no traces of error in the server.log

Can this be your scenario (?): EJB module deployment may fail when an EJB that is exposed as a web service, and which has a handler, is initialized before an EJB on which it has dependencies. This is caused by the way the EJB container initializes and loads EJB web services, the workaround is to rename the EJBs so that the EJB exposed as a web service is initialized after the EJB on which it has dependencies.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM