I am trying to creata a Domino OSGI plugin which exposes a simple Hello World servlet.
To do this I created in eclipse a plugin project(with web.xml and the servlet in place) , a feature project containing this plugin and an updated site project.
After this I created an application in Domino designer using the 'Eclipse Update Site' as template (name RestDemoUpdateSite.nsf).
With this application open in Domino administrator, I successfully imported my eclipse update site.
Finally I copied RestDemoUpdateSite.nsf to the folder -
C:\Program Files\IBM\Domino\data and added the line OSGI_HTTP_DYNAMIC_BUNDLES=RestDemoUpdateSite.nsf in notes.ini.
The link http://<>/RestDemoUpdateSite.nsf opens fine
A GET request to http://<>/RestDemoUpdateSite.nsf/api/ gives the json response
{
"services":[
{
"name":"Data",
"enabled":false,
"version":"9.0.1",
"href":"\/RestDemoUpdateSite.nsf\/api\/data"
},
{
"name":"Calendar",
"enabled":false,
"version":"9.0.1",
"href":"\/RestDemoUpdateSite.nsf\/api\/calendar"
},
{
"name":"Core",
"enabled":true,
"version":"9.0.1",
"href":"\/RestDemoUpdateSite.nsf\/api\/core"
}
]
}
A GET request to my servlet http://<>/RestDemoUpdateSite.nsf/serviceapi/student gives the error
HTTP Web Server: Couldn't find design note - serviceapi/student [/RestDemoUpdateSite.nsf/serviceapi/student] Anonymous
Any suggestion or hints as to what might be going wrong would be of great help.
Thank you
The first step is to make sure your plugin is being loaded by the OSGi framework. Execute the following server console command:
tell http osgi ss {bundle.name}
For example, tell http osgi ss com.ibm.domino.services lists all the plugins matching the given name. The listing tells you whether a plugin is ACTIVE, RESOLVED, INSTALLED, etc.
Assuming your plugin is being loaded, the next step is to make sure you are defining your servlet correctly. You said you included a web.xml file, but OSGi servlets are typically defined in plugin.xml. They implement the org.eclipse.equinox.http.registry.servlets extension. You can find more details in these slides. See the section starting with "Creating, deploying & debugging a simple servlet".
Related
Sorry if this is a duplicate, I looked at several other questions but none seemed to match or provide workable solutions.
Problem
I am writing a Spring Boot (v2.0.2) app, this app exposes a RESTful API which then calls into a WSDL service. I've generated the WSDL classes with Maven/jaxb plugin and everything works from my dev machine. When deployed to the server I get an error that the WSDL service class can not load the underlying WSDL file. The problem is that when the Java classes are generated it is using the full path from my dev machine (snippet from the generated service class)
try {
URL baseUrl;
baseUrl = com.mytest.WSDLService.class.getResource(".");
url = new URL(baseUrl, "/home/users/me/projects/wsdltest/wsdl/MyWSDL.wsdl");
} catch (MalformedURLException e) {
The WSDL file (MyWSDL.wsdl) is in the spring boot JAR file for my application, it is in a subdirectory off root called 'wsdl'
Question Is there a way that I can load this WSDL from the JAR file without having to modify the generated classes?
Ideal Solution I'm hoping to find a solution that doesn't make me modify the generated files (we intend to do this for several services), ideally I'd like a solution which can be done at build time (in the pom.xml?), if that's possible.
Solutions Tried
A post on here suggested using the "wsdlLocation" tag in my pom.xml and provide a explicit path to the WSDL file, e.g. <wsdlLocation>/wsdl/MyWSDL.wsdl</wsdlLocation>
Tried most of the solutions from this thread
Thanks in advance
I think I was able to find a solution thanks to this SO Thread. Evidently the answer depends on the version of the jaxws tool being used in maven (jaxws-maven-plugin). The project (which I inherited) explicitly asked for version 1.12 (which invoked JAX-WS RI 2.1.7-b01-), using this version of the tools I was able to use the '<wsdlLocation>classpath:wsdl/MyWSDL.wsdl</wsdlLocation>' solution in the thread mentioned. Once I noticed that the pom was using an explicit version I removed that the jaxws was updated (using JAX-WS RI 2.2.10) but then the 'classpath' solution stopped working. I switched to the other option mentioned in the thread '<wsdlLocation>/wsdl/MyWSDL.wsdl</wsdlLocation>'
I did a quick test and this seemed to have solved the problem (in both my dev machine and my test site).
Thank you
I am new to spring development so i am stuck here. Is there any configuration while switching spring + maven project from linux to windows. I am running on tomcat server 7. The project is initially developed in linux. I have moved all the file from linux to wondows. While running on server, i get error The requested resource (/myproject/login/) is not available. Do i need to make any changes or add add in configuation.
Thanks in advance.
I think you have missed something.
Try this.but i'am not sure this is working or not.
Tomcat, by default invoker servlet disabled (commented out in the web.xml file). You have to create a 'servlet' and a 'servlet-mapping' entry in your web.xml.
Once you do, you can get rid of the "servlet/" part of your url.
Check out the following URL for more information regarding the invoker servlet:
http://faq.javaranch.com/view?InvokerServlet
I've got an issue deploying an application that contains one custom tag I've made.
Every times that I try to test the application, I get this error:
Deployed application at context path / but context failed to start
C:\\NetBeansProjects\\nbproject\build-impl.xml:1048: The module has not been deployed.
I followed this guide up to before "Accessing the Tag Body" chapter.
I have a little doubt in this part:
Let us compile above class and copy it in a directory available in environment variable CLASSPATH.
I have to create a CLASSPATH variable between Windows System's or User's variables, but which path I have to put into? The MyCustomTag.java class's path? Maybe this could be the problem.
I use NetBeans 7.4 with Tomcat 7.0.41 and Struts2.
This should be easy, but it's been costing me tons of time. I basically can't get a RESTful web service running under eclipse. I'm sure I'm missing something stupid, but resources seem to be a bit scattered and nothing covers the recent 4.0/EE 7 release.
I have a clean install of Eclipse Kepler (4.3). I try and set up a basic RESTful app using the following steps.
I have Java EE 7 installed
I open eclipse, point it to a fresh workspace and create a new 'Dynamic Web Application'.
Project name doesn't particularly matter, a new Target Runtime is created by downloading the Glassfish extension (New Runtime->Download additional server adapters->Glassfish). This requires restarting eclipse - so just repeat the previous, but select a Glassfish 4.0 runtime after clicking 'New Runtime'. Web Module is 3.1, everything else is default. I click 'Finish' to create my new project.
I then right click and open project properties, then 'Project Facets'. I check of JAX-RS (REST Web Services). Then click 'Further Configuration required...". I then select 'Disable Library Configuration' from the drop down. The fields receive the following values:
JAX-RS servlet name: JAX-RS Servlet
JAX-RS servlet class name: org.glassfish.jersey.servlet.ServletContainer
URL mapping patterns: /jaxrs/*
I then click OK to close all the windows.
Now adding a New->'RESTful Web Service from Pattern' creates a new class, that doesn't seem to ever get picked up by glassfish on deployment. My understanding is that it should auto scan and pick up things with an #path. It doesn't seem to. If I finagle things enough I can seem to access the application.wadl - but doesn't show my resource.
If I go back into properties and take a look at my JAX-RS project facet, I'm presented with an error box saying some of my values are invalid.
In the workspace log I'm greeted with the following exception:
!ENTRY org.eclipse.jst.jee 4 0 2013-07-02 21:54:27.780
!MESSAGE org.eclipse.jst.javaee.web.internal.impl.WebAppImpl cannot be cast to org.eclipse.jst.j2ee.webapplication.WebApp
!STACK 0
java.lang.ClassCastException: org.eclipse.jst.javaee.web.internal.impl.WebAppImpl cannot be cast to org.eclipse.jst.j2ee.webapplication.WebApp
at org.eclipse.jst.ws.jaxrs.core.internal.project.facet.UpdateWebXMLForJ2EE.run(UpdateWebXMLForJ2EE.java:32)
at org.eclipse.jst.jee.model.internal.JEE5ModelProvider.modify(JEE5ModelProvider.java:255)
at org.eclipse.jst.jee.model.internal.Web25MergedModelProvider.modify(Web25MergedModelProvider.java:92)
at org.eclipse.jst.ws.jaxrs.core.internal.project.facet.JAXRSFacetInstallDelegate.createServletAndModifyWebXML(JAXRSFacetInstallDelegate.java:275)
at org.eclipse.jst.ws.jaxrs.core.internal.project.facet.JAXRSFacetInstallDelegate.execute(JAXRSFacetInstallDelegate.java:156)
at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.callDelegate(FacetedProject.java:1477)
at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.modifyInternal(FacetedProject.java:441)
at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.mergeChangesInternal(FacetedProject.java:1181)
at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.access$2(FacetedProject.java:1117)
at org.eclipse.wst.common.project.facet.core.internal.FacetedProject$5.run(FacetedProject.java:1099)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345)
at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.mergeChanges(FacetedProject.java:1109)
at org.eclipse.wst.common.project.facet.core.internal.FacetedProjectWorkingCopy.commitChanges(FacetedProjectWorkingCopy.java:2020)
at org.eclipse.wst.common.project.facet.ui.internal.FacetsPropertyPage$4.run(FacetsPropertyPage.java:232)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345)
at org.eclipse.wst.common.project.facet.ui.internal.FacetsPropertyPage$5.run(FacetsPropertyPage.java:246)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Any insight would be so greatly appreciated.
Try running Eclipse with Java SE. The parts of Java EE that your project needs to compile against can come from Glassfish itself. You might also need to use #Path rather than #path since it matches to a type name and is case sensitive.
I have been attempting to create a super simple web-service (non-SOAP wsdl Server) within Eclipse Java EE (Juno) using Java 1.6. I want the web-service war to be as simple as possible, as in this simple (first reply in the thread).
IOW, I want the war file to just have the class I have defined (which includes the #WebService and #WebMethod annotations) and possibly a web.xml file which can then be deployed in Eclipse Java EE to the JBoss 6.0 server I have set up.
I must be missing some simple step somewhere. Each time I have tried, I either cannot get the web-service to deploy, or Eclipse wants to auto-generate and add a huge number of useless classes to the deployment.
I have Eclipse Java EE set up and I created a File -> New-> Dynamic Web Project and call it ProjectHelloService. I then create a single class in the project under Java Resources/src in its own package, ws.simple. The class looks like this:
package ws.simple;
import javax.jws.WebMethod;
import javax.jws.WebService;
#WebService
public class HelloService
{
#WebMethod
public String sayHello(String name)
{
return "Hello, " + name;
}
}
I then start up the JBoss server and "Add" the project to JBoss. I see the "...deploy, ctxPath=/ProjectHelloService" message indicating that my project has deployed. However, when I go to the default JBoss page -> JBoss Web Services Console -> View a list of deployed services, I see "There are currently no endpoints deployed ". When I dig around and try to see what was deployed in JBoss's server/default folder, I cannot find anything in the deploy folder.
Again, I must be missing some step somewhere. For example, I don't see a .war (or even .jar) file being generated, in Eclipse nor in the JBoss deploy folder. However, I am not deeply versed in the nuances of how Eclipse works with JBoss 6.0, so I might be missing some configuration subtlety here.
Is there something simple I can do to get a super stupid simple .war file to deploy to the Eclipse contained JBoss 6.0 so that I can see my web-service? And since JBoss is able to do all the auto-file generation automatically from the annotations in the .war file, I don't want Eclipse to do all the extra file stub generation crap. That's CORBA old school style, and makes for a much less manageable project (at least for the area I am working in right now).
And I don't suppose there is some way that I can have the above in Eclipse while having the convenience of the Netbeans approach to creating and managing Java web-services. If there is, I sure would like to know what it is.
Thank you for any guidance and/or assistance you can over here.