vijay kaaman

Greenhorn
+ Follow
since May 18, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by vijay kaaman

I find the following error message.

Nov 17, 2011 11:15:37 PM org.apache.catalina.startup.HostConfig deployDirectory
SEVERE: Error deploying web application directory Beer-v1
java.lang.UnsupportedClassVersionError: com/example/web/BeerSelect : Unsupported major.minor version 51.0 (unable to load class com.example.web.BeerSelect)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2822)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1159)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:108)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:58)
at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:297)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1078)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:261)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4612)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

in the catalina.* file
6 years ago
There is a web.xml in the "C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\Beer-v1\WEB-INF" directory.

This is what I have in web.xml

<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmln:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version = "2.4">

<servlet>
<servlet-name>Ch3 Beer</servlet-name>
<servlet-class>com.example.web.BeerSelect</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>Ch3 Beer</servlet-name>
<url-pattern>/SelectBeer.do</url-pattern>

</servlet-mapping>

</web-app>

I have the following code in BeerSelect.java and is placed in "C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\Beer-v1\WEB-INF\classes\com\example\web" directory. The BeerSelect.class file is also present in this directory.

package com.example.web;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class BeerSelect extends HttpServlet {

public void doPost(HttpServletRequest request,
HttpServletResponse response
) throws IOException, ServletException{

response.setContentType("text/html");

PrintWriter out = response.getWriter();

out.println("Beer Selection Advice<br>");

String c = request.getParameter("color");

out.println("<br> Wants beer color "+ c);
}

}

This is the code in form.html

<html>
<body>
<h1 align="center">Beer Selection Page </h1>
<form method = "POST" action="SelectBeer.do">Select beer characteristics<p>

Color:<select name="color" size="1">
<option value="light">light</option>
<option value="amber">amber</option>
<option value="brown">brown</option>
<option value="dark">dark</option>
</select>

<br>
<br>

<center>
<input type = "SUBMIT">
</center>

</form>
</body>
</html>

6 years ago
I am on windows 7.

I have this "form.html" in the following directory location.

C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\Beer-v1\form.html

I believe I have tomcat started.
Navigated to.. C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin and ran the Tomcat6w as administrator.

I used the following URLs..
http://localhost:80/Beer-v1/form.html
http://localhost:8080/Beer-v1/form.html
http://localhost/Beer-v1/form.html

Tried this on IE and Google chrome.

Keep getting the error..
HTTP Status 503 - This application is not currently available

--------------------------------------------------------------------------------

type Status report

message This application is not currently available

description The requested service (This application is not currently available) is not currently available.


--------------------------------------------------------------------------------

Apache Tomcat/6.0.33
6 years ago
Hi..

I am using windows 7.

JAVA_HOME and PATH environment variables set. "C:\Program Files\Java\jdk1.7.0_01"

on the following directory.."C:\SCWCD\beerV1\src\com\example\web\" there exists a file called BeerSelect.java

when I issue the javac command in the above directory as "javac BeerSelect.java"..I get the "javac not recognized as an internal external command.." error message. However, if I move the java file to the bin directory in "C:\Program Files\Java\jdk1.7.0_01", I do not get the javac not recognized error.

Can someone help me with this?

THank you.



6 years ago
I am preparing to take the SCJP 6.0.

I am primarily using Sierra and Bates for my preparation.

I found some interesting (read those that I could not answer questions on boxing, and would welcome any help to understand this topic a little better.

1. Long and Integer extend Number.
***Why does 12 get boxed to an Integer object, when I am only assigning it to a Supertype Number? I mean, why did it not get Boxed to Number directly?***

Number x = 12;

May be the reason I cannot cast an Integer x to Long is because they are not on the same class tree..i.e, Long does not extend Integer, and Integer does not extend Long. Please clarify if my assumption is right.
Number y = (Long) x;

2. I can do this
int x = 1;

Number y = x;

but when I do this..
if (y == x) I get an error..
would it be safe for me to assume that, a Number object and a Integer object cannot be compared, even if Integer is ONLY a subclass of Number. I ask this question becuase the compiler does not complain when I try to do this.
int x = 1;
Integer y = x;
if (y == x)..no errors