cancel
Showing results for 
Search instead for 
Did you mean: 

Creating EAR for Java Project - Web Service

Former Member
0 Kudos

Hi guys,

I've been able to get a simple web service to work if I use an EJB for it. I want to make use of a simple Java Project/Code and then create a package for it (EAR) for deployment as a WS.

So far here are the steps I've done:

1. Create Java project. Create a class that returns a string and has recieves a String param.

2. Created WS by using Web Service --> Test.

3. Tried to package it into an EAR by creating a Enterprise Application Project and selecting the jar for #1.

4. Deploy the EAR created to the AS.

5. I'm able to get the WSDL by going to the appropriate URL.

6. When I try to test it my WS via Soap Sonar (so I could just see the xml that will be generated when I pass a variable to my method) I get an error:


<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <SOAP-ENV:Body>
    <SOAP-ENV:Fault>
      <faultcode>SOAP-ENV:Server</faultcode>
      <faultstring>Cannot resolve requested bean using reference Reference Class Name: 
Type: clientAppName
Content: sap.com/WoofEAR
Type: ejb-jar
Content: Woof.jar
Type: ejb-link
Content: Woof
</faultstring>
      <detail>
        <ns1:com.sap.engine.interfaces.webservices.runtime.RuntimeProcessException xmlns:ns1="http://sap-j2ee-engine/client-runtime-error">
          <!-- Cannot resolve requested bean using reference Reference Class Name: 
Type: clientAppName
Content: sap.com/WoofEAR
Type: ejb-jar
Content: Woof.jar
Type: ejb-link
Content: Woof
 -->
        </ns1:com.sap.engine.interfaces.webservices.runtime.RuntimeProcessException>
      </detail>
    </SOAP-ENV:Fault>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Any body have any thoughts on what's going on with this or how I can package a Java Project properly?

Accepted Solutions (0)

Answers (1)

Answers (1)

Vlado
Advisor
Advisor
0 Kudos

Hi Bianca,

In the Java EE 5 preview version it is not possible to create a WS out of a plain Java class if it's in a Java Project. It needs to be in a Dynamic Web Project 2.5. Also, the Web Project has to be part of an Enterprise Application Project 5.

Otherwise, the steps you've outlined are pretty much correct.

HTH!

-Vladimir

Message was edited by:

Vladimir Pavlov

Former Member
0 Kudos

Hi Vladimir!

Thank you so much for the info I just have some follow up questions though:

With that said, when I create a Dynamic Web Project 2.5 I've also created an EAR. Do I still need to create an Enterprise Application Project 5 and select the jar of my newly created Dynamic Web project? Or will the EAR for from the Dynamic Web project be sufficient?

What I tried doing now is creating a Dynamic Web Project 2.5 with an EAR, created a class called Hello with 1 method called sayHello that returns a string and accepts a string param. I did an initial deployment by using Web service --> Test (slider up to this point) and it deployed but I got a 404 error since it couldn't find the wsdl. I tried an undeploy and used the method of add/remove project from the server view and got a publishing failed. Did I end up doing something wrong?


Mar 13, 2007 11:30:43 PM /userOut/daView_category (eclipse.UserOutLocation) [Thread[Deploy Thread,5,main]] ERROR: Deploy Exception.An error occurred while deploying the deployment item 'sap.com_HelloEAR'.; nested exception is: 
	java.rmi.RemoteException:  class com.sap.engine.services.dc.gd.DeliveryException: An error occurred during deployment of sdu id: sap.com_HelloEAR
sdu file path: C:SAPDevStudioeclipseworkspaceHelloEARHelloEAR.ear
version status: NEW
deployment status: Admitted
description: 
		1. Error: 
Error occurred while deploying ear file C:SAPDevStudioeclipseworkspaceHelloEARHelloEAR.ear. 
Reason: {0}; nested exception is: 
	java.rmi.RemoteException:  class com.sap.engine.services.deploy.server.utils.DSRemoteException: Error occurred while deploying ear file C:SAPDevStudioeclipseworkspaceHelloEARHelloEAR.ear. 
Reason: {0}; nested exception is: 
	java.rmi.RemoteException:  com.sap.engine.services.deploy.container.rtgen.GenerationException: {0}

Thanks I'm hoping to get everything sorted out as I've been trying to get this to work for about a week.

Vlado
Advisor
Advisor
0 Kudos

Hi Bianca,

> With that said, when I create a Dynamic Web Project

> 2.5 I've also created an EAR. Do I still need to

> create an Enterprise Application Project 5 and select

> the jar of my newly created Dynamic Web project? Or

> will the EAR for from the Dynamic Web project be

> sufficient?

If you have created an Enterprise Application Project 5 together with the Dynamic Web Project 2.5, you can then deploy that EAR.

> What I tried doing now is creating a Dynamic Web

> Project 2.5 with an EAR, created a class called Hello

> with 1 method called sayHello that returns a string

> and accepts a string param. I did an initial

> deployment by using Web service --> Test (slider up

> to this point) and it deployed but I got a 404 error

> since it couldn't find the wsdl. I tried an undeploy

> and used the method of add/remove project from the

> server view and got a publishing failed. Did I end up

> doing something wrong?

Something obviously has gone wrong during (un)deployment. You can find more info about the problem in the C:\SAP\JP1\JC00\j2ee\cluster\server0\log\defaultTrace.trc file.

BTW, please try with the slider set to "Develop service" as I already suggested, in order to get the WSDL.

Regards,

Vladimir