Reputation: 49
I'm a wicket newbie and would like to deploy the simple well-known helloworld from wicket-examples but without IDE, ant or maven. What I've done:
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<display-name>Wicket Examples</display-name>
<filter>
<filter-name>HelloWorldApplication</filter-name>
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
<init-param>
<param-name>applicationClassName</param-name>
<param-value>HelloWorldApplication</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>HelloWorldApplication</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
HelloWorld.html:
<html>
<body>
<span wicket:id="message">Message goes here!</span>
</body>
</html>
HelloWorld.java:
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
public class HelloWorld extends WebPage
{
public HelloWorld()
{
add(new Label("message", "Hello World!"));
}
}
HelloWorldApplication.java:
import org.apache.wicket.protocol.http.WebApplication;
public class HelloWorldApplication extends WebApplication
{
public Class getHomePage()
{
return HelloWorld.class;
}
}
wicket-HelloWorld.war:
WEB-INF/
WEB-INF/web.xml
WEB-INF/classes/
WEB-INF/classes/HelloWorldApplication.class
WEB-INF/classes/HelloWorld.class
WEB-INF/classes/HelloWorld.html
WEB-INF/lib/
WEB-INF/lib/wicket-1.4.15.jar
WEB-INF/lib/slf4j-api.jar
I'm not sure if I need slf4j-api.jar for this simple example
When deployed to tomcat http://localhost:8080/wicket-HelloWorld/ gives:
The requested resource () is not available
What I'm doing wrong?
Upvotes: 3
Views: 3837
Reputation: 49
I've been able to make it work:
1.- I added slf4j-jdk14.jar. Manning Wicket in action bonus chapter 15 was wrong. It tells only to add slf4j-api.jar
2.- wicket-1.4.15.jar MUST BE in WEB-INF/lib. Trying to include it in catalina.properties under shared.loader or $CATALINA_BASE/lib doesn't work for me; despite some webs recommending these places as alternatives to include libraries at runtime.
I've found almost no documentation to build wicket apps using only javac. I think somebody experienced enough should write a little HOW-TO. You're almost forced to use Maven to program even the simplest application in wicket
Regards and thanks to all for the help
Francesc
Upvotes: 1
Reputation: 340693
It's hard to tell what is wrong with your application. I created a quick sample as follows to test the configuration:
$ mvn archetype:generate
Choosing wicket-archetype-quickstart
(189 on my machine), version 1.4.15...
$ mvn tomcat:run
Browsing to http://localhost:8080/wicket
and the application works like a charm.
$ mvn package
$ cd target/wicket-1.0-SNAPSHOT/WEB-INF/lib
And these are the libraries required:
Sources:
$ cd src/main
$ tree
And my source structure is:
.
|-- java
| `-- com
| `-- blogspot
| `-- nurkiewicz
| |-- HomePage.html
| |-- HomePage.java
| `-- WicketApplication.java
|-- resources
| `-- log4j.properties
`-- webapp
`-- WEB-INF
`-- web.xml
I understand you don't want to use maven (great if you are learning and trying to do anything from scratch), but without any further information I can only advice you to look at my working example above. First of your libraries set seems to be incomplete.
Upvotes: 0