cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing KM from EJB

Former Member
0 Kudos

Hi,

I am trying to write a session bean that accesses the KM.

Normally when we access the KM thorough a portal component or web dynpro we can put a sharing reference to the KM in the portalapp.xml.

How do I refer to the KM from within an EJB. I have inlcluded all the KM jar files in my project, but still I am facing problems.

My Code is as follows.

SessionBean

IUser ep5User = WPUMFactory().getUserFactory().getEP5User(user);

IResourceContext ctx = new ResourceContext(ep5User);

RID rid = RID.getRID("/documents/supply_files");

IResource = ResourceFactory.getInstance().getResource(rid, ctx);

Now this code works fine from a PortalComponent and Web DynPro. But when I try it from an EJB I get the following error.

Cannot get Usermanagement Factory class: java.lang.ClassNotFoundException:

com.sapportals.portal.security.usermanagement.UMFactory

-


Loader Info -


ClassLoader name: [sap.com/KMDocumentTreeEAR]

Parent loader name: [Frame ClassLoader]

References:

common:service:http;service:servlet_jsp

service:ejb

common:service:iiop;service:naming;service:p4;service:ts

service:jmsconnector

library:jsse

library:servlet

common:library:IAIKSecurity;library:activation;library:mail;library:tcsecs

sl

library:ejb20

library:j2eeca

library:jms

library:opensql

common:library:com.sap.security.api.sda;library:com.sap.security.core.sda;li

brary:security.class;library:webservices_lib;service:adminadapter;service:ba

sicadmin;service:com.sap.security.core.ume.service;service:configuration;ser

vice:connector;service:dbpool;service:deploy;service:jmx;service:jmx_notific

ation;service:keystore;service:security;service:userstore

interface:resourcecontext_api

interface:webservices

interface:ejbserialization

Any Help is greatly appriciated.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

did you specify a reference to the JAR file that contains the com.sapportals.portal.security.usermanagement.UMFactory class (as well as all other libs that your EJB refers to) in the application-j2ee-engine.xml in your KMDocumentTreeEAR?

The reference in this XML is used in runtime to set references between the classloader of your application (EAR) and the classloaders of the libs used by the application.

Hope that helps!

Answers (3)

Answers (3)

Former Member
0 Kudos

Add the following reference to application-j2ee-engine.xml

<reference reference-type="weak">

<reference-target

provider-name="sap.com"

target-type="application">com.sap.km.application</reference-target>

</reference>

Cheers,

Deyan

Former Member
0 Kudos

Hi Deyan

I have an EJB inside an EAR trying to access KM, do i have to add this reference to the ejb-j2ee-engine.xml?

This is my ejb-j2ee-engine.xml:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE ejb-j2ee-engine SYSTEM "ejb-j2ee-engine.dtd">

<ejb-j2ee-engine>

<enterprise-beans>

<enterprise-bean>

<ejb-name>KmmsListEJBBean</ejb-name>

<session-props/>

</enterprise-bean>

</enterprise-beans>

</ejb-j2ee-engine>

Thanks in advance Deyan

Former Member
0 Kudos

Hi again Deyan your solution worked for me, thanks! i added the reference to the application-j2ee-engine.xml

Former Member
0 Kudos

Did you ever solve this problem? I'm facing the same issue..

Thank you,

Fallon

Benny
Product and Topic Expert
Product and Topic Expert
0 Kudos

You clearly miss a lib. Find out which libs you are using in your portal component and add them to the EJB project also. In case of EJB projects, there is no automatic including of portal libs as may be in portal projects. That's your problem.(hopefully)

Regards,

Benny