cancel
Showing results for 
Search instead for 
Did you mean: 

Portal Service- Service Not Found Exception

Former Member
0 Kudos

HI,

I've created a portal component and a portal service.

The following configuration was made in portalapp.xml for the service

<services>

<service name="FirstService">

<service-config>

<property name="className" value="com.myservice.FirstService"/>

<property name="startup" value="true"/>

</service-config>

</service>

</services>

But when i try to access the portal service from portal component i get the service not found exception

<b>Code in Portal Component</b>

IFirstService is=(IFirstService)request.getService(IFirstService.KEY);

response.write(is.helloService());

Do i need to explicitly start the service any where

Any suggestions are welcome

Thanks

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Well, I have a similar, but worst problem.

I get the same exception. See the portalappxml:

As you see, the service is within the application, and still I am not able to get reference.

I have tried adding the service in SharingReference but to no avial. Worst, it stopped working altogether. This goes along with another posting of mine regarding an error "profile provisioning failed" which appears occasionaly when accessing components...

If anyone has an idea it would be GREAT!

Former Member
0 Kudos

looks to me like you need to add MyService to the SharingReference.

Also don't know why you would need two security zone entries for the service and component.

Why are you using the PreservedConfigPaths property? did you find the jar file was not being kept in the par?

Former Member
0 Kudos

Thanks, but:

1. I tried pointing to the service in the SharingReference but to no avail...

2. From what I know, unless you pack the Jar into PORTAL-INF/lib folder and point to it with the "PreservedConfigPaths" you get an exception.

Thanks again...

Former Member
0 Kudos

Finally got mine to work. The problem was in the sharing reference. From my reading I assumed that it referenced the service name when in fact it should be the name of the par file which contains the service.

Thanks to all for their input.

John

Former Member
0 Kudos

Azriel try changing your sharing reference to be value="htmlb,<whatever your par name is>".

I think you can remove the jar files and the PreservedConfigPaths.

Former Member
0 Kudos

Well, I have removed the PresevedConfigPaths - realy no need for it... thanks.

Well, I have another theory, which I would like to share:

This par has undergone changes, including name changes. I think this might cause the portal "double" pointing to the same service (same alias and classname). Seeing "too many refs" it cannot choose which one and thus declares the service "not found".

Why do I think this happend? Bad cleaning of the par and data from the local directory of one or more of the servers.

If this is correct, it might me connected to an OSS note #743857.

Thoughts?

A'z

Former Member
0 Kudos

I finally had to strip my service down to nothing to identify the problem and resolve it.

I also decided that the portal was not replacing the service correctly when I was making lots of changes. I then started doing a clean before I loaded the par. This seemed to at least get the correct version of the service loaded.

Don't know what is in your jar files but you might want to try removing them to see if the service will work without them.

Also make sure there is nothing in the exlib directory. I've been told the portal will ignore your other code and use anything found there instead.

Good Luck

darrell_merryweather
Active Contributor
0 Kudos

Just to let you know that by putting the name="" and alias="" in the application part of the portalapp.xml I am now able to refer to the service from another component using the SharingReference="" in the other component, which refers to my service alias name.

This is for a KM global service that it works for

I hope this helps in anyway

D

darrell_merryweather
Active Contributor
0 Kudos

When looking at an existing portalapp.xml file, say for the knowledgemanagement application, it looks like the alias=".." and name=.." should go in the <application> tag of your service and not in the <service> tag

I am working on something similar, so I am testing different variations at the moment

D

Former Member
0 Kudos

"Portal Service Implementation Guide" (connector service) shows that the classes must be packaged into jar files and placed in the lib directories. Is this true?

Portal Service Implementation guide shows a service.xml file. Very similar to portalapp.xml but different. Is this needed?

PDK document "How to Implement a Portal Service" (portalotto) shows a similar file layout to the service implementation guide.

PDK document "Creating Web Service in EP6" (time service) doesn't show where the class and or jar files go. I have been assuming they are placed correctly by Eclipse. However this conflicts with the above documents.

According to the Portal Runtime document aliases should only be used for backward compatibility. Also all service configuration should be done in the services section not in the application or component sections.

I still have not been able to get the service to work. Srinivas did you have to build the WSDL or did you get the service to work as an internal Portal service?

All input is greatly appreciated.

John Welch

Former Member
0 Kudos

Hi John,

I was ur code seems to be similar to mine there is not much of difference.I was able to run the Portal service both the ways like Internal Portal service and also exposeing the portal service as webservice i.e WSDL.

After u made the change in service entry adding alias u need to restart the server b'coz the in services tag there is entry with startup="true" and in alias name give ur name as JDWFirstService7025034.Alias and change in interface key value also as JDWFirstService7025034.Alias.I'm not sure wherther .Alias is obligatory but i've tested with that.

BR

Srinivas

Former Member
0 Kudos

Hi John,

- you can put your classes into classes.api and classes.core. I think there is no need then for packaged jars.

- service.xml is not needed anymore for EP6. portalapp.xml is sufficient.

- In your portalapp.xml of the testing application, there is no need of declaring the service again. (I assume you have an app containing the service and another app containing the test component)

- When obtaining the reference to the service in your testing app, you should use the interface of the service (IJDWFirstService) and NOT the implementing class (JDWFirstService). When put in the right place, the implementing classes won't be visible to other applications!

Generally: the interfaces of your service should go into the public directories, whereas the implementation classes should go into the core/private directories.

Other applications can reach the service only via its public parts/its interfaces.

Recommendation: Use the eclipse plugins or DevStudio to have an initial portal project generated. There you will see where each class/interface has to reside.

Former Member
0 Kudos

I totally stripped it down and am able to access the getKey() method in the service by using the generic IService descriptor. What I can not do is use the service interface definitions I added.

I keep getting a NoClassDefFound error or am not able to resolve the object names within eclipse(EP6).

How do you setup Eclipse to reference the objects within the service application?

How do you setup the testing application to reference the service objects at runtime?

These appear to be different but overlapping objectives.

Former Member
0 Kudos

Setting up Eclipse has nothing to do with the runtime.

- In Eclipse you use the "java build path"-tab in the projects properties dialog.

- For the portal runtime only the content of the public folder and the file portalapp.xml does matter.

Try to place your Service classes inside a jar in the lib folder of your project.

Former Member
0 Kudos

I would think that you have to build the import statement so that it works for both the Eclipse and Portal Runtimes.

Also how would you allow other developers to access the service without giving them the source?

The service implementation guide says the class files should go under the PORTAL-INF directory (MyService/dist/PORATL-INF/classes but my Eclipse setup is putting them at the application level (MyService/classes.api). I assume this is an Eclipse setup problem. I am using Ecliipse 2.1.

Former Member
0 Kudos

Other developers don't need the source code of your service. They only need a jar file containing the compiled classes you want to expose (your "public api"). They can mount this jar file in the IDE of their choice and code against it.

About the difference between the impl.guide and the eclipse plugins behaviour: I assume that the impl.guide is outdated and the behaviour of the plugins is correct (since the portal apps created by the eclipse plugins do work)

Former Member
0 Kudos

I built a jar file. It includes the portalapp.xml, the interface class and the implementation class. I put the jar file in the PORTAL-INF/lib directory. I still get a NoClassDefFound error when running.

I put a copy of the interface class file in the directory PORTAL-INF/classes. still get the NoClassDefFound error.

service's xml file

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

<application>

<application-config/>

<components/>

<services>

<service name="DumbService">

<service-config>

<property name="className" value="AnotherDumbService.DumbService"/>

</service-config>

</service>

</services>

</application>

applications xml file

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

<application>

<application-config>

<property name="SharingReference" value="DumbService"/>

</application-config>

<components>

<component name="JWDumbTester">

<component-config>

<property name="ClassName" value="com.ray.dom.rac.it.JWDumbTester"/>

<property name="SecurityZone" value="com.ray.dom.rac.it/high_safety"/>

</component-config>

<component-profile/>

</component>

</components>

<services/>

</application>

testing application

package com.ray.dom.rac.it;

import com.sapportals.portal.prt.component.*;

import com.sapportals.portal.prt.runtime.*;

import com.sapportals.portal.prt.service.*;

import AnotherDumbService.*;

public class JWDumbTester extends AbstractPortalComponent

{

public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)

{

IService is =

PortalRuntime.getRuntimeResources().getService("AnotherService.DumbService");

response.write("found service");

response.write(is.getKey());

//response.write(((IDumbService)is).dumbHello());

}

}

service interface

package AnotherDumbService;

import com.sapportals.portal.prt.service.IService;

public interface IDumbService extends IService{

public static final String KEY = "JDWdumbService7025034";

public String dumbHello();

}

If I run the testing application without reference to the dumbHello method it runs and displays the key value. If I uncomment the line to call dumbHello() I get the NoClassDefFound error.

This seems to be a configuration issue within the portal but my poor little brain has been unable to determine where the problem lies.

Former Member
0 Kudos

Have you put a sharing reference to the service in your portal component ?

<property name="SharingReference" value="FirstService"/>

The startup parameter in the service config says that it should start on startup (you might need to restart the portal to activate it)

Former Member
0 Kudos

Hi Dagfinn,

Yes i've put

<property name="SharingReference" value="FirstService"/>

and restarted the server,but even then i get the same exception.Any other changes to be done.

For Ur Reference

<b>portalapp.xml</b>

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

<application>

<application-config>

<property name="SharingReference" value="FirstService"/>

</application-config>

<components>

<component name="First">

<component-config>

<property name="ClassName" value="com.sap.demo.First"/>

<property name="SecurityZone" value="com.sap.demo/high_safety"/>

</component-config>

<component-profile/>

</component>

</components>

<services>

<service name="FirstService">

<service-config>

<property name="className" value="com.myservice.FirstService"/>

<property name="startup" value="true"/>

</service-config>

</service>

</services>

</application>

<b>IFirstService.java</b>

package com.myservice;

import com.sapportals.portal.prt.service.IService;

public interface IFirstService extends IService

{

public static final String KEY = "FirstService";

public String helloService();

}

<b>FirstService.java</b>

package com.myservice;

import com.sapportals.portal.prt.service.IServiceConfiguration;

import com.sapportals.portal.prt.service.IServiceContext;

public class FirstService implements IFirstService{

private IServiceContext mm_serviceContext;

/**

  • Generic init method of the service. Will be called by the portal runtime.

  • @param serviceContext

*/

public void init(IServiceContext serviceContext){

mm_serviceContext = serviceContext;

}

/**

  • This method is called after all services in the portal runtime

  • have already been initialized.

*/

public void afterInit(){

}

/**

  • configure the service

  • @param configuration

*/

public void configure(IServiceConfiguration configuration){

}

/**

  • This method is called by the portal runtime

  • when the service is destroyed.

*/

public void destroy(){

}

/**

  • This method is called by the portal runtime

  • when the service is released.

*/

public void release(){

}

/**

  • @return the context of the service, which was previously set

  • by the portal runtime

*/

public IServiceContext getContext(){

return mm_serviceContext;

}

/**

  • This method should return a string that is unique to this service amongst all

  • other services deployed in the portal runtime.

  • @return a unique key of the service

*/

public String getKey(){

return KEY;

}

public String helloService()

{

return "Hello Service Success";

}

}

<b>First.java</b>

package com.sap.demo;

import com.myservice.IFirstService;

import com.sapportals.portal.prt.component.AbstractPortalComponent;

import com.sapportals.portal.prt.component.IPortalComponentRequest;

import com.sapportals.portal.prt.component.IPortalComponentResponse;

public class First extends AbstractPortalComponent

{

public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)

{

IFirstService is=(IFirstService)request.getService(IFirstService.KEY);

response.write(is.helloService());

}

}

Former Member
0 Kudos

Try to use an explicit alias for the service.

In your portalapp.xml it should state:

<service alias="FirstService.Alias" name="FirstService">

Also modify the key in IFirstService.java to return "FirstService.Alias".

Former Member
0 Kudos

Hi Dieter,

Thanks a lot, it worked fine.I've one more issue to be addressed.i want to access this portal service from my j2ee application.Can u just give the steps to be followed.

It would be of great help.

Thanks

Srinivas.P

Former Member
0 Kudos

I didn't try that before, but it should work (somehow) by using the PRTBridge service (which bridges between j2ee and the portal runtime)

Former Member
0 Kudos

Hi Dieter,

Can u refer some persons whom i can contact on the above mentioned problem.

Regards

Srinivas.p

Former Member
0 Kudos

What do you mean?

Former Member
0 Kudos

Hi dieter,

Actually I meant that if any one who would help on figuring out how to access Portal Service from J2EE Application.

Warm Regards

Srinivas

Former Member
0 Kudos

I am having the same problem. Could you give a synopsis of what files go where and what the content of the portalapp.xml files should be.

I have the interface, implementation and a portalapp.xml file in one par file and then have another par with an application and its associated par file.

Should the key value be equal to the alias?

Is there any special consideration for the naming of the par files?

Former Member
0 Kudos

Hi John,

Content of the portalapp.xml is similar to as given above.

Just change the <service name="FirstService> to

<service alias="FirstService.Alias" name="FirstService">

The key Value in interface should be equal to alias.

If ur developing the project thru Eclipse the files are automatically placed in right place.

TestEP6 is my project name

TESTEP6

-> classes.api(folder)

com(folder)

myservice(folder)

_FirstService.class

_IFirtsService.class

->dist

->PORTAL-INF -


portalapp.xml

->src.api(folder)

-com

-myservice

-IFirstService.java

->src.core(folder)

| |-com

|-myservice

|-FirstService.java

Hope This helps

Regards

Srini

Former Member
0 Kudos

Thanks for the reply.

My directory structure is similar to yours but has more sublevels.

I am getting this message when trying to run:

An exception occurred while processing a request for :

iView : com.ray.dom.rac.it.JWTestService.JWTestService

Component Name : com.ray.dom.rac.it.JWTestService.JWTestService

com/ray/dom/rac/it/JDWFirstService.

Exception id: 09:37_17/06/04_0012

See the details for the exception ID in the log file

error log shows

Exception ID:09:37_17/06/04_0012

com.sapportals.portal.prt.component.PortalComponentException: Error in service call of Portal Component

Component : com.ray.dom.rac.it.JWTestService.JWTestService

Component class : com.ray.dom.rac.it.JWTestService

User : 7025034

at com.sapportals.portal.prt.core.PortalRequestManager.handlePortalComponentException(PortalRequestManager.java:858)

at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:310)

at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:138)

at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:190)

at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:209)

at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:576)

at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:300)

at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:138)

at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:190)

at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:669)

at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:209)

at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:532)

at java.security.AccessController.doPrivileged(Native Method)

at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:415)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.inqmy.services.servlets_jsp.server.InvokerServlet.service(InvokerServlet.java:126)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.inqmy.services.servlets_jsp.server.RunServlet.runSerlvet(RunServlet.java:147)

at com.inqmy.services.servlets_jsp.server.ServletsAndJspImpl.startServlet(ServletsAndJspImpl.java:792)

at com.inqmy.services.httpserver.server.RequestAnalizer.checkFilename(RequestAnalizer.java:665)

at com.inqmy.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:312)

at com.inqmy.services.httpserver.server.Response.handle(Response.java:170)

at com.inqmy.services.httpserver.server.HttpServerFrame.request(HttpServerFrame.java:1170)

at com.inqmy.core.service.context.container.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:36)

at com.inqmy.core.cluster.impl5.ParserRunner.run(ParserRunner.java:55)

at com.inqmy.core.thread.impl0.ActionObject.run(ActionObject.java:46)

at java.security.AccessController.doPrivileged(Native Method)

at com.inqmy.core.thread.impl0.SingleThread.run(SingleThread.java:155)

Caused by: java.lang.NoClassDefFoundError: com/ray/dom/rac/it/JDWFirstService

at com.ray.dom.rac.it.JWTestService.doContent(JWTestService.java:9)

at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)

at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)

at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:300)

at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:138)

at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:190)

at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:209)

at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:576)

at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:300)

at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:138)

at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:190)

at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:669)

at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:209)

at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:532)

at java.security.AccessController.doPrivileged(Native Method)

at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:415)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.inqmy.services.servlets_jsp.server.InvokerServlet.service(InvokerServlet.java:126)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.inqmy.services.servlets_jsp.server.RunServlet.runSerlvet(RunServlet.java:147)

at com.inqmy.services.servlets_jsp.server.ServletsAndJspImpl.startServlet(ServletsAndJspImpl.java:792)

at com.inqmy.services.httpserver.server.RequestAnalizer.checkFilename(RequestAnalizer.java:665)

at com.inqmy.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:312)

at com.inqmy.services.httpserver.server.Response.handle(Response.java:170)

at com.inqmy.services.httpserver.server.HttpServerFrame.request(HttpServerFrame.java:1170)

at com.inqmy.core.service.context.container.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:36)

at com.inqmy.core.cluster.impl5.ParserRunner.run(ParserRunner.java:55)

at com.inqmy.core.thread.impl0.ActionObject.run(ActionObject.java:46)

at java.security.AccessController.doPrivileged(Native Method)

at com.inqmy.core.thread.impl0.SingleThread.run(SingleThread.java:155)

com.sapportals.portal.prt.connection.ContentExceptionHandler@543eee #

my assumption is that one of the portalapp.xml files is not setup correctly.

portalapp.xml for service

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

<application>

<application-config/>

<components/>

<services>

<service alias="JDWFirstService7025034" name="JDWFirstService">

<service-config>

<property name="className" value="com.ray.dom.rac.it.JDWFirstService"/>

</service-config>

</service>

</services>

</application>

portalapp.xml for testing application

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

<application>

<application-config>

<property name="SharingReference" value="JDWFirstService"/>

</application-config>

<components>

<component name="JWTestService">

<component-config>

<property name="ClassName" value="com.ray.dom.rac.it.JWTestService"/>

<property name="SecurityZone" value="com.ray.dom.rac.it/high_safety"/>

</component-config>

<component-profile/>

</component>

</components>

<services>

<service alias="JDWFirstService7025034" name="JDWFirstService">

<service-config>

<property name="className" value="com.ray.dom.rac.it.JDWFirstService"/>

<property name="startup" value="true"/>

</service-config>

</service>

</services>

</application>

test application JWTestService:

package com.ray.dom.rac.it;

import com.sapportals.portal.prt.component.*;

public class JWTestService extends AbstractPortalComponent

{

public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)

{

JDWFirstService is=(JDWFirstService)request.getService(JDWFirstService.KEY);

response.write(is.helloService());

}

}

IJDWFirstService:

package com.ray.dom.rac.it;

import com.sapportals.portal.prt.service.IService;

public interface IJDWFirstService extends IService{

public static final String KEY = "JDWFirstService7025034";

public String helloService();

}

JDWFirstService:

package com.ray.dom.rac.it;

import com.sapportals.portal.prt.service.IServiceContext;

import com.sapportals.portal.prt.service.IServiceConfiguration;

import com.sapportals.portal.prt.service.IService;

public class JDWFirstService implements IJDWFirstService{

private IServiceContext mm_serviceContext;

.

.

.

public String getKey(){

return KEY;

}

public String helloService(){

return("hello Service is working");

}

}