小编Cha*_*har的帖子

luis.ai vs api.ai与wit.ai的比较?

有没有人知道这三者之间的具体差异和特征,或者如果有更多功能/更灵活地用作开发人员?

artificial-intelligence wit.ai azure-language-understanding dialogflow-es

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

休眠中级联和反向有什么区别,它们用于什么?

如何在休眠中使用级联和反向?定义它们的过程/标记是什么?它们是否相互关联,它们如何有用?

java hibernate cascade inverse

42
推荐指数
3
解决办法
6万
查看次数

使用java连接到Windows中的共享文件夹

我需要通过java连接到远程Windows机器上的共享文件夹,在那里我将我的域身份验证(用户名和密码)放在代码中,这是我的代码

 File file = new File("\\\\theRemoteIP\\webapps");   
    File[] files = file.listFiles();  
    System.out.println("acssed done");  

    for (int i = 0; i < files.length; i++)  
    {  
        String name = files[i].getName();  
        System.out.println(name);  
    }  
Run Code Online (Sandbox Code Playgroud)

谢谢

java jcifs

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

如果出现以下错误,我如何推送到Git Repo:推送期间发生内部异常:ssh://git@github.com/xxx/xxx.git:会话已关闭

我最近建立了一个github帐户来存储我一直在研究的项目的源代码.

我正在使用egit eclipse插件将更改推送到github.

我成功地推送了初始代码和随后的2个更改.然而,当我试图推动第三次改变时,我无法做到.以下例外情况出现在eclipse错误日志中.

如果有人能告诉我这个错误的原因,或者告诉我如何调试问题,这将是一个很大的帮助.

org.eclipse.jgit.api.errors.JGitInternalException: Exception caught during execution of push command
    at org.eclipse.jgit.api.PushCommand.call(PushCommand.java:156)
    at org.eclipse.egit.core.op.PushOperation.run(PushOperation.java:227)
    at org.eclipse.egit.ui.internal.push.PushOperationUI.execute(PushOperationUI.java:145)
    at org.eclipse.egit.ui.internal.push.PushOperationUI$1.run(PushOperationUI.java:202)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: org.eclipse.jgit.errors.TransportException: ssh://git@github.com/xxx/xxx.git: session is down
    at org.eclipse.jgit.transport.JschSession$JschProcess.<init>(JschSession.java:154)
    at org.eclipse.jgit.transport.JschSession$JschProcess.<init>(JschSession.java:118)
    at org.eclipse.jgit.transport.JschSession.exec(JschSession.java:91)
    at org.eclipse.jgit.transport.TransportGitSsh$SshPushConnection.<init>(TransportGitSsh.java:306)
    at org.eclipse.jgit.transport.TransportGitSsh.openPush(TransportGitSsh.java:152)
    at org.eclipse.jgit.transport.PushProcess.execute(PushProcess.java:130)
    at org.eclipse.jgit.transport.Transport.push(Transport.java:1120)
    at org.eclipse.jgit.api.PushCommand.call(PushCommand.java:152)
    ... 4 more
Caused by: com.jcraft.jsch.JSchException: session is down
    at com.jcraft.jsch.Session.openChannel(Session.java:750)
    at org.eclipse.jgit.transport.JschSession$JschProcess.<init>(JschSession.java:147)
    ... 11 more
Run Code Online (Sandbox Code Playgroud)

eclipse ssh egit

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

在处理请求时使用异步Servlet以及dispatch()和complete()方法的行为

我正在使用异步Servlet来处理请求,

根据Docs :( complete(),dispatch())

????????????????????????????????????????????????????????????????????????????????
? void complete()  ? Completes the asynchronous operation and closes the       ?
?                  ? response associated with this asynchronous context.       ?
?                  ? You call this method after writing to the response object ?
?                  ? inside the asynchronous context.                          ? 
????????????????????????????????????????????????????????????????????????????????
? void dispatch()  ? Dispatches the request and response objects               ?
?                  ? of this AsyncContext to the servlet container.            ?
????????????????????????????????????????????????????????????????????????????????
Run Code Online (Sandbox Code Playgroud)

我无法理解async.dispatch(),async.complete()及其工作原理.
我对此几乎没有疑问:

  1. 究竟有什么区别async.dispatch() …

java concurrency asynchronous servlets guava

10
推荐指数
1
解决办法
7313
查看次数

javax.naming.NameNotFoundException:名称[comp/env]未绑定在此Context中.无法使用java调度程序找到[comp]错误

我想要做的是在一段时间后更新我的数据库.所以我正在使用java调度程序和连接池.我不知道为什么,但我的代码只工作一次.它将打印:

init success
success
javax.naming.NameNotFoundException: Name [comp/env] is not bound in this Context. Unable to find [comp].
    at org.apache.naming.NamingContext.lookup(NamingContext.java:820)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:168)
    at org.apache.naming.SelectorContext.lookup(SelectorContext.java:158)
    at javax.naming.InitialContext.lookup(InitialContext.java:411)
    at test.Pool.main(Pool.java:25)  ---> line 25 is Context envContext = (Context)initialContext.lookup("java:/comp/env");
Run Code Online (Sandbox Code Playgroud)

我不知道为什么它只能运作一次.如果没有java调度程序我没有运行它我已经测试了它并且它工作正常.没有错误,无论如何.如果我使用调度程序运行它,不知道为什么我会收到此错误.

希望可以有人帮帮我.

我的连接池代码:

public class Pool {
public DataSource main() {
    try {
        InitialContext initialContext = new InitialContext();
        Context envContext = (Context)initialContext.lookup("java:/comp/env");
        DataSource datasource = new DataSource();   
        datasource = (DataSource)envContext.lookup("jdbc/test");
        return datasource;
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    return null;
}
Run Code Online (Sandbox Code Playgroud)

}

我的web.xml …

java sql connection-pooling runtime-error scheduled-tasks

9
推荐指数
1
解决办法
6万
查看次数

如何从其他包中的类访问包私有类?

我有以下课程

Hello.java

package speak.hello;

import java.util.Map;

import speak.hi.CustomMap;
import speak.hi.Hi;

public class Hello {

    private Hi hi;

    Hello(Hi hi) {
        this.hi = hi;
    }

    public String sayHello() {
        return "Hello";
    }

    public String sayHi() {
        return hi.sayHi();
    }

    public Map<String, Object> getMap() {
        return hi.getMap();
    }

    public void clearMap() {
        hi.getMap().clear();
    }

    public void discardMap() {
        CustomMap map = (CustomMap) hi.getMap();
        map.discard();
    }

    public static void main(String[] args) {
        Hello hello = new Hello(new Hi());
        System.out.println(hello.sayHello());
        System.out.println(hello.sayHi());
        System.out.println(hello.getMap());
        hello.clearMap();
        System.out.println("--"); …
Run Code Online (Sandbox Code Playgroud)

java access-specifier

8
推荐指数
2
解决办法
3万
查看次数

SOAP UI安装后出现JVM错误

我正在尝试安装SOAPUI工具.安装完成后,执行时,我收到此错误:

无法启动JVM.最大堆大小(-XMx)可能太大,或者防病毒或防火墙工具可能会阻止执行

当安装到不同的机器时,它工作正常.

有什么建议?

java jvm soapui

8
推荐指数
2
解决办法
2万
查看次数

通过Java客户端将文件上载到CKAN/datahub.io中的数据集

我正在测试通过API的Java客户端将文件上传到CKAN/datahub.io上的数据集.

public String uploadFile()
        throws CKANException {

    String returned_json = this._connection.MultiPartPost("", "");

    System.out.println("r: " + returned_json);
    return returned_json;
}
Run Code Online (Sandbox Code Playgroud)

   protected String MultiPartPost(String path, String data)
            throws CKANException {
        URL url = null;

        try {
            url = new URL(this.m_host + ":" + this.m_port + path);
        } catch (MalformedURLException mue) {
            System.err.println(mue);
            return null;
        }

        String body = "";

        HttpClient httpclient = new DefaultHttpClient();
        try {
            String fileName = "D:\\test.jpg";

            FileBody bin = new FileBody(new File(fileName),"image/jpeg");
            StringBody comment = new StringBody("Filename: …
Run Code Online (Sandbox Code Playgroud)

java post apache-commons-httpclient ckan

8
推荐指数
1
解决办法
1778
查看次数

Java EE 7兼容服务器?

我在项目中使用JAVA SE 1.7和JAVA EE 7,
哪些是可用的服务器(商业/免费),它们将支持JAVA EE 7 web profile 2.1?(必需组件).我需要使用Servlet 3.1和CDI 1.1 ..etc.
JavaEE的-spec_WebProfile

我尝试使用JBoss EAP 6.1/Jboss 7,但我开始知道它将支持JAVA EE 6 web配置文件.(web-profile1,web-profile2)

我发现JAVA EE 7兼容服务器是GlassFish Server Open Source Edition 4.0,TMAX JEUS 8.

还有其他服务器?

jboss jboss6.x jboss7.x java-ee-7 java-ee-web-profile

8
推荐指数
2
解决办法
1万
查看次数