i need your help ... it s getting me crazy, i try to deploy a very simple application on to a websphere liberty 16.0.0.2 server. My first big problem, the rest api cant be called. Getting the error: No root resource matching request path /admin-web-1.0-SNAPSHOT/api/account has been found, Relative Path: /api/account.
The Code: AppREST
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
import java.util.HashSet;
import java.util.Set;
@ApplicationPath("api")
public class AppREST extends Application {
public Set<Class<?>> getClasses() {
Set<Class<?>> resources = new HashSet<Class<?>>();
resources.add(AccountREST.class);
resources.add(GroupREST.class);
return resources;
}
}
AccountREST
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.inject.Inject;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.util.List;
@ManagedBean
@RequestScoped
@Path("/account")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public class AccountREST {
@Inject
private AccountFacade accountFacade;
@POST
public void createAccount(AccountRequest accountRequest){
}
@GET
public List<AccountRequest> getAccountRequests() {
return accountFacade.getAccountRequests();
}
GroupREST is nearly the same to AccountREST. The web.xml is:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<module-name>admin-web</module-name>
<display-name>Eportal Registration Admin</display-name>
</web-app>
The POM File includes this dependencies:
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>eportal.registration.admin</groupId>
<artifactId>admin-models</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>eportal.registration.admin</groupId>
<artifactId>admin-usecases</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>eportal.registration.admin</groupId>
<artifactId>admin-models</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>eportal.registration.admin</groupId>
<artifactId>admin-repositories</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
I really cant see the mistake i nearly copy past it from a working project :(
Now second Problem the JDBC Drive. I downloaded the mysql-connector-java-6.0.3.jar from maven central. And added it to the server.xml:
<?xml version="1.0" encoding="UTF-8"?>
<server description="new server">
<!-- Enable features -->
<featureManager>
<feature>javaee-7.0</feature>
</featureManager>
<httpEndpoint id="defaultHttpEndpoint"
httpPort="9080" />
<applicationManager autoExpand="true"/>
<dataSource id="RegistrationAdminDB" jndiName="jdbc/RegistrationAdminDB">
<jdbcDriver libraryRef="MySQLLib"/>
<properties databaseName="REGISTRATIONADMINDB" serverName="localhost" portNumber="3306"/>
</dataSource>
<library id="MySQLLib">
<fileset dir="/opt/ibm/wlp/clients/mysql-connector-java-6.0.3.jar"/>
</library>
</server>
Getting the error
java.lang.RuntimeException: java.sql.SQLNonTransientException: DSRA4000E: A valid JDBC driver implementation class was not found for the jdbcDriver dataSource[RegistrationAdminDB]/jdbcDriver[default-0] using the library MySQLLib. []
at com.ibm.ws.resource.internal.ResourceFactoryTrackerData$1.getService(ResourceFactoryTrackerData.java:113)
at startup.
Well i cant find the mistakes but unlucky nothing works :( Thanks for your help!