首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

关于用Jbuilder9编译程序以及用weblogic8.1发布Serverlet的有关问题

2012-01-26 
关于用Jbuilder9编译程序以及用weblogic8.1发布Serverlet的问题1.首先是Jbuilder9没有集成J2EE的类(比如:j

关于用Jbuilder9编译程序以及用weblogic8.1发布Serverlet的问题
1.首先是Jbuilder9没有集成J2EE的类(比如:javax.servlet.http.HttpServlet)所以在编译下面这个简单的程序时报错,程序为:
import   javax.servlet.http.HttpServlet;
import   javax.servlet.ServletException;
import   javax.servlet.http.HttpServletRequest;
import   javax.servlet.http.HttpServletResponse;
import   java.io.IOException;
import   java.io.PrintWriter;
public   class   ServletDemo   extends   HttpServlet{
        public   void   doGet(HttpServletRequest   request,HttpServletResponse   response)
        throws   IOException,ServletException   {
        response.setContentType( "text/html;charset=GB2312 ");
        PrintWriter   out=response.getWriter();
        out.println( " <html> ");
        out.println( " <head> ");
        out.println( " <title> Hello   World! </title> ");
        out.println( " </head> ");
        out.println( " <body> ");
        out.println( " <h1> Hello!这是服务器小应用程序ServletDemo的输出! </h1> ");
        out.println( " </body> ");
        out.println( " </html> ");
        }    
}
报错是:ServletDemo   of   class   ServletDemo(src)   failed   to   load   superclass   HttpServlet

于是我按照网上查的解决方法:在JB的configure   servers里面配好了weblogic8.1,可是编译仍然没有通过。其实,我觉得也没道理通过,因为weblogic自带的jdk里面同样没有j2ee的类啊。
而我安装j2ee   sdk然后设好环境变量,再到dos下用命令却可以通过编译。所以我想问一下Jbuilder如果要用来编serverlet的东西的话,究竟该怎么配置?


2.其次是weblogic上发布web应用程序,发布成功,用浏览器访问,却报错的问题:
我把ServletDemo打包为:ServletDemo.war,其中包括:
WEB-INF(文件夹)-web.xml,weblogic.xml,classes(文件夹)-ServletDemo.class
web.xml的内容为:
<?xml   version= "1.0 "   encoding= "ISO-8859-1 "?> <!DOCTYPE   web-app   PUBLIC   "-//Sun   Microsystems,   Inc.//DTD   Web   Application   2.3//EN "   "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd ">
<web-app>
<servlet>
        <servlet-name> ServletDemo </servlet-name>
        <servlet-class> ServletDemo </servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name> ServletDemo </servlet-name>
        <url-pattern> /ServletDemo/* </url-pattern>
    </servlet-mapping>

</web-app>

weblogic.xml的内容为:
<!DOCTYPE   weblogic-web-app   PUBLIC   "-//BEA   Systems,   Inc.//DTD   Web   Application   6.0//EN "   "http://www.beasys.com/j2ee/dtds/weblogic-web-jar.dtd ">

<weblogic-web-app>
    <charset-params>
        <input-charset>
            <resource-path> / </resource-path>
            <java-charset-name> ISO-8859-1 </java-charset-name>
        </input-charset>
    </charset-params>

</weblogic-web-app>

console上提示的测试地址为:http://172.25.0.5:7001/ServletDemo/



浏览器报错为:
Error   403--Forbidden  
From   RFC   2068   Hypertext   Transfer   Protocol   --   HTTP/1.1:
10.4.4   403   Forbidden
The   server   understood   the   request,   but   is   refusing   to   fulfill   it.   Authorization   will   not   help   and   the   request   SHOULD   NOT   be   repeated.   If   the   request   method   was   not   HEAD   and   the   server   wishes   to   make   public   why   the   request   has   not   been   fulfilled,   it   SHOULD   describe   the   reason   for   the   refusal   in   the   entity.   This   status   code   is   commonly   used   when   the   server   does   not   wish   to   reveal   exactly   why   the   request   has   been   refused,   or   when   no   other   response   is   applicable.
 
另外我是把war包放在F:\bea\user_projects\domains\testdomain\applications的

查了下网上weblogic的那个布属问题似乎很普遍,我觉得应该是war包的结构或者两个xml文件写得有问题。小弟最后20分全部献上了,非常感谢!!!

[解决办法]
帮顶!

热点排行