setViewType(ViewType.jsp)之后报错 渲染jsp有问题?

环境如下:

java version "9.0.1"

c3p0-0.9.5.1.jar

jackson-core-2.5.3.jar

jetty-server-8.1.8.jar

jfinal-3.2-bin-with-src.jar

json-simple-1.1.jar

mchange-commons-java-0.2.10.jar

mysql-connector-java-5.1.20-bin.jar


刚开始学这个, 在config里设置setViewType(ViewType.jsp)之后,

渲染jsp有问题? 运行报错:

注释掉这句就正常了. 求赐教哇

JFinal action report -------- 2017-11-16 16:10:12 ------------------------------

Url         : GET /

Controller  : com.learn.controller.IndexController.(IndexController.java:1)

Method      : index

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

Nov 16, 2017 4:10:12 PM org.apache.jasper.compiler.Compiler generateClass

SEVERE: Error compiling file: /tmp/jetty-0.0.0.0-8080-WebContent-_-any-/jsp/org/apache/jsp/index_jsp.java

Nov 16, 2017 4:10:12 PM com.jfinal.core.ActionHandler error

SEVERE: /

com.jfinal.render.RenderException: org.apache.jasper.JasperException: PWC6033: Error in Javac compilation for JSP


PWC6199: Generated servlet error:

Source option 1.5 is no longer supported. Use 1.6 or later.


PWC6199: Generated servlet error:

Target option 1.5 is no longer supported. Use 1.6 or later.


at com.jfinal.render.JspRender.render(JspRender.java:69)

at com.jfinal.core.ActionHandler.handle(ActionHandler.java:99)

at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:73)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1307)

at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:453)

at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)

at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:560)

at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)

at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072)

at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382)

at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)

at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006)

at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)

at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)

at org.eclipse.jetty.server.Server.handle(Server.java:365)

at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485)

at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:926)

at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:988)

at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:635)

at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)

at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)

at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)

at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)

at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)

at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)

at java.base/java.lang.Thread.run(Thread.java:844)

Caused by: org.apache.jasper.JasperException: PWC6033: Error in Javac compilation for JSP


PWC6199: Generated servlet error:

Source option 1.5 is no longer supported. Use 1.6 or later.


PWC6199: Generated servlet error:

Target option 1.5 is no longer supported. Use 1.6 or later.


at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:129)

at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:299)

at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:392)

at org.apache.jasper.compiler.Compiler.compile(Compiler.java:453)

at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:625)

at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)

at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:492)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:378)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)

at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:669)

at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455)

at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)

at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:578)

at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)

at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072)

at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382)

at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)

at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006)

at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)

at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:276)

at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:103)

at com.jfinal.render.JspRender.render(JspRender.java:67)

... 25 more





评论区

JFinal

2017-11-16 16:38

javac 无法编译你的 jsp 文件,试一下从官网首页下载 jfinal 3.2 all 这个 zip 文件,将里头的 jsp jstl 的 jar 包放到项目中去

tryAtry

2017-11-17 10:35

多谢指导!! 太给力了!!

tryAtry

2017-11-17 10:38

@JFinal 加入c3p0后c3p0的包都加进去了 又出现了下面的问题, 上网搜说是idea里的..可我是eclipse啊 求指点

Starting JFinal 3.2
Starting scanner at interval of 5 seconds.
Starting web server on port: 8080
Nov 17, 2017 10:36:32 AM com.mchange.v2.log.MLog
INFO: MLog clients using java 1.4+ standard logging.
Nov 17, 2017 10:36:32 AM com.mchange.v2.c3p0.C3P0Registry
INFO: Initializing c3p0-0.9.5.1 [built 16-June-2015 00:06:36 -0700; debug? true; trace: 10]
Nov 17, 2017 10:36:33 AM com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource
INFO: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 2, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, contextClassLoaderSource -> caller, dataSourceName -> z8kfsx9r1jg3e6i5cpiin|43814d18, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, extensions -> {}, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceSynchronousCheckins -> false, forceUseNamedDriverClass -> false, identityToken -> z8kfsx9r1jg3e6i5cpiin|43814d18, idleConnectionTestPeriod -> 0, initialPoolSize -> 10, jdbcUrl -> jdbc:mysql://127.0.0.1:3306/JFinal, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 20, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 100, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 10, numHelperThreads -> 3, preferredTestQuery -> null, privilegeSpawnedThreads -> false, properties -> {user=******, password=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ]
Nov 17, 2017 10:36:33 AM com.mchange.v2.async.ThreadPoolAsynchronousRunner
WARNING: An Error forced the closing of Thread[C3P0PooledConnectionPoolManager[identityToken->z8kfsx9r1jg3e6i5cpiin|43814d18]-HelperThread-#2,5,main]. Will attempt to reconstruct, but this might mean that something bad is happening.
java.lang.IllegalAccessError: class sun.reflect.GeneratedConstructorAccessor3 cannot access its superclass sun.reflect.ConstructorAccessorImpl
at sun.misc.Unsafe.defineClass(Native Method)
at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:63)
at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:399)
at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:394)
at java.security.AccessController.doPrivileged(Native Method)
at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:393)
at sun.reflect.MethodAccessorGenerator.generateConstructor(MethodAccessorGenerator.java:92)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:55)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.ResultSetImpl.getInstance(ResultSetImpl.java:383)
at com.mysql.jdbc.MysqlIO.buildResultSetWithRows(MysqlIO.java:3140)
at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:491)
at com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate(MysqlIO.java:3118)
at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:2288)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2709)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2677)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2627)
at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1556)
at com.mysql.jdbc.ConnectionImpl.getTransactionIsolation(ConnectionImpl.java:3213)
at com.mchange.v2.c3p0.impl.NewPooledConnection.(NewPooledConnection.java:120)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:240)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1138)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1125)
at com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:44)
at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1870)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)

Exception in thread "C3P0PooledConnectionPoolManager[identityToken->z8kfsx9r1jg3e6i5cpiin|43814d18]-HelperThread-#2" java.lang.IllegalAccessError: class sun.reflect.GeneratedConstructorAccessor3 cannot access its superclass sun.reflect.ConstructorAccessorImpl
at sun.misc.Unsafe.defineClass(Native Method)
at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:63)
at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:399)
at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:394)
at java.security.AccessController.doPrivileged(Native Method)
at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:393)
at sun.reflect.MethodAccessorGenerator.generateConstructor(MethodAccessorGenerator.java:92)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:55)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.ResultSetImpl.getInstance(ResultSetImpl.java:383)
at com.mysql.jdbc.MysqlIO.buildResultSetWithRows(MysqlIO.java:3140)
at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:491)
at com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate(MysqlIO.java:3118)
at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:2288)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2709)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2677)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2627)
at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1556)
at com.mysql.jdbc.ConnectionImpl.getTransactionIsolation(ConnectionImpl.java:3213)
at com.mchange.v2.c3p0.impl.NewPooledConnection.(NewPooledConnection.java:120)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:240)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1138)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1125)
at com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:44)
at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1870)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)
2017-11-17 10:36:33.708:WARN:oejuc.AbstractLifeCycle:FAILED jfinal: java.lang.IllegalAccessError: class sun.reflect.GeneratedConstructorAccessor8 cannot access its superclass sun.reflect.ConstructorAccessorImpl
java.lang.IllegalAccessError: class sun.reflect.GeneratedConstructorAccessor8 cannot access its superclass sun.reflect.ConstructorAccessorImpl
at sun.misc.Unsafe.defineClass(Native Method)
at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:63)
at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:399)
at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:394)
at java.security.AccessController.doPrivileged(Native Method)
at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:393)
at sun.reflect.MethodAccessorGenerator.generateConstructor(MethodAccessorGenerator.java:92)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:55)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.ResultSetImpl.getInstance(ResultSetImpl.java:383)
at com.mysql.jdbc.MysqlIO.buildResultSetWithRows(MysqlIO.java:3140)
at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:491)
at com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate(MysqlIO.java:3118)
at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:2288)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2709)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2677)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2627)
at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1556)
at com.mchange.v2.c3p0.impl.NewProxyStatement.executeQuery(NewProxyStatement.java:327)
at com.jfinal.plugin.activerecord.TableBuilder.doBuild(TableBuilder.java:71)
at com.jfinal.plugin.activerecord.TableBuilder.build(TableBuilder.java:47)
at com.jfinal.plugin.activerecord.ActiveRecordPlugin.start(ActiveRecordPlugin.java:226)
at com.jfinal.core.Config.startPlugins(Config.java:107)
at com.jfinal.core.Config.configJFinal(Config.java:53)
at com.jfinal.core.JFinal.init(JFinal.java:63)
at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:49)
at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:119)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:724)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
at org.eclipse.jetty.server.Server.doStart(Server.java:277)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at com.jfinal.server.JettyServer.doStart(JettyServer.java:131)
at com.jfinal.server.JettyServer.start(JettyServer.java:70)
at com.jfinal.core.JFinal.start(JFinal.java:157)
at com.learn.Louncher.main(Louncher.java:9)

tryAtry

2017-11-17 10:44

代码里没啥不一样啊
@Override
public void configPlugin(Plugins me) {
C3p0Plugin cPlugin = new C3p0Plugin("jdbc:mysql://127.0.0.1:3306/JFinal", "root", "root");
me.add(cPlugin);
ActiveRecordPlugin activeRecordPlugin = new ActiveRecordPlugin(cPlugin);
me.add(activeRecordPlugin);
activeRecordPlugin.addMapping("account", Account.class);
}

tryAtry

2017-11-17 10:49

搜到一个 https://yq.aliyun.com/wenzhang/show_53976

说是 jetty-server的版本与jetty-webapp的版本不一致,将jetty-webapp,jetty-jsp,jetty-server等修改一致后即可正常启动

可问题是 我该怎么改这些版本?

tryAtry

2017-11-17 10:59

把 ActiveRecordPlugin 注释掉 就没报错了,,,
可是...那怎么映射 account 表呢.

tryAtry

2017-11-17 11:57

算了 放弃jetty 用了 tomcat 正常了...

JFinal

2017-11-17 12:03

@tryAtry 改用 tomcat 正常,证明还是 jar 包版本不对,使用 jfinal 官网首页的 jfinal-3.2-all.zip 中的有关 jsp/jstl 以及 jetty-server 的 jar 包,用了六年了,一点事没有

tryAtry

2017-11-17 19:27

@JFinal 我正是用的咱们官网的那个啊,,不知道是不是环境 不对
jdk-9.0.1
eclipse Version: Oxygen.1a Release (4.7.1a) Build id: 20171005-1200
jar包全是官网上的zip解压出来的

tomcat正常了就在tomcat下学jFinal吧 哈哈

热门反馈

扫码入社