Hello,

I created a new project with contract first approach in Eclipse. 
When I ask for the resource it throws "requested resource () is not
available".
Env:
ApacheWink : apache-wink-1.3.0
Tomcat : apache-tomcat-7.0.12

I read the https://cwiki.apache.org/WINK/jax-rs-getting-started.html
and it states: 
Step 2 - Creating a javax.ws.rs.core.Application sub-class
For non-JAX-RS aware web container environments (most environments are
currently non JAX-RS aware), a javax.ws.rs.core.Application sub-class needs
to be created which returns sets of JAX-RS root resources and providers. In
the following example, there is only one root resource that will need to be
returned.

My application is deployed in tomcat, hence I do not have to create
sub-class of core Application?. (please see the web.xml below) 

In the WEB-INF/application file I enter the resource :
main.java.com.connect.lockunlock.impl.LockUnlock

----Pom file------
<project xmlns="http://maven.apache.org/POM/4.0.0";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
ttp://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>RemoteLockUnlock</groupId>
        <artifactId>LockUnlock</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <packaging>war</packaging>
        <name>LockUnlock</name>
        <description>LockUnlock</description>

        <dependencies>
                <dependency>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-log4j12</artifactId>
                        <version>1.7.3</version>
                </dependency>
                <dependency>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-ext</artifactId>
                        <version>1.7.3</version>
                </dependency>
                <dependency>
                        <groupId>org.apache.wink</groupId>
                        <artifactId>wink-common</artifactId>
                        <version>1.3.0</version>
                </dependency>

                <dependency>
                        <groupId>org.apache.wink</groupId>
                        <artifactId>wink-server</artifactId>
                        <version>1.3.0</version>
                </dependency>
                <dependency>
                        <groupId>woodstox</groupId>
                        <artifactId>wstx-asl</artifactId>
                        <version>3.2.1</version>
                        <scope>test</scope>
                </dependency>

        </dependencies>
        <build>
        <finalName>LockUnlock</finalName>
                <defaultGoal>buildRLU</defaultGoal>
                
                <plugins>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-surefire-plugin</artifactId>
                                <version>2.14.1</version>
                                <configuration>
                                        <additionalClasspathElements>
                                        
<additionalClasspathElement>${basedir}/WebContent/WEB-INF</additionalClasspathElement>
                                        </additionalClasspathElements>
                                </configuration>
                        </plugin>
                        <plugin>
                                <groupId>org.jvnet.jaxb2.maven2</groupId>
                                <artifactId>maven-jaxb2-plugin</artifactId>
                                <version>0.8.3</version>
                                <executions>
                                        <execution>
                                                <goals>
                                                        <goal>generate</goal>
                                                </goals>
                                        </execution>
                                </executions>
                                <configuration>













                                        <schemaDirectory>xsd</schemaDirectory>
                                        <schemaIncludes>
                                                <include>*.xsd</include>
                                        </schemaIncludes>
                                
<generateDirectory>${project.build.directory}/generated-sources</generateDirectory>

                                </configuration>
                        </plugin>

                        <plugin>
                                <groupId>org.apache.tomcat.maven</groupId>
                                <artifactId>tomcat7-maven-plugin</artifactId>
                                <version>2.1</version>
                        </plugin>
                        <plugin>
                                <artifactId>maven-compiler-plugin</artifactId>
                                <version>3.0</version>
                                <configuration>
                                        <source>1.7</source>
                                        <target>1.7</target>
                                </configuration>
                        </plugin>
                        <plugin>
                                <artifactId>maven-war-plugin</artifactId>
                                <version>2.3</version>
                                <configuration>
                                        
<warSourceDirectory>WebContent</warSourceDirectory>
                                        
<failOnMissingWebXml>false</failOnMissingWebXml>
                                </configuration>
                        </plugin>
                </plugins>
        </build>
</project>

--------web.xml----


<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns="http://java.sun.com/xml/ns/javaee";
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"; id="WebApp_ID"
version="3.0">
  
 
        <display-name>LockUnlock</display-name>
        <description>LockUnlock</description>

        
        <servlet>
                <servlet-name>LockUnlock</servlet-name>
        
<servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
                <init-param>


                        <param-name>applicationConfigLocation</param-name>
                        <param-value>WEB-INF/application</param-value>
                </init-param>
        </servlet>
        <servlet-mapping>
                <servlet-name>LockUnlock</servlet-name>
                <url-pattern>/*</url-pattern>
        </servlet-mapping>
 </web-app>


---Resource---

@Path(" ")
public class LockUnlock {
        public static final String ID = "LockUnlock:1";
        
        @Context
        HttpHeaders requestHeaders;
        
        @Path("lock")
        @GET
        @Produces(MediaType.APPLICATION_XML)
        public ResponseBuilder lock() {

                System.out.println("creating Lock");
                /**
                 * For debug we print the header information
                 */
                for (String header : 
requestHeaders.getRequestHeaders().keySet()) {
                        System.out.println(header);
                }
                
                System.out.println("Lock created");
                return Response.status(200);
        }

        }

http://localhost:8080/LockUnlock/lock


Thanks in advance for your hints.
Sanjeev



--
View this message in context: 
http://apache-wink-users.3471013.n2.nabble.com/requested-resource-is-not-available-tp7572681.html
Sent from the Apache Wink Users mailing list archive at Nabble.com.

Reply via email to