HTTP Error 500 when I add a parameter to the url

Hello,

I created a simple OSLC app (this is the url to the project on git : GitHub - onsDridi/ObjOSLC) and in my serviceProviderService1 class, I tried to add a parameter projectId to my url as follow :
@OslcService(Oslc_objectiverDomainConstants.OBJECTIVERWEB_DOMAIN)

@Path(“goals/{projectId}”)

public class ServiceProviderService1

{

@Context private HttpServletRequest httpServletRequest;

@Context private HttpServletResponse httpServletResponse;

@Context private UriInfo uriInfo;


and of course , I specified in queryGoals and queryGoalsAsHtml methods that I will be use a path parameter projectId to process the request :

public Goal[] queryGoals(
@PathParam(“projectId”) final String projectid ,

                                                 @QueryParam("oslc.where") final String where,
                                                 @QueryParam("oslc.prefix") final String prefix,
                                                 @QueryParam("oslc.paging") final String pagingString,
                                                 @QueryParam("page") final String pageString,
                                                 @QueryParam("oslc.pageSize") final String pageSizeString) throws IOException, ServletException
{

When I run my app and try to access this url : http://localhost:8083/adaptor-objectiver/services/catalog/singleton , I get an HTTP 500 Error :

java.lang.IllegalArgumentException: The template variable ‘projectId’ has no value
at org.glassfish.jersey.uri.UriTemplate$1ValuesFromArrayStrategy.valueFor(UriTemplate.java:1020)
at org.glassfish.jersey.uri.UriTemplate.resolveTemplate(UriTemplate.java:706)
at org.glassfish.jersey.uri.UriTemplate.createUriComponent(UriTemplate.java:1030)
at org.glassfish.jersey.uri.UriTemplate.createURIWithStringValues(UriTemplate.java:964)
at org.glassfish.jersey.uri.UriTemplate.createURIWithStringValues(UriTemplate.java:827)
at org.glassfish.jersey.uri.UriTemplate.createURI(UriTemplate.java:790)
at org.glassfish.jersey.uri.internal.JerseyUriBuilder._buildFromMap(JerseyUriBuilder.java:822)
at org.glassfish.jersey.uri.internal.JerseyUriBuilder.buildFromMap(JerseyUriBuilder.java:801)
at org.eclipse.lyo.oslc4j.core.model.ServiceProviderFactory.resolvePathParameters(ServiceProviderFactory.java:356)
at org.eclipse.lyo.oslc4j.core.model.ServiceProviderFactory.createQueryCapability(ServiceProviderFactory.java:219)
at org.eclipse.lyo.oslc4j.core.model.ServiceProviderFactory.handleResourceClass(ServiceProviderFactory.java:98)
at org.eclipse.lyo.oslc4j.core.model.ServiceProviderFactory.initServiceProvider(ServiceProviderFactory.java:79)
at org.eclipse.lyo.oslc4j.core.model.ServiceProviderFactory.createServiceProvider(ServiceProviderFactory.java:49)
at cetic.be.objectiver.oslc.servlet.ServiceProvidersFactory.createServiceProvider(ServiceProvidersFactory.java:98)
at cetic.be.objectiver.oslc.servlet.ServiceProviderCatalogSingleton.initServiceProviders(ServiceProviderCatalogSingleton.java:225)
at cetic.be.objectiver.oslc.servlet.ServiceProviderCatalogSingleton.getServiceProviderCatalog(ServiceProviderCatalogSingleton.java:87)
at cetic.be.objectiver.oslc.services.ServiceProviderCatalogService.getHtmlServiceProvider(ServiceProviderCatalogService.java:130)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$VoidOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:143)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:865)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1623)
at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:214)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1700)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1667)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:220)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:152)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:505)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:267)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:698)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:804)
at java.base/java.lang.Thread.run(Thread.java:834)

do you have any idea why i have this bug ?

A very familiar bug.

The URL you are calling tries to get the Catalog, which in turn tries to create its Service Providers.
The problem occurs when the library then tries to create URL for each of the Service Providers under the Catalog.

See in your stack, for example the line

cetic.be.objectiver.oslc.servlet.ServiceProviderCatalogSingleton.initServiceProviders(ServiceProviderCatalogSingleton.java:225)

The problem (which you can see in action if you put breakpoints and inspect the variables) is that you are not giving {projectId} a value at this stage, so the code is breaking because it is not possible to create URLs for the Service Providers.

The quickest workaround is to
1- change your class @path from @Path(“goals/{projectId}”) to @Path(“goals”).
2. add a @path to the queryGoals method to be @Path(“{projectId}”)

Are you using LyoDesigner to produce these classes?

Thank you for your response Jad . I changed the method as follow :
@GET
@Path(“query/{projectId}”)
@Produces({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_JSON_LD, OslcMediaType.TEXT_TURTLE, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON})
@Operation(

    summary = "Query capability for resources of type {" + Oslc_objectiverDomainConstants.GOAL_LOCALNAME + "}",
    description = "Query capability for resources of type {" + "<a href=\"" + Oslc_objectiverDomainConstants.GOAL_TYPE + "\">" + Oslc_objectiverDomainConstants.GOAL_LOCALNAME + "</a>" + "}" +
        ", with respective resource shapes {" + "<a href=\"" + "../services/" + OslcConstants.PATH_RESOURCE_SHAPES + "/" + Oslc_objectiverDomainConstants.GOAL_PATH + "\">" + Oslc_objectiverDomainConstants.GOAL_LOCALNAME + "</a>" + "}",
    responses = { 
        @ApiResponse(description = "default response", content = {@Content(mediaType = OslcMediaType.APPLICATION_RDF_XML), @Content(mediaType = OslcMediaType.APPLICATION_XML), @Content(mediaType = OslcMediaType.APPLICATION_JSON), @Content(mediaType = OslcMediaType.TEXT_TURTLE), @Content(mediaType = MediaType.TEXT_HTML)})
    }
)
public Goal[] queryGoals(
                                                @PathParam("projectId") final String projectid ,

but I’m getting the same problem :

java.lang.IllegalArgumentException: The template variable ‘projectId’ has no value
at org.glassfish.jersey.uri.UriTemplate$1ValuesFromArrayStrategy.valueFor(UriTemplate.java:1020)
at org.glassfish.jersey.uri.UriTemplate.resolveTemplate(UriTemplate.java:706)
at org.glassfish.jersey.uri.UriTemplate.createUriComponent(UriTemplate.java:1030)
at org.glassfish.jersey.uri.UriTemplate.createURIWithStringValues(UriTemplate.java:964)
at org.glassfish.jersey.uri.UriTemplate.createURIWithStringValues(UriTemplate.java:827)
at org.glassfish.jersey.uri.UriTemplate.createURI(UriTemplate.java:790)
at org.glassfish.jersey.uri.internal.JerseyUriBuilder._buildFromMap(JerseyUriBuilder.java:822)
at org.glassfish.jersey.uri.internal.JerseyUriBuilder.buildFromMap(JerseyUriBuilder.java:801)
at org.eclipse.lyo.oslc4j.core.model.ServiceProviderFactory.resolvePathParameters(ServiceProviderFactory.java:356)
at org.eclipse.lyo.oslc4j.core.model.ServiceProviderFactory.createQueryCapability(ServiceProviderFactory.java:219)
at org.eclipse.lyo.oslc4j.core.model.ServiceProviderFactory.handleResourceClass(ServiceProviderFactory.java:98)
at org.eclipse.lyo.oslc4j.core.model.ServiceProviderFactory.initServiceProvider(ServiceProviderFactory.java:79)
at org.eclipse.lyo.oslc4j.core.model.ServiceProviderFactory.createServiceProvider(ServiceProviderFactory.java:49)
at cetic.be.objectiver.oslc.servlet.ServiceProvidersFactory.createServiceProvider(ServiceProvidersFactory.java:98)
at cetic.be.objectiver.oslc.servlet.ServiceProviderCatalogSingleton.initServiceProviders(ServiceProviderCatalogSingleton.java:225)
at cetic.be.objectiver.oslc.servlet.ServiceProviderCatalogSingleton.getServiceProviderCatalog(ServiceProviderCatalogSingleton.java:87)
at cetic.be.objectiver.oslc.services.ServiceProviderCatalogService.getHtmlServiceProvider(ServiceProviderCatalogService.java:130)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$VoidOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:143)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:865)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1623)
at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:214)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1700)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1667)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:220)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:152)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:505)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:267)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:698)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:804)
at java.base/java.lang.Thread.run(Thread.java:834)

I see. My suggestion does not really help. I was hoping the URLs for Query methods will not be constructed yet. But that is not the case.

Go back to you original design.

I am not sure how you are producing your code, but I here see that you are sending “serviceProviderId” as a parameter.
Should you not be sending “projectId” instead (or as well)?

The code was generated using Lyo Designer, then I manually added the project id to the code, so that I can read the project id from the url instead of hard-coding it in the code. I didn’t touch the other part of the code. Normally the construction of this url is not done at this stage.
PS : the source code of this class is the same as in your adaptor-rm-webapp example .

package com.sample.rm.servlet;

import java.net.URI;
import java.net.URISyntaxException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import javax.ws.rs.core.UriBuilder;

import org.eclipse.lyo.oslc4j.core.exception.OslcCoreApplicationException;
import org.eclipse.lyo.oslc4j.core.model.OslcConstants;
import org.eclipse.lyo.oslc4j.core.model.PrefixDefinition;
import org.eclipse.lyo.oslc4j.core.model.Publisher;
import org.eclipse.lyo.oslc4j.core.model.ServiceProvider;
import org.eclipse.lyo.oslc4j.core.model.ServiceProviderFactory;
import org.eclipse.lyo.oslc4j.core.OSLC4JUtils;

import com.sample.rm.ServiceProviderInfo;

import com.sample.rm.resources.DctermsDomainConstants;
import com.sample.rm.resources.Oslc_rmDomainConstants;
import com.sample.rm.services.ServiceProviderService1;

// Start of user code imports
// End of user code

public class ServiceProvidersFactory
{
private static Class<?>[] RESOURCE_CLASSES =
{
ServiceProviderService1.class
};

private ServiceProvidersFactory()
{
    super();
}

public static URI constructURI(final String serviceProviderId)
{
    String basePath = OSLC4JUtils.getServletURI();
    Map<String, Object> pathParameters = new HashMap<String, Object>();
    pathParameters.put("serviceProviderId", serviceProviderId);
    String instanceURI = "serviceProviders/{serviceProviderId}";

    final UriBuilder builder = UriBuilder.fromUri(basePath);
    return builder.path(instanceURI).buildFromMap(pathParameters);
}

public static URI constructURI(final ServiceProviderInfo serviceProviderInfo)
{
    return constructURI(serviceProviderInfo.serviceProviderId);
}

public static String constructIdentifier(final String serviceProviderId)
{
    return serviceProviderId;
}

public static String constructIdentifier(final ServiceProviderInfo serviceProviderInfo)
{
    return constructIdentifier(serviceProviderInfo.serviceProviderId);
}

public static ServiceProvider createServiceProvider(final ServiceProviderInfo serviceProviderInfo) 
        throws OslcCoreApplicationException, URISyntaxException, IllegalArgumentException {
    // Start of user code init
    // End of user code
    URI serviceProviderURI = constructURI(serviceProviderInfo);
    String identifier = constructIdentifier(serviceProviderInfo);
    String basePath = OSLC4JUtils.getServletURI();
    String title = serviceProviderInfo.name;
    String description = String.format("%s (id: %s; kind: %s)",
        "",
        identifier,
        "Service Provider");
    Publisher publisher = null;
    Map<String, Object> parameterMap = new HashMap<String, Object>();
    parameterMap.put("serviceProviderId", serviceProviderInfo.serviceProviderId);

    ServiceProvider serviceProvider = ServiceProviderFactory.createServiceProvider(basePath,
                                                "",
                                                title,
                                                description,
                                                publisher,
                                                RESOURCE_CLASSES,
                                                parameterMap);

    final PrefixDefinition[] prefixDefinitions =
    {
        new PrefixDefinition(OslcConstants.DCTERMS_NAMESPACE_PREFIX, new URI(OslcConstants.DCTERMS_NAMESPACE)),
        new PrefixDefinition(OslcConstants.OSLC_CORE_NAMESPACE_PREFIX, new URI(OslcConstants.OSLC_CORE_NAMESPACE)),
        new PrefixDefinition(OslcConstants.OSLC_DATA_NAMESPACE_PREFIX, new URI(OslcConstants.OSLC_DATA_NAMESPACE)),
        new PrefixDefinition(OslcConstants.RDF_NAMESPACE_PREFIX, new URI(OslcConstants.RDF_NAMESPACE)),
        new PrefixDefinition(OslcConstants.RDFS_NAMESPACE_PREFIX, new URI(OslcConstants.RDFS_NAMESPACE)),
        new PrefixDefinition(DctermsDomainConstants.DUBLIN_CORE_NAMSPACE_PREFIX, new URI(DctermsDomainConstants.DUBLIN_CORE_NAMSPACE))

,
new PrefixDefinition(Oslc_rmDomainConstants.REQUIREMENTS_MANAGEMENT_NAMSPACE_PREFIX, new URI(Oslc_rmDomainConstants.REQUIREMENTS_MANAGEMENT_NAMSPACE))
};
serviceProvider.setPrefixDefinitions(prefixDefinitions);

    serviceProvider.setAbout(serviceProviderURI);
    serviceProvider.setIdentifier(identifier);
    serviceProvider.setCreated(new Date());
    serviceProvider.setDetails(new URI[] {serviceProviderURI});

    // Start of user code finalize
    // End of user code
    return serviceProvider;
}

}

Hi

Have you considered setting the ServiceProvider URL through LyoDesigner? This way, you get a more consistent implementation (no manual changes need).

You can for example do as I show i figure below
Instructions are also here (The documents are a bit out of date, but this part should still be correct)
https://oslc.github.io/developing-oslc-applications/eclipse_lyo/modelling-howto#configure-service-url

Thank you so much Jad ! it works for me now

1 Like