Skip to Content
author's profile photo Former Member
Former Member

Portal Service- Service Not Found Exception

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

Add comment
10|10000 characters needed characters exceeded

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jun 15, 2004 at 07:46 AM

    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)

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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"/>

      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");

      }

      }

  • Posted on Jun 17, 2004 at 03:25 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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"/>

      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.

  • Posted on Jun 18, 2004 at 08:38 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 21, 2004 at 03:57 PM

    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!

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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