cancel
Showing results for 
Search instead for 
Did you mean: 

Problems looking up EJBs

Former Member
0 Kudos

Hi all,

I have the following szenario: I have some EJBs and a JSP-frontend together in one EAR-file and there is no problem accessing the EJBs from within the webcontainer. Now I have a second JSP-frontend in another EAR which have to access the EJBs deployed in the first EAR. Every time I try to lookup the EJBs I get the following error:

javax.servlet.ServletException: object is not an instance of declaring class.

RootCause: IllegalArgumentException

I used the ClientAPI.jar to import the home- and remote-interfaces. Without that jar-file I get a NoClassDefFoundError.

Does I have to specify a refenrence in the application-j2ee-engine.xml instead of using the additional jar-file for this purpose? I´m using the SAP WAS 6.30

Thanks for help

Christian

Accepted Solutions (0)

Answers (1)

Answers (1)

Benny
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Christian,

you are on the right way. You actually have to reference the application in application-j2ee-engine.xml .

Regards,

Benny

Former Member
0 Kudos

Hi Benny,

may i get an example? I don´t know what i have to reference - the EAR, the EJB (analog the EJB reference in the web.xml?), the JNDI,? what reference type, provider name, target type,?

Thanks

Christian

Benny
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Christian,

in the Developer Studio, EAR- project off your app you should see application-j2ee-engine.xml. If you are there, in the general tab should appear a references tree (It maybe not, because I don't have your version, which is older).

The descriptors are referenced in the reference manual which you can find at http://help.sap.com

(drill down to J2EEEngien and then to the latest book called "Reference manual")

There is the application-j2ee-engine.dtd , which describes this xml completely. I did it with the calculator  example on one of my apps with the tools and the result is:

                 

If you include that it should work....

Regards,

Benny

Former Member
0 Kudos

Hi Benny,

I tried the following reference in the application-j2ee-engine.xml:

and get the following error:

com.sap.engine.services.deploy.exceptions.ServerDeploymentException: Application sap.com/AgNeu cannot be started,because it has hard reference to resource AgEAR with type application, but it is not active on the server.

This is a little bit confusing because the referenced App is definitely available. You can use its WebFrontend and access the EJBs from this WebFrontend.

I also tried the name sap.com/AgEAR but the error is the same.

Then I tried to use a weak reference (hoping that all necessary classes would be found) and always get the following error:

java.lang.NoClassDefFoundError: de.pta.sap.was.ag.SchuelerSessionHome

-

-


Loader Info -

-


ClassLoader name:

Parent loader name:

References:

   sap.com/sap.com/AgEAR

   sap.com/sap.com/AgNeu

   sap.com/AgEAR

   service:servlet_jsp

   common:service:adminadapter;service:appclient;service:applocking;service:basicadmin;service:classload;service:connector;service:deploy;service:ejb;service:file;service:iiop;service:jmsconnector;service:jmx;service:jmx_notification;service:keystore;service:locking;service:log_configurator;service:monitor;service:naming;service:p4;service:security;service:ts;service:userstore

   library:jsse

   library:servlet

   common:library:activation;library:mail

   library:ejb20

   library:j2eeca

   library:jms

   library:opensql

   library:webservices_lib

   interface:webservices

   library:sapxmltoolkit

It really looks like the server could not find the other app but it is definitely running on the server. You can find all entries in the various views at the visual administrator.

Do you have any hint what could be wrong?

You can reference EJBs , server components and so on also in the web-j2ee-engine.xml. When do I use these references?

Thanks

Christian

Former Member
0 Kudos

Hi Christian,

yes, I think you should use the web.xml and the web-j2ee-engine.xml descriptors to set the reference to the "external" EJBs.

If you are developing your applications using the SAP NetWeaver Developer Studio (recommended! makes all those procedures of setting references much much easier), have a look at this page in the online documentation: http://help.sap.com/saphelp_webas630/helpdata/en/55/29ed5eff965448941c0b42f01b9804/content.htm

In case you are manually editing the descriptors, do the following:

Define the ejb reference in the web.xml as if the EJBs you are referencing are part of your application.

Then use the web-j2ee-engine.xml to add the JNDI name (the name under which the EJB you want to reference is bound to the JNDI tree of the engine). In the <ejb-ref-name> tag use the reference name that you specified in the <ejb-ref-name> tag in the web.xml!

A reference to the web-j2ee-engine DTD is available at http://help.sap.com/saphelp_webas630/helpdata/en/d1/84fd48edeb41d0bb69d2689071f4cf/content.htm

Hope that helps!

Good luck,

Ivaylo

Former Member
0 Kudos

Hi Benny,

because of a bug in the listview of the posts (scrolling to the second site of the list, the format is corrupt ? there is no linebreaking anymore so you cannot read the whole line ? and the link necessary to answer directly is lost) I answer you instead of Ivaylo Ivanov.

I tried to reference the EJB in the web.xml and web-j2ee-engine.xml with and without a reference in the application-j2ee-engine.xml and with and without the AppClientApi.jar but the result remains the same: my app doesn´t work.

Using only the reference in web.xml and web-j2ee-engine.xml I always get a ClassDefNotFound, adding the AppClientApi.jar to the war-file I get the ServletException. Using the reference in the application-j2ee-engine.xml I get a deploy exception.

I know the DTDs in the Reference Manual but I found the description not very instructive. The references only describes how you use the tags but there isn´t a clear hint when you should use the tags and what someone has to reference in the application-j2ee-engine.xml and what in the web-j2ee-engine.xml (something like a best practice using the SAP deployment descriptors).

I think my szenario is a normal one in a service oriented or even component based environment.

Thanks for help

Christian