小编Yur*_*uri的帖子

用JAVA_OPTS env变量运行java

在shell脚本中,我设置了JAVA_OPTS环境变量(以启用远程调试并增加内存),然后执行jar文件,如下所示:

export JAVA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=8001,server=y,suspend=n -Xms512m -Xmx512m"
java -jar analyse.jar $*
Run Code Online (Sandbox Code Playgroud)

但似乎没有JAVA_OPTS env变量的影响,因为我无法连接到远程调试,我看到JVM的内存没有变化.

可能是什么问题呢?

PS:我无法在java -jar analyse.jar $*命令中使用这些设置,因为我在应用程序中处理命令行参数.

java shell remote-debugging jvm-arguments

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

的java.net.UnknownHostException

我正在使用jdk1.6.0_23安装CSVN,我收到以下Java错误:

2011-02-10 16:25:50,951 [WrapperJarAppMain] WARN util.GrailsUtil - [WARNING] Property [ldapServerPort] of domain class com.collabnet.svnedge.console.Server has type [int] and doesn't support constraint [nullable]. This constraint will not be checked during validation.
2011-02-10 16:25:51,117 [WrapperJarAppMain] ERROR ehcache.Cache - Unable to set localhost. This prevents creation of a GUID. Cause was: vkqgae01: vkqgae01
java.net.UnknownHostException: vkqgae01: vkqgae01
at java.net.InetAddress.getLocalHost(InetAddress.java:1354)
at net.sf.ehcache.Cache.<clinit>(Cache.java:143)
Run Code Online (Sandbox Code Playgroud)

我的服务器有3个NIC(eth0,eth1和eth2).我在以下主机文件中添加了一个条目,包含以下内容:127.0.0.1 vkqgae01

我可以成功ping vkqgae01,但nslookup无法解决它.

有任何想法吗?

java network-programming

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

“事件”类型的参数不可分配给“字符串”类型的参数

在下面的代码中,我想使用 来EventEmitter调用该方法onlyNewAddedItems

我定义了EventEmitter实例和发出事件的方法,如下所示:

@Output() newItemValue = new EventEmitter<string>();

  addNewItem(val : string) {
    this.newItemValue.emit(val);
    console.log("add new item:" + val);
    this.items.push(val);
  }
Run Code Online (Sandbox Code Playgroud)

为了绑定到第三个事件,我执行了以下操作:

<h1 (newItemValue) = onlyNewlyAddedItems($event)></h1>
Run Code Online (Sandbox Code Playgroud)

但是当我编译代码时,我收到以下错误

Error: src/app/app.component.html:4:42 - error TS2345: Argument of type 'Event' is not assignable to parameter of type 'string'.

4 <h1 (newItemValue) = onlyNewlyAddedItems($event)></h1>                                        
  src/app/app.component.ts:5:16
    5   templateUrl: './app.component.html',
                     ~~~~~~~~~~~~~~~~~~~~~~
    Error occurs in the template of component AppComponent.
    
Run Code Online (Sandbox Code Playgroud)

请让我知道如何onlyNewlyAddedItems通过执行该方法EventEmitter

AppComponent.component.ts

import { Component, Input, Output, EventEmitter …
Run Code Online (Sandbox Code Playgroud)

typescript angular angular-event-emitter

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

Sinch api在一个有角度的2项目中超过onCallProgressing

我们在一个有角度的2 Web应用程序中实现了Sinch.

一切正常,除非我尝试使用sinch手机演示呼叫用户.

当应用程序在前台运行时,它将响铃并建立连接.

当应用程序在后台运行时,没有任何反应.

在角度应用程序中,onCallProgressing事件监视器未被触发,页面只是等待直到它吐出此错误消息:

在此输入图像描述

似乎问题在于缺少jquery函数,因为我将项目重写为angular.

我想知道我可以用sinch API解决这个问题.

错误的完整堆栈跟踪如下:

Error: Error executing listener: onCallEnded
at SinchError (http://cdn.sinch.com/latest/sinch.min.js:4:4093) [<root>]
at g.<anonymous> (http://cdn.sinch.com/latest/sinch.min.js:4:18715) [<root>]
at Array.forEach (native) [<root>]
at g.execListener (http://cdn.sinch.com/latest/sinch.min.js:4:18650) [<root>]
at g.mxpHangup (http://cdn.sinch.com/latest/sinch.min.js:4:30318) [<root>]
at g.hangup (http://cdn.sinch.com/latest/sinch.min.js:5:12013) [<root>]
at g.<anonymous> (http://cdn.sinch.com/latest/sinch.min.js:5:4195) [<root>]
at Zone.runTask (http://localhost:4200/polyfills.bundle.js:6135:47) [<root> => <root>]
at ZoneTask.invoke (http://localhost:4200/polyfills.bundle.js:6329:33) [<root>]
at data.args.(anonymous function) (http://localhost:4200/polyfills.bundle.js:7360:25) [<root>]
Run Code Online (Sandbox Code Playgroud)

这是使用sinch管理调用的角度组件:

import {Component, AfterViewInit, ViewChild, OnInit, OnDestroy} from '@angular/core';
import {Router, …
Run Code Online (Sandbox Code Playgroud)

jquery voip json sinch angular

22
推荐指数
1
解决办法
985
查看次数

urllib2和httplib线程安全吗?

我正在寻找有关urllib2和httplib的线程安全性的信息.官方文档(http://docs.python.org/library/urllib2.htmlhttp://docs.python.org/library/httplib.html)缺少有关此主题的任何信息; 那里没有提到线程这个词......

UPDATE

好吧,它们不是开箱即用的线程安全.是什么使它们成为线程安全的,或者是否存在可以线程安全的场景?我问,因为它似乎是

  • urllib2在每个线程中使用单独的
  • 不共享线程之间的HTTP连接

足以在线程中安全地使用这些库.类似的使用场景提出了问题urllib2和cookielib线程安全性

python urllib2 thread-safety httplib

20
推荐指数
1
解决办法
9353
查看次数

jvisualvm 找不到 Java 安装

我在运行 jvisualvm 时遇到以下问题 -

机器上设置的Java相关环境变量

java相关环境变量

以下是PATH变量详细信息,没有提及路径C:\apps\Java8

Path=C:\ProgramData\Oracle\Java\javapath;
C:\windows\system32;
C:\windows;
C:\windows\System32\Wbem;
C:\windows\System32\WindowsPowerShell\v1.0\;
C:\windows\System32\OpenSSH\;
C:\Program Files\Microsoft\Web Platform Installer\;
C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;
C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;
C:\Program Files\Microsoft DNX\Dnvm\;
C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;
D:\apps\gradle-5.5.1-bin\bin;
D:\apps\apache-ant-1.10.5\bin;
C:\apps\Java\Java8\bin;
C:\Program Files\nodejs\;
Run Code Online (Sandbox Code Playgroud)

当我运行 jvisualvm.exe 时,出现以下错误,从该错误看来 jvisualvm 正在查找某些配置文件来定位 JDK 主路径:

在此输入图像描述

在此消息中,我单击“是”按钮,然后收到以下错误,提示您正在运行 VisualVM 正在从 JRE 运行 -

在此输入图像描述

java visualvm jvisualvm

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

Angular 8 显示没有错误的空白页

我正在开发一个 Angular 8 应用程序,它将使用 JWT 令牌身份验证登录到 .Net Core Rest API。

当我启动应用程序时,应用程序编译成功,没有错误。但是,当我打开http://localhost:4200 时,会出现一个空白页面。

这是app-routing.module.ts文件:

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { LoginComponent } from './login';
import { HomeComponent } from './home';
import { AppComponent } from './app.component';
import { AuthGuard } from './_helpers';

const routes: Routes = [
  {path: '',component:AppComponent,canActivate: [AuthGuard]},
  {path:'login',component:LoginComponent},
  {path: '**',redirectTo:''}
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }
Run Code Online (Sandbox Code Playgroud)

这是app.component.ts文件: …

angular angular8

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

如何在angular2中使用ngSwitch

从最近两天开始,我试图让ngSwitch在角度2.1.0中工作.但似乎不可能让它发挥作用.

我总是得不到NgSwitch的提供者.以下是我的代码 -

模板 -

<template [ngSwitch]="buttonSelector">
  <a class="btn" [ngClass]="buttonSizeClass" *ngSwitchCase="'link'" href="#">
    <span class="btn__text">
      <ng-content></ng-content>
    </span>
  </a>
</template>
Run Code Online (Sandbox Code Playgroud)

零件 -

import { Component, OnInit, Input } from '@angular/core';


@Component({
  selector: 'app-inked-btn',
  templateUrl: './inked-btn.component.html',
  styleUrls: ['./inked-btn.component.css'],
  inputs: ['buttonSize', 'buttonType', "buttonSelector"]
})
export class InkedBtnComponent implements OnInit {
  public buttonSize: string;
  public buttonType: string;
  public buttonSelector: string;
  public buttonSizeClass: any;

  constructor() { }

  ngOnInit() {
    this.buttonSizeClass = {
      'btn--lg': this.buttonSize === 'large',
      'btn--sm': this.buttonSize === 'small',
      'btn--primary': this.buttonType === 'primary'
    }
  } …
Run Code Online (Sandbox Code Playgroud)

angular

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

将非单例服务注入 Angular 中的非单例服务

如果我想将非单例服务注入 Angular 中的另一个非单例服务,该怎么办?

假设我有一个ComponentA使用ServiceA这样的

@component({
  selector: "componentA",
  providers: [ServiceA]
})
export class ComponentA {
  constructor(private serviceA: ServiceA) {}
}
Run Code Online (Sandbox Code Playgroud)

现在,ServiceA也取决于ServiceB,所以我需要注入它

@Injectable()
export class ServiceA {
   constructor(private serviceB: ServiceB) {}
}
Run Code Online (Sandbox Code Playgroud)

我将如何/在哪里声明我的ServiceB? 在模块中?在那种情况下,那会是一个单身人士吗?

如果我将它添加到提供程序中,ComponentA它可以正常工作,但是我需要知道ComponentAServiceA取决于ServiceB,这对我来说似乎不太好。

谢谢!

dependency-injection angular

13
推荐指数
1
解决办法
1403
查看次数

如何在使用 swagger-ui-express 和 swagger-jsdoc 时正确使用 swagger 文件中的 $ref

我开始使用 swagger 和swagger-ui-expressswagger-jsdoc来自动记录我现有的 API,它是用nodejs和 express编写的(就像这里描述的一样 -示例)。

当我尝试在我的注释上添加一个$ref现有的JSON 模式文件(它与我的所有 js 文件位于我的项目中的同一目录中)时遇到了一个问题。

我的目录看起来像这样

我尝试编写本地路径 ( ./schema.json) 和绝对路径,尝试使用#,使用了许多语法,但没有任何效果。

我的注释是这样的:

/**
 * @swagger
 * /testing:
 *    get:
 *      description: This should show the json schema
 *      responses:
 *          200:
 *              description: "successful operation"
 *              schema:
 *                 $ref: "./schema.json"
 */
Run Code Online (Sandbox Code Playgroud)

我希望 swagger ui 在我的请求部分向我显示 JSON 模式。我收到以下错误 -

Resolver error at paths./testing.get.responses.200.schema.$ref
Could not resolve reference: Tried to resolve a relative …
Run Code Online (Sandbox Code Playgroud)

json ref node.js express swagger

11
推荐指数
1
解决办法
7659
查看次数