[工具] 在NetBeans6.5 RunJSP OK 但是 再 Eclipse Run error

看板java作者 (挺)時間16年前 (2009/11/10 02:17), 編輯推噓3(304)
留言7則, 4人參與, 最新討論串1/1
請問大家為什麼 我在NetBeans6.5寫JSP+GDATA可以RUN成功, 但是把程式碼貼在 Eclipse Java EE IDE for Web Developers.Build id: 20090621-0832 有外掛JAR(GDATA)執行時發生錯誤 錯誤訊息如下, ************************************************************************** HTTP ERROR 500 Problem accessing /WebGoogle/CheckSQL.jsp. Reason: Unable to compile class for JSP Generated servlet error: Only a type can be imported. com.google.gdata.client.calendar.CalendarQuery resolves to a package Generated servlet error: Only a type can be imported. com.google.gdata.client.calendar.CalendarService resolves to a package Generated servlet error: Only a type can be imported. com.google.gdata.util.AuthenticationException resolves to a package An error occurred at line: 24 in the jsp file: /CheckSQL.jsp Generated servlet error: CalendarService cannot be resolved to a type An error occurred at line: 24 in the jsp file: /CheckSQL.jsp Generated servlet error: CalendarService cannot be resolved to a type An error occurred at line: 404 in the jsp file: /CheckSQL.jsp Generated servlet error: AuthenticationException cannot be resolved to a type Caused by: org.apache.jasper.JasperException: Unable to compile class for JSP Generated servlet error: Only a type can be imported. com.google.gdata.client.calendar.CalendarQuery resolves to a package Generated servlet error: Only a type can be imported. com.google.gdata.client.calendar.CalendarService resolves to a package Generated servlet error: Only a type can be imported. com.google.gdata.util.AuthenticationException resolves to a package An error occurred at line: 24 in the jsp file: /CheckSQL.jsp Generated servlet error: CalendarService cannot be resolved to a type An error occurred at line: 24 in the jsp file: /CheckSQL.jsp Generated servlet error: CalendarService cannot be resolved to a type An error occurred at line: 404 in the jsp file: /CheckSQL.jsp Generated servlet error: AuthenticationException cannot be resolved to a type at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84) at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328) at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:414) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:297) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:276) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:264) at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:380) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417) at org.mortbay.jetty.handler.HandlerList.handle(HandlerList.java:49) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:324) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:535) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:865) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:540) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:213) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520) ***************************************************************************** 我也不知如何解決這問題,利用Eclipse打包成war 放在 Sun GlassFish EnterPrise Server v2.1 , Web Applications 也是不能RUN 錯誤訊息 ***************************************************************************** An error has occurred Deploying application in domain failed; JSP Compilation Error: org.apache.jasper.JasperException: PWC6033: Unable to compile class for JSP PWC6199: Generated servlet error: string:///CheckSQL_jsp.java:8: package com.google.gdata.client.calendar does not exist PWC6199: Generated servlet error: string:///CheckSQL_jsp.java:9: package com.google.gdata.client.calendar does not exist PWC6199: Generated servlet error: string:///CheckSQL_jsp.java:11: package com.google.gdata.util does not exist PWC6... *************************************************************************** 也不知道如何解決 不知道為什麼在NetBeans 執行完全沒問題 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 116.59.131.112

11/10 12:19, , 1F
錯誤訊息都很清楚告訴你了阿...
11/10 12:19, 1F

11/10 13:25, , 2F
你要不要確定一下專案移植過去該import都有import啊?
11/10 13:25, 2F

11/10 16:08, , 3F
在eclipse編寫程式(用gdata)沒有錯誤警告
11/10 16:08, 3F

11/10 16:12, , 4F
把GDATA jar 檔 放在java 資源 : src 程式庫內
11/10 16:12, 4F

11/10 16:18, , 5F
應該要把JAR放在WEB-INF\lib 內 ,這樣問題解決了
11/10 16:18, 5F

11/10 16:21, , 6F
NetBeans 和 Eclipse 兩者 IDE JAR當案是放在不同位置
11/10 16:21, 6F

11/10 23:22, , 7F
跟IDE毫無關係吧= =
11/10 23:22, 7F
文章代碼(AID): #1A-5obMz (java)