Skip to main content

Cannot access WAR webservices from EJB if deployed in an EAR

3 replies [Last post]
brentfrederick
Offline
Joined: 2010-04-08

I'm having this problem with Netbeans 6.1 and Glassfish v2.1.

I have a web project (WAR) that has 4 web services. I have an EJB project (JAR) that has 4 web service client connectors to these web services. Our environment is distributed so basically server A has the same code as server B... the web service connectors in server A will talk to the web services in server B. Everything works fine when I deploy the EJB JAR and the WAR to Glassfish separately. However, when I put them into an EAR and deploy the EAR I get the following error messages:

Class webservice.ReaderWS is annotated with @WebService and without @Stateless but is packaged in a JAR. If it is supposed to be a servlet endpoint, it should be packaged in a WAR; Deployment will continue assuming this class to be just a POJO used by other classes in the JAR being deployed
symbol: javax.jws.WebService
location: class webservice.ReaderWS
Class webservice.RestoreWS is annotated with @WebService and without @Stateless but is packaged in a JAR. If it is supposed to be a servlet endpoint, it should be packaged in a WAR; Deployment will continue assuming this class to be just a POJO used by other classes in the JAR being deployed
symbol: javax.jws.WebService
location: class webservice.RestoreWS
Class webservice.ProcessDnote is annotated with @WebService and without @Stateless but is packaged in a JAR. If it is supposed to be a servlet endpoint, it should be packaged in a WAR; Deployment will continue assuming this class to be just a POJO used by other classes in the JAR being deployed
symbol: javax.jws.WebService
location: class webservice.ProcessDnote
Class webservice.HGTInboxWS is annotated with @WebService and without @Stateless but is packaged in a JAR. If it is supposed to be a servlet endpoint, it should be packaged in a WAR; Deployment will continue assuming this class to be just a POJO used by other classes in the JAR being deployed
symbol: javax.jws.WebService
location: class webservice.HGTInboxWS
Annotations processing failed for C:\Program Files\glassfish-v2\domains\domain1\applications\j2ee-apps\ESP\HGTCoreEJB_jar
wsgen successful
wsgen successful
wsgen successful
wsgen successful
DPL5306:Servlet Web Service Endpoint [ReaderWS] listening at address [http://BRENT-LT.HIGTEK.local:8080/HGTWebApp/ReaderWSService]
DPL5306:Servlet Web Service Endpoint [ProcessDnote] listening at address [http://BRENT-LT.HIGTEK.local:8080/HGTWebApp/ProcessDnoteService]
DPL5306:Servlet Web Service Endpoint [HGTInboxWS] listening at address [http://BRENT-LT.HIGTEK.local:8080/HGTWebApp/HGTInboxWSService]
DPL5306:Servlet Web Service Endpoint [RestoreWS] listening at address [http://BRENT-LT.HIGTEK.local:8080/HGTWebApp/RestoreWSService]

I don't understand this because the @WebService annotated web service classes are NOT in the JAR.... they are in the WAR.

Then when I try to connect from the EJB via the client connector I get this:

com.higtek.mdb.LocalMessageMDBBean.handleReaderCommunique():webservice.ReaderWS is not an interface
Result = webservice.ReaderWS is not an interface

I've been scouring the internet for answers on this. I'm trying to package the 2 projects into the same EAR so I can use the @Local interface instead of the @Remote interface on my EJBs. I have only found one other mention of this issue over on the netbeans forums: forums.netbeans.org/viewtopic.php?t=15361

Any help would be greatly appreciated as I'm totally stuck... Thanks!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Sahoo

In the class loading hierarchy of an ear file, ejb-jar is ahead of war.
Have you got duplicate classes in the jar and war?

Sahoo

glassfish@javadesktop.org wrote:
> I'm having this problem with Netbeans 6.1 and Glassfish v2.1.
>
> I have a web project (WAR) that has 4 web services. I have an EJB project (JAR) that has 4 web service client connectors to these web services. Our environment is distributed so basically server A has the same code as server B... the web service connectors in server A will talk to the web services in server B. Everything works fine when I deploy the EJB JAR and the WAR to Glassfish separately. However, when I put them into an EAR and deploy the EAR I get the following error messages:
>
> Class webservice.ReaderWS is annotated with @WebService and without @Stateless but is packaged in a JAR. If it is supposed to be a servlet endpoint, it should be packaged in a WAR; Deployment will continue assuming this class to be just a POJO used by other classes in the JAR being deployed
> symbol: javax.jws.WebService
> location: class webservice.ReaderWS
> Class webservice.RestoreWS is annotated with @WebService and without @Stateless but is packaged in a JAR. If it is supposed to be a servlet endpoint, it should be packaged in a WAR; Deployment will continue assuming this class to be just a POJO used by other classes in the JAR being deployed
> symbol: javax.jws.WebService
> location: class webservice.RestoreWS
> Class webservice.ProcessDnote is annotated with @WebService and without @Stateless but is packaged in a JAR. If it is supposed to be a servlet endpoint, it should be packaged in a WAR; Deployment will continue assuming this class to be just a POJO used by other classes in the JAR being deployed
> symbol: javax.jws.WebService
> location: class webservice.ProcessDnote
> Class webservice.HGTInboxWS is annotated with @WebService and without @Stateless but is packaged in a JAR. If it is supposed to be a servlet endpoint, it should be packaged in a WAR; Deployment will continue assuming this class to be just a POJO used by other classes in the JAR being deployed
> symbol: javax.jws.WebService
> location: class webservice.HGTInboxWS
> Annotations processing failed for C:\Program Files\glassfish-v2\domains\domain1\applications\j2ee-apps\ESP\HGTCoreEJB_jar
> wsgen successful
> wsgen successful
> wsgen successful
> wsgen successful
> DPL5306:Servlet Web Service Endpoint [ReaderWS] listening at address [http://BRENT-LT.HIGTEK.local:8080/HGTWebApp/ReaderWSService]
> DPL5306:Servlet Web Service Endpoint [ProcessDnote] listening at address [http://BRENT-LT.HIGTEK.local:8080/HGTWebApp/ProcessDnoteService]
> DPL5306:Servlet Web Service Endpoint [HGTInboxWS] listening at address [http://BRENT-LT.HIGTEK.local:8080/HGTWebApp/HGTInboxWSService]
> DPL5306:Servlet Web Service Endpoint [RestoreWS] listening at address [http://BRENT-LT.HIGTEK.local:8080/HGTWebApp/RestoreWSService]
>
> I don't understand this because the @WebService annotated web service classes are NOT in the JAR.... they are in the WAR.
>
> Then when I try to connect from the EJB via the client connector I get this:
>
> com.higtek.mdb.LocalMessageMDBBean.handleReaderCommunique():webservice.ReaderWS is not an interface
> Result = webservice.ReaderWS is not an interface
>
> I've been scouring the internet for answers on this. I'm trying to package the 2 projects into the same EAR so I can use the @Local interface instead of the @Remote interface on my EJBs. I have only found one other mention of this issue over on the netbeans forums: forums.netbeans.org/viewtopic.php?t=15361
>
> Any help would be greatly appreciated as I'm totally stuck... Thanks!
> [Message sent by forum member 'brentfrederick']
>
> http://forums.java.net/jive/thread.jspa?messageID=395959
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

brentfrederick
Offline
Joined: 2010-04-08

Yes, the package/class names are the same so this is the problem.

In the WAR the web service is:
Package: webservice
Class: RestoreWS

The generated client stubs in the JAR are the same:
Package: webservice
Class: RestoreWS

I guess this is the issue. I'm going to try to change the package of the web services in the WAR. I hope the stubs in the JAR don't pick up the new package when I re-create the client stubs?

EDIT: It does. When I re-create the client stubs in Netbeans to reflect the new package location... it puts the stubs in the same new package in the JAR which generates the same collision. When creating the stub the package field is greyed out and just says . Any suggestions here?

Message was edited by: brentfrederick

brentfrederick
Offline
Joined: 2010-04-08

Ok I fixed it. This is how...

Right click the web service connector in the EJB JAR under "Web Service References" in netbeans, select "Edit Web Service Attributes", select "WSImport Option" tab....

In this section add a new option called "package" and define a package (DIFFERENT than your web service package in the WAR). This will add the "-p" option to wsimport with your new package which removes the collision.

Is this the normal/correct way to set these things up?

Only issue now is that my log files are being flooded with the following each time the web service is hit:
WSP1049: Loaded WSIT configuration from file: file:/C:/Program Files/glassfish-v2/domains/domain1/applications/j2ee-apps/ESP/HGTCoreEJB_jar/META-INF/wsit-client.xml

Any ideas how to make this stop?

Message was edited by: brentfrederick