小编Siv*_*y G的帖子

如何在Eclipse中以程序方式启用Java关键字断言?

如何assert在Eclipse中启用关键字?

public class A
{
    public static void main(String ... args)
    {
        System.out.println(1);
        assert false;
        System.out.println(2);
    }
}
Run Code Online (Sandbox Code Playgroud)

java eclipse assert assertions

60
推荐指数
3
解决办法
5万
查看次数

Tomcat服务器未作为服务启动:%1不是有效的Win32应用程序

我的tomcat服务器在Eclipse中工作正常,但是当我尝试启动服务器时它没有启动.

以下是错误:

[2012-08-15 09:26:09] [info] Procrun (2.0.5.0) started
[2012-08-15 09:26:09] [info] Running Service...
[2012-08-15 09:26:09] [info] Starting service...
[2012-08-15 09:26:09] [197  javajni.c] [error] %1 is not a valid Win32 application.
[2012-08-15 09:26:09] [994  prunsrv.c] [error] Failed creating java C:\java\java\jre\bin\server\jvm.dll
[2012-08-15 09:26:09] [1269 prunsrv.c] [error] ServiceStart returned 1
[2012-08-15 09:26:09] [info] Run service finished.
[2012-08-15 09:26:09] [info] Procrun finished.
[2012-08-15 09:29:06] [info] Procrun (2.0.5.0) started
[2012-08-15 09:29:06] [info] Running Service...
[2012-08-15 09:29:06] [info] Starting service...
[2012-08-15 09:29:06] [197  javajni.c] [error] %1 …
Run Code Online (Sandbox Code Playgroud)

java eclipse tomcat

15
推荐指数
3
解决办法
4万
查看次数

尝试在jsp中显示图像(blob对象)时出错(使用Oracle数据库的Spring和Hibernate)

这个问题与oracle 10g数据库有关.相同的代码与MySQL数据库一起工作正常.

我的模型类

package com.killerlinks.model;

    import java.io.Serializable;
    import java.sql.Blob;

    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    import javax.persistence.Id;
    import javax.persistence.Lob;
    import javax.persistence.Table;

    @Entity
    @Table(name="links")
    public class Linkform implements Serializable
    {
        /**
         * 
         */
        private static final long serialVersionUID = 1L;
        @Id
        @GeneratedValue(strategy=GenerationType.AUTO)
        @Column(name="id")
        private Long id;
        @Column(name="tittle")
        private String tittle;
        @Column(name="xdesc")
        private String desc;
        @Column(name="url")
        private String url;
        @Column(name="category")
        private String category;
        @Column(name="xdate")
        private String date;
        @Column(name="xtime")
        private String time;
        @Column(name="tags")
        private String tags;

        @Column(name="image")
        @Lob
        private Blob fileData; …
Run Code Online (Sandbox Code Playgroud)

spring hibernate blob

5
推荐指数
1
解决办法
2155
查看次数

在java中通过ftp上传文件时收到错误

这是我用来通过FTP使用Jakarta Commons Net将文件上传到远程位置的代码

public boolean ftpTransfer(String localfile, String destinationfile)
        {
            String server = "xxxx";
            String username = "xxxxxx";
            String password = "xxxxxxx";
            try
            {
                FTPClient ftp = new FTPClient();
                ftp.connect(server);
                if(!ftp.login(username, password))
                {
                    System.out.println("login");
                    ftp.logout();
                    return false;
                }
                int reply = ftp.getReplyCode();
                if (!FTPReply.isPositiveCompletion(reply))
                {
                    System.out.println("disconnect");
                    ftp.disconnect();
                    return false;
                }
                InputStream in = new FileInputStream(localfile);
                ftp.storeFile(destinationfile, in);
                in.close();
                ftp.logout();
                ftp.disconnect();
            }
            catch (Exception ex)
            {
                ex.printStackTrace();
                return false;
            }
            return true;
        }
Run Code Online (Sandbox Code Playgroud)

控制台中的错误是

java.net.SocketTimeoutException: Read timed out
    at java.net.SocketInputStream.socketRead0(Native Method) …
Run Code Online (Sandbox Code Playgroud)

java ftp

0
推荐指数
1
解决办法
3356
查看次数

标签 统计

java ×3

eclipse ×2

assert ×1

assertions ×1

blob ×1

ftp ×1

hibernate ×1

spring ×1

tomcat ×1