Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quickstart报错 #37

Open
zidafone opened this issue Nov 7, 2013 · 5 comments
Open

quickstart报错 #37

zidafone opened this issue Nov 7, 2013 · 5 comments

Comments

@zidafone
Copy link

zidafone commented Nov 7, 2013

按照readme的quickstart一步步进行,报错,我试了好几遍,应该不是操作失误

[2013-11-07 13:08:59,484][ERROR][modules.http ] System processing error
net.csdn.common.exception.RecordNotFoundException: 你请求的URL地址[/hello]不存在
at net.csdn.modules.http.RestController.dispatchRequest(RestController.java:89)
at net.csdn.modules.http.HttpServer$DefaultHandler$1DefaultResponse.internalDispatchRequest(HttpServer.java:295)
at net.csdn.modules.http.HttpServer$DefaultHandler.handle(HttpServer.java:308)
at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:47)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:114)
at org.eclipse.jetty.server.Server.handle(Server.java:352)
at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:596)
at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:1051)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:590)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:212)
at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:426)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:508)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.access$000(SelectChannelEndPoint.java:34)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:451)
at java.lang.Thread.run(Thread.java:722)

按readme建的类:
package com.example.controller.http;

import net.csdn.annotation.rest.At;
import net.csdn.modules.http.ApplicationController;
import net.csdn.modules.http.RestRequest;
import net.csdn.modules.http.ViewType;

import com.example.model.Tag;

public class TagController extends ApplicationController
{
@at(path = "/hello", types = RestRequest.Method.GET)
public void hello() {
Tag tag = Tag.create(map("name", "java"));
tag.save();
render(200, map(
"tag", tag
), ViewType.html);
}

}

package com.example.model;

import net.csdn.jpa.model.Model;

public class Tag extends Model
{

}

import net.csdn.ServiceFramwork;
import net.csdn.bootstrap.Application;

public class ExampleApplication {

public static void main(String[] args) {
ServiceFramwork.scanService.setLoader(ExampleApplication.class);
Application.main(args);
}

}

ide是myeclipse,将src,test,config三个文件夹设为了source folder
在根目录下建了template文件夹(与src平级),里面放了tag/hello.vm
在mysql中建了wow库,执行了wow.sql

以上步骤是否有误?请指正!

@allwefantasy
Copy link
Owner

application:
    controller: com.example.controller.http
    model:      com.example.model
    document:   com.example.document
    service:    com.example.service
    util:       com.example.util
    test:       test.com.example
    template:
        engine:
           enable: true
    static:
        enable: true

SF会根据配置文件去扫描各个组件。你可以看看是不是配置文件导致的问题。

@allwefantasy
Copy link
Owner

config 目录下的application.yml 文件

@zidafone
Copy link
Author

zidafone commented Nov 7, 2013

解决了原因是原来的路径有空格
另外,readme里的Tag实体没有字段,页面的$tag.name原样显示了,我手动加上了name字段正常了,数据库里也插进去了

@allwefantasy
Copy link
Owner

应该是不需要进行字段申明的。晚点我查看下。

@liuhuapiaoyuan
Copy link

我也同样出现跟楼主一样的问题,怎么解决啊。。。。

解决了原因是原来的路径有空格
另外,readme里的Tag实体没有字段,页面的$tag.name原样显示了,我手动加上了name字段正常了,数据库里也插进去了

哪有空格 提示的错误一摸一样

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants