JEE RESTfull web service tutorial ends with 404 - rest

I'm trying to run simple RESTfull service tutorial in Java Enterprise Edition and IntelliJ located here. I use GlassFish server 6.2.3 and OpenJDK 17.0.1. The application is very simple and strictly according to tutorial steps. But every time I start application the result is 404.
Server log is without errors (I can go into admin site on localhost:4848 and see my application loaded under Common tasks/Applications), but there are some errors in GlassFish Log:
Error while trying to load Bean Class com.example.restglassfishhelloworld.HelloApplication : java.lang.NoClassDefFoundError: javax/ws/rs/core/Application.]]
WELD-000119: Not generating any bean definitions from com.example.restglassfishhelloworld.HelloApplication because of underlying class loading error: Type javax.ws.rs.core.Application not found.
I suppose that this could be the reason for not working sites, but unfortunately don't understand it (the Application class exists) and don't know how to fix it. Or maybe there could be some other reason for the issue in Glassfish settings... Could somebody help me?
EDIT: link to project on GitHub

Based on comments from CrazyCoder (thank you) and this answer I was in the end able to run the JetBrains tutorial example with following combinations:
Tomcat 9 + OpenJDK 17 or OpenJDK 11 or JDK 1.8
Glassfish 4 + JDK 1.8
Important note for Windows users and Glassfish scenario - AS_JAVA variable should be added to asenv.bat instead of asenv.conf, it means add i.e. set AS_JAVA=C:\Program Files\Java\jdk1.8.0_321 (depends on your JDK installation path) to <glassfish root>\glassfish\config\asenv.bat
See this article.

Related

Error when deploying legacy application to Websphere Liberty

I'm having issues when trying to deploy a somewhat legacy application to Websphere Liberty to facilitate development.
The application runs fine in regular Websphere Server 8.5.5 but won't start in Websphere Liberty. We have another legacy application based on mostly the same technologies/frameworks that runs ok. Unfortunatelöy we won't move to a newer platform anytime soon.
I have the following features configured for my server:
<featureManager>
<feature>localConnector-1.0</feature>
<feature>jpa-2.0</feature>
<feature>jsf-2.0</feature>
<feature>jdbc-4.0</feature>
<feature>servlet-3.0</feature>
<feature>ejbLite-3.1</feature>
<feature>cdi-1.0</feature>
<feature>appSecurity-1.0</feature>
</featureManager>
When I try to start it I get an exception during annotation processing:
[VARNING ] CWNEN0047W: Resource annotations on the fields of the xxx.xxx.EditCardGroupBacking class will be ignored. The annotations could not be obtained because of the exception : java.lang.NoClassDefFoundError: javax.resource.spi.IllegalStateException
whiich seems strange since this would be a part of the JRE?
I have searched various forums/pages for an answer but can't faind the answer. Hopefully someone here can be of assistance.
I'm happy to provide more details of configuration and setup if needed.
javax.resource.spi.IllegalStateException is part of the JCA (Java EE Connector Architecture) specification (see JavaDoc here). You do not get it automatically from Java. Try enabling the jca-1.6 feature,
<feature>jca-1.6</feature>
FYI - if anyone else hits this who has newer level Java EE features, they would instead need:
<feature>jca-1.7</feature>

Whille deploying RESTful webservice, Shows error JdbcDataSource. not found

I have been trying to create my first RESTful execrcise using. But I am unable to deploy module due to error "com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Invalid resource : jdbc/playerDB__pm"
I checked and I have JNDI, daata source created.
Unlike specified in link. I am using:
-Netbeans 8.0.3, Java EE 7, GlassFish Server 4.
Also I have checked GlassFish is running fine.
Edit 1:
I have re-checked my 'Services' tab, and I could not find jdbc/__playedDB ,even though I have created it.
Its a bug, the JDBC resource file is not being created (atleast with versions I am using: GlassFish 4.1, Netbeans 8.0.2). Using GlassFish manually create.
There could still be different error untill you set following connectins:
database(data source) <- connection pool <- JNDI.

XPages Runtime version reports WCT instead of DSI

We have an existing Domino 8.5.3 FP4 server that is being used for XPages application for the first time. The latest Extension Library from OpenNTF has been installed, but the issue we're having appears to be with the standard XPages runtime.
A simple XPage is displaying:
Error 500
HTTP Web Server: Command Not Handled Exception
and in the xpages_exc_XXX.log:
Caused by: org.osgi.framework.BundleException: The bundle could not be resolved. Reason: Missing Constraint: Import-Package: org.eclipse.equinox.http.servlet
It appears to be due to WCT being reported as the version:
tell http osgi show version
XSP Runtime Version: [WCT8.5.3_FP4] 20130326.1400
What would cause WCT to be reported rather than DSI? I read it should always be DSI for Domino XPages.
tell http osgi diag org.eclipse.equinox.http.registry
Cannot find bundle org.eclipse.equinox.http.servlet.
The following files in D:\Lotus\Domino\osgi\rcp\eclipse\plugins appear to be have been updated after Domino was installed:
com.ibm.eclipse.equinox.http.registry.nl_6.2.3.20110815-1128.jar
org.eclipse.equinox.http.registry_1.0.100.v20080427-0830.jar
org.eclipse.equinox.http.servlet_1.0.100.v20080427-0830.jar
Thanks
Update 04 February 2014 09:45
I've performed the following:
tell http osgi diag org.eclipse.equinox.http.servlet
Cannot find bundle org.eclipse.equinox.http.servlet.
This does NOT list the following (which are displayed on a working server) - although bundles 0-7 and 10-152 are listed:
tell http osgi ss
8 ACTIVE org.eclipse.equinox.http.registry_1.0.100.v20080427-0830
Fragments=45
9 ACTIVE org.eclipse.equinox.http.servlet_1.0.100.v20080427-0830
Is there any further debugging I can do to determine why the bundles cannot be found?
I don't think the WCT vs. DSI label is the problem. That's just an artifact of how IBM builds fix packs. However, there does appear to be a problem with the set of OSGi plugins installed on your system.
It looks like it can't load equinox.http.registry because it can't find a required plugin -- equinox.http.servlet. Have you tried investigating why the second plugin doesn't load? In other words:
tell http osgi diag org.eclipse.equinox.http.servlet
That might help you chase down the missing constraint.

Gwt hosted mode stopped working from Eclipse on adding a special dependency via maven

On integrating a library on server side of my gwt app (maven, gwt 2.4) the development/hosted mode stopped working. The app works fine if deployed or run with "gwt:run" and all unit tests and integration tests pass as before.
If i start development mode (run/debug as web application) from Eclipse the develpoment mode view pops up but nothing else happens. normally the console should show some output but console keeps empty. So i don't even have a hint whats going wrong.
Can someone give some advice where to look / what to do to get at least a hint what's wrong?
if i check out the revision before integrating the library the development mode works! - at the moment i add the dependency (only adding not using it) it stops working.
Background about library i added (don't know if my problem relates to this):I had some problem on integrating the library. the library uses eclipse birt charting engine. This engine has a dependency to Apache derby db, this conflicted with another library. i solved this by excluding the derby dependency via maven. the second problem was a "command line too long" error on unit test - this was solved by updating the maven-surefire-plugin.
The Problem was hard but the solution is simple: With Java 7 it is working!
The problem could be reproduced on 2 of 3 machines. The machine without the problem is the only one that uses java 7. So i installed java 7 on my machine and linked eclipse to it - now hosted mode (from eclipse) works again :-).

WebServiceexception "No Content-type in the header" when trying to consume JBoss hosted webservice with a console application

I have a small assignment where I have to consume a webservice hosted with JBoss using a console application.
I have 2 projects in the same workspace, The DynamicWebApplication that I used as a webservice that is hosted using JBoss and a console application to access it. The console application also has the java files generated with wsimport
I am using the Eclipse IDE and whilst searching through the internet I found that I needed to copy the libraries found in JBOSS_HOME/common/lib to JBOSS_HOME/lib/endorsed but I still have the issue. Any ideas on why this is occurring?
PS. These are the libraries that I copied:
jbossws-native-jaxrpc.jar
jbossws-native-jaxws.jar
jbossws-native-jaxws-ext.jar
jbossws-native-saaj.jar
Ok I found the solution the the problem. Apparently I had to add the following code in the vm arguements:
-Djava.endorsed.dirs=/path-to/jboss-5.1.0.GA/lib/endorsed