NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
dbritton
Joined: 02 Jul 2009 Posts: 20
|
Posted: Thu Jul 23, 2009 2:48 pm Post subject: nb 6.7 cannot access webservice from ejb if deployed from same ear |
|
|
I have an ear application that contains a ejb. This ejb accesses a webservice. If I deploy the web service by itself (war) file, it deploys to
the glassfish v2 server. I can see it under the "Web Applications" of the services tab in netbeans 6.7. The testing of the web service is fine.
I have an ear file that has an ejb that uses the webservice. If I deploy the ear, the application works fine (web service deployed separately).
I want the deploy the web service from the ear file. If I do, it does deploy and test properly. I can see it under the "Enterprise Applications" of the services tab in netbeans 6.7. But the following error is reported on deployment of the application:
Class net.webspun.tpw.ws.TPWEvent 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 net.webspun.tpw.ws.TPWEvent
Annotations processing failed for C:\u\WebSpun\src\java\netbeans\TPW\dist\gfdeploy\TPW-ejb_jar
wsgen successful
DPL5306:Servlet Web Service Endpoint [TPWEvent] listening at address [http://elara:8081/TPW-ws/TPWEventService]
When I created a web service client under the ejb sub-project, it created "Generated Sources (jax-ws)" files to acces the web service. They are packaged in the projects ejb.jar (I ASSUME this is where I'm running into the problem.)
When I run the application, the ejb cannot find the web servcie and reports the error below:
TPW Event Web Service Exception: java.lang.IllegalArgumentException: net.webspun.tpw.ws.TPWEvent is not an interface
I've been going round and round with this this issue for a few weeks. (I'm somewhat new to ejbs and the use of application servers)
I would expect that I could package the web service in the ear file..
Any help would be appreciated.
David |
|
| Back to top |
|
 |
mkuchtiak Posted via mailing list.
|
Posted: Wed Jul 29, 2009 4:12 pm Post subject: nb 6.7 cannot access webservice from ejb if deployed from same ear |
|
|
I am not sure I understand all properly.
See the inline answers:
dbritton wrote:
| Quote: | I have an ear application that contains a ejb. This ejb accesses a webservice. If I deploy the web service by itself (war) file, it deploys to
the glassfish v2 server. I can see it under the "Web Applications" of the services tab in netbeans 6.7. The testing of the web service is fine.
I have an ear file that has an ejb that uses the webservice. If I deploy the ear, the application works fine (web service deployed separately).
I want the deploy the web service from the ear file. If I do, it does deploy and test properly. I can see it under the "Enterprise Applications" of the services tab in netbeans 6.7. But the following error is reported on deployment of the application:
Class net.webspun.tpw.ws.TPWEvent 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 net.webspun.tpw.ws.TPWEvent
Annotations processing failed for C:\u\WebSpun\src\java\netbeans\TPW\dist\gfdeploy\TPW-ejb_jar
wsgen successful
DPL5306:Servlet Web Service Endpoint [TPWEvent] listening at address [http://elara:8081/TPW-ws/TPWEventService]
| The web service can be inplemented as a servlet endpoint (this is achieved in web application by @javax.jws.WebService annotation), or as a (stateless)sesson bean endpoint in EJB application (annotate session bean by @javax.jws.WebService)
| Quote: |
When I created a web service client under the ejb sub-project, it created "Generated Sources (jax-ws)" files to acces the web service. They are packaged in the projects ejb.jar (I ASSUME this is where I'm running into the problem.)
When I run the application, the ejb cannot find the web servcie and reports the error below:
TPW Event Web Service Exception: java.lang.IllegalArgumentException: net.webspun.tpw.ws.TPWEvent is not an interface
I've been going round and round with this this issue for a few weeks. (I'm somewhat new to ejbs and the use of application servers)
I would expect that I could package the web service in the ear file..
| It's difficult to say what's the issue. Basically, JAX-WS:wsimport
generates WS Stub classes from wsdl url (specified in WS Client Wizard).
The client code should use these classes. You can use Call WS Operation
(e.g. in EJB code). This will generate some sample code for you. EJB,
that calls web service, should be packaged in ejb.jar file as well as WS
Stub classes. In that case, everything should work.
First of all - test if web service is really running (Test WS Action),
Then, it is also important the client code and J2EE server. E.g. client
code may have injected web service (@WebServiceRef annotation) into EJB,
but server doesn't support Java EE 5 injections.
| Quote: | Any help would be appreciated.
David
|
|
|
| Back to top |
|
 |
brent.frederick
Joined: 08 Apr 2010 Posts: 2
|
Posted: Thu Apr 08, 2010 3:53 pm Post subject: Same problem |
|
|
I'm having the same 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 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 separately. However, when I put them into an EAR I get the same error messages described below:
| Code: | 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]
|
Then when I try to connect I get this:
| Code: |
com.higtek.mdb.LocalMessageMDBBean.handleReaderCommunique():webservice.ReaderWS is not an interface
Result = webservice.ReaderWS is not an interface |
Any thoughts? Thanks! |
|
| Back to top |
|
 |
brent.frederick
Joined: 08 Apr 2010 Posts: 2
|
Posted: Thu Apr 08, 2010 7:14 pm Post subject: |
|
|
The package/class names of the web services and the generated web service client stubs are the same!! So this collision 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 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.
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? |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|