WebSphere 8.5.5.9 with Jersey 2.25












0















I am deploying web application having jersey 2.25 on WebSphere 8.5.5.9. We are registering resources via below class.



public class ApplicationResourceConfig extends ResourceConfig {

/**
*
*/
public ApplicationResourceConfig() {
packages(verifyAndLoadResources());
}

/**
* @return
*/
private String getAllResources() {
List<String> resources = new ArrayList<>();
resources.add("com.ofs.fsapps.commonapps.appPreferences.resource.AppPreferencesResource");

resources.add("com.ofs.fsapps.commonapps.summary.rest.Summary");
return resources.toArray(new String[0]);
}

/**
* @return
*/
private String verifyAndLoadResources() {
List<String> packageResourceList = new ArrayList<>();
for (String resource : getAllResources()) {
try {
Class<?> result = Class.forName(resource);
if (result != null) {
register(StringUtils.substringAfterLast(resource, ".") + ".class");
packageResourceList.add(StringUtils.substringBeforeLast(resource, "."));
}
} catch (ClassNotFoundException e) {
System.out.println("Package/Class not Found : "+resource);
}catch(Exception e) {
System.out.println("Exception in loading Package/Class : "+resource);
}
}
return packageResourceList.toArray(new String[0]);
}

}


With above approach, none of the rest calls are working and responding as 404. If we make entry of packages/classes in web.xml then everything is working properly.



    <servlet>
<servlet-name>CommonRESTServlet</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>

<init-param>
<param-name>jersey.config.server.provider.classnames</param-name>
<param-value>com.ofs.fsapps.commonapps.summary.rest.Summary, com.ofs.fsapps.commonapps.appPreferences.resource.AppPreferencesResource</param-value>
</init-param>
</servlet>


Please note that shared library has been created and the same is linked with EAR as well.



Below are exceptions in SystemErr.log.




java.lang.NullPointerException
at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.existsServletForUrlPattern(WSServletContextListener.java:186)
at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.registerWSServlet(WSServletContextListener.java:168)
at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.parseAdaptersAndCreateDelegate(WSServletContextListener.java:132)
at com.sun.xml.ws.transport.http.servlet.WSServletContainerInitializer.onStartup(WSServletContainerInitializer.java:65)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initializeServletContainerInitializers(WebAppImpl.java:619)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:409)
at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:170)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:904)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:789)
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:427)
at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:719)











share|improve this question




















  • 1





    Possible duplicate of JAX-RS Jersey 2.10 support in Websphere 8

    – Gas
    Nov 24 '18 at 18:20











  • @Gas i have tried all the suggestions mentioned in post shared by you. Still not working.

    – Abhishek verma
    Nov 26 '18 at 4:24






  • 1





    Did you set this property com.ibm.websphere.jaxrs.server.DisableIBMJAXRSEngine=true in JVM or Meta-INF?

    – Gas
    Nov 26 '18 at 8:17
















0















I am deploying web application having jersey 2.25 on WebSphere 8.5.5.9. We are registering resources via below class.



public class ApplicationResourceConfig extends ResourceConfig {

/**
*
*/
public ApplicationResourceConfig() {
packages(verifyAndLoadResources());
}

/**
* @return
*/
private String getAllResources() {
List<String> resources = new ArrayList<>();
resources.add("com.ofs.fsapps.commonapps.appPreferences.resource.AppPreferencesResource");

resources.add("com.ofs.fsapps.commonapps.summary.rest.Summary");
return resources.toArray(new String[0]);
}

/**
* @return
*/
private String verifyAndLoadResources() {
List<String> packageResourceList = new ArrayList<>();
for (String resource : getAllResources()) {
try {
Class<?> result = Class.forName(resource);
if (result != null) {
register(StringUtils.substringAfterLast(resource, ".") + ".class");
packageResourceList.add(StringUtils.substringBeforeLast(resource, "."));
}
} catch (ClassNotFoundException e) {
System.out.println("Package/Class not Found : "+resource);
}catch(Exception e) {
System.out.println("Exception in loading Package/Class : "+resource);
}
}
return packageResourceList.toArray(new String[0]);
}

}


With above approach, none of the rest calls are working and responding as 404. If we make entry of packages/classes in web.xml then everything is working properly.



    <servlet>
<servlet-name>CommonRESTServlet</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>

<init-param>
<param-name>jersey.config.server.provider.classnames</param-name>
<param-value>com.ofs.fsapps.commonapps.summary.rest.Summary, com.ofs.fsapps.commonapps.appPreferences.resource.AppPreferencesResource</param-value>
</init-param>
</servlet>


Please note that shared library has been created and the same is linked with EAR as well.



Below are exceptions in SystemErr.log.




java.lang.NullPointerException
at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.existsServletForUrlPattern(WSServletContextListener.java:186)
at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.registerWSServlet(WSServletContextListener.java:168)
at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.parseAdaptersAndCreateDelegate(WSServletContextListener.java:132)
at com.sun.xml.ws.transport.http.servlet.WSServletContainerInitializer.onStartup(WSServletContainerInitializer.java:65)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initializeServletContainerInitializers(WebAppImpl.java:619)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:409)
at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:170)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:904)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:789)
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:427)
at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:719)











share|improve this question




















  • 1





    Possible duplicate of JAX-RS Jersey 2.10 support in Websphere 8

    – Gas
    Nov 24 '18 at 18:20











  • @Gas i have tried all the suggestions mentioned in post shared by you. Still not working.

    – Abhishek verma
    Nov 26 '18 at 4:24






  • 1





    Did you set this property com.ibm.websphere.jaxrs.server.DisableIBMJAXRSEngine=true in JVM or Meta-INF?

    – Gas
    Nov 26 '18 at 8:17














0












0








0








I am deploying web application having jersey 2.25 on WebSphere 8.5.5.9. We are registering resources via below class.



public class ApplicationResourceConfig extends ResourceConfig {

/**
*
*/
public ApplicationResourceConfig() {
packages(verifyAndLoadResources());
}

/**
* @return
*/
private String getAllResources() {
List<String> resources = new ArrayList<>();
resources.add("com.ofs.fsapps.commonapps.appPreferences.resource.AppPreferencesResource");

resources.add("com.ofs.fsapps.commonapps.summary.rest.Summary");
return resources.toArray(new String[0]);
}

/**
* @return
*/
private String verifyAndLoadResources() {
List<String> packageResourceList = new ArrayList<>();
for (String resource : getAllResources()) {
try {
Class<?> result = Class.forName(resource);
if (result != null) {
register(StringUtils.substringAfterLast(resource, ".") + ".class");
packageResourceList.add(StringUtils.substringBeforeLast(resource, "."));
}
} catch (ClassNotFoundException e) {
System.out.println("Package/Class not Found : "+resource);
}catch(Exception e) {
System.out.println("Exception in loading Package/Class : "+resource);
}
}
return packageResourceList.toArray(new String[0]);
}

}


With above approach, none of the rest calls are working and responding as 404. If we make entry of packages/classes in web.xml then everything is working properly.



    <servlet>
<servlet-name>CommonRESTServlet</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>

<init-param>
<param-name>jersey.config.server.provider.classnames</param-name>
<param-value>com.ofs.fsapps.commonapps.summary.rest.Summary, com.ofs.fsapps.commonapps.appPreferences.resource.AppPreferencesResource</param-value>
</init-param>
</servlet>


Please note that shared library has been created and the same is linked with EAR as well.



Below are exceptions in SystemErr.log.




java.lang.NullPointerException
at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.existsServletForUrlPattern(WSServletContextListener.java:186)
at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.registerWSServlet(WSServletContextListener.java:168)
at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.parseAdaptersAndCreateDelegate(WSServletContextListener.java:132)
at com.sun.xml.ws.transport.http.servlet.WSServletContainerInitializer.onStartup(WSServletContainerInitializer.java:65)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initializeServletContainerInitializers(WebAppImpl.java:619)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:409)
at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:170)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:904)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:789)
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:427)
at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:719)











share|improve this question
















I am deploying web application having jersey 2.25 on WebSphere 8.5.5.9. We are registering resources via below class.



public class ApplicationResourceConfig extends ResourceConfig {

/**
*
*/
public ApplicationResourceConfig() {
packages(verifyAndLoadResources());
}

/**
* @return
*/
private String getAllResources() {
List<String> resources = new ArrayList<>();
resources.add("com.ofs.fsapps.commonapps.appPreferences.resource.AppPreferencesResource");

resources.add("com.ofs.fsapps.commonapps.summary.rest.Summary");
return resources.toArray(new String[0]);
}

/**
* @return
*/
private String verifyAndLoadResources() {
List<String> packageResourceList = new ArrayList<>();
for (String resource : getAllResources()) {
try {
Class<?> result = Class.forName(resource);
if (result != null) {
register(StringUtils.substringAfterLast(resource, ".") + ".class");
packageResourceList.add(StringUtils.substringBeforeLast(resource, "."));
}
} catch (ClassNotFoundException e) {
System.out.println("Package/Class not Found : "+resource);
}catch(Exception e) {
System.out.println("Exception in loading Package/Class : "+resource);
}
}
return packageResourceList.toArray(new String[0]);
}

}


With above approach, none of the rest calls are working and responding as 404. If we make entry of packages/classes in web.xml then everything is working properly.



    <servlet>
<servlet-name>CommonRESTServlet</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>

<init-param>
<param-name>jersey.config.server.provider.classnames</param-name>
<param-value>com.ofs.fsapps.commonapps.summary.rest.Summary, com.ofs.fsapps.commonapps.appPreferences.resource.AppPreferencesResource</param-value>
</init-param>
</servlet>


Please note that shared library has been created and the same is linked with EAR as well.



Below are exceptions in SystemErr.log.




java.lang.NullPointerException
at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.existsServletForUrlPattern(WSServletContextListener.java:186)
at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.registerWSServlet(WSServletContextListener.java:168)
at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.parseAdaptersAndCreateDelegate(WSServletContextListener.java:132)
at com.sun.xml.ws.transport.http.servlet.WSServletContainerInitializer.onStartup(WSServletContainerInitializer.java:65)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initializeServletContainerInitializers(WebAppImpl.java:619)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:409)
at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:170)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:904)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:789)
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:427)
at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:719)








rest web-applications jersey-2.0 websphere-8






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 25 '18 at 3:21







Abhishek verma

















asked Nov 23 '18 at 21:56









Abhishek vermaAbhishek verma

53




53








  • 1





    Possible duplicate of JAX-RS Jersey 2.10 support in Websphere 8

    – Gas
    Nov 24 '18 at 18:20











  • @Gas i have tried all the suggestions mentioned in post shared by you. Still not working.

    – Abhishek verma
    Nov 26 '18 at 4:24






  • 1





    Did you set this property com.ibm.websphere.jaxrs.server.DisableIBMJAXRSEngine=true in JVM or Meta-INF?

    – Gas
    Nov 26 '18 at 8:17














  • 1





    Possible duplicate of JAX-RS Jersey 2.10 support in Websphere 8

    – Gas
    Nov 24 '18 at 18:20











  • @Gas i have tried all the suggestions mentioned in post shared by you. Still not working.

    – Abhishek verma
    Nov 26 '18 at 4:24






  • 1





    Did you set this property com.ibm.websphere.jaxrs.server.DisableIBMJAXRSEngine=true in JVM or Meta-INF?

    – Gas
    Nov 26 '18 at 8:17








1




1





Possible duplicate of JAX-RS Jersey 2.10 support in Websphere 8

– Gas
Nov 24 '18 at 18:20





Possible duplicate of JAX-RS Jersey 2.10 support in Websphere 8

– Gas
Nov 24 '18 at 18:20













@Gas i have tried all the suggestions mentioned in post shared by you. Still not working.

– Abhishek verma
Nov 26 '18 at 4:24





@Gas i have tried all the suggestions mentioned in post shared by you. Still not working.

– Abhishek verma
Nov 26 '18 at 4:24




1




1





Did you set this property com.ibm.websphere.jaxrs.server.DisableIBMJAXRSEngine=true in JVM or Meta-INF?

– Gas
Nov 26 '18 at 8:17





Did you set this property com.ibm.websphere.jaxrs.server.DisableIBMJAXRSEngine=true in JVM or Meta-INF?

– Gas
Nov 26 '18 at 8:17












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53453315%2fwebsphere-8-5-5-9-with-jersey-2-25%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53453315%2fwebsphere-8-5-5-9-with-jersey-2-25%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

404 Error Contact Form 7 ajax form submitting

How to know if a Active Directory user can login interactively

TypeError: fit_transform() missing 1 required positional argument: 'X'