小编Ton*_*kuk的帖子

如何允许在localhost之外访问

如何允许在Angular2的localhost外访问?我可以localhost:3030/panel轻松导航,但是当我编写IP时,我无法导航10.123.14.12:3030/panel/.

你能告诉我如何解决它吗?我没有使用npm(节点项目管理 - 节点安装/节点启动)来安装和运行项目.

如果你愿意,我可以提供我的package.jsonindex.html.

typescript angular ng-build

121
推荐指数
13
解决办法
11万
查看次数

无法将Lombok与Java 11一起使用

我们将Java版本从8升级到11但是我得到了getter/setter方法的编译错误,其中我使用Lombok的Getter和Setter Annotations实现了POJO类.

有没有办法使用Lombok的@Data注释,它提供getter和setter而不在Java 11中实现它们?

目前,我面临的错误是:

找不到getStoreName()

where storeName在类上面声明为全局变量,在类上面有@Data Lombok注释.

java lombok intellij-lombok-plugin java-11

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

在等待与WritableServerSelector匹配的服务器时,在30000毫秒后超时

我在许多论坛上都看到过这个问题,但没有一个能解决我的问题.我正在尝试将示例文档插入MongoDB DB.不幸的是,在插入过程中colReceived.insert(doc)我遇到以下错误:

严重:servlet spring的Servlet.service()引发异常com.mongodb.MongoTimeoutException:在等待与WritableServerSelector匹配的服务器时30000 ms后超时.集群状态的客户端视图是{type = UNKNOWN,servers = [{address = localhost:27017,type = UNKNOWN,state = CONNECTING,exception = {com.mongodb.MongoSocketOpenException:Exception opening socket},由{java.net引起. ConnectException:Connection refused:connect}}] at com.mongodb.connection.BaseCluster.createTimeoutException(BaseCluster.java:369)

这是我的connectToDb方法

   MongoClient mongoClient = new MongoClient();

    // Now connect to your database
    DB db = mongoClient.getDB("test");
    System.out.println("connect to database successfully");

    DBCollection coll = db.createCollection("mycol", null);
    System.out.println("Collection created successfully");

    DBCollection colReceived = db.getCollection("mycol");
    System.out.println("Collection mycol selected successfully");

    BasicDBObject doc = new BasicDBObject("title", "MongoDB").append("description", "database").append("likes", 100)
            .append("url", "http://www.tutorialspoint.com/mongodb/").append("by", "tutorials point");

    colReceived.insert(doc);
    System.out.println("Document inserted successfully");
Run Code Online (Sandbox Code Playgroud)

我的pom.xml:

  <project xmlns="http://maven.apache.org/POM/4.0.0" …
Run Code Online (Sandbox Code Playgroud)

java database java-ee mongodb nosql

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

com.mongodb.MongoTimeoutException:在等待连接的10000毫秒后超时

我曾经多次问过这个问题,但我不得不重新考虑一下.因为为这个问题提供的解决方案并没有给我一个确切的答案来摆脱这个血腥的错误.

我使用mongo-java-driver-2.12.4,mongo.jar当我尝试将文档插入db时,我得到以下错误.任何帮助表示赞赏.

错误:

Exception in thread "main" com.mongodb.MongoTimeoutException: Timed out after 10000 ms while waiting to connect. Client view of cluster state is {type=Unknown, servers=[{address=127.0.0.1:27000, type=Unknown, state=Connecting, exception={com.mongodb.MongoException$Network: Exception opening the socket}, caused by {java.net.ConnectException: Connection refused: connect}}, {address=127.0.0.1:27001, type=Unknown, state=Connecting, exception={com.mongodb.MongoException$Network: Exception opening the socket}, caused by {java.net.ConnectException: Connection refused: connect}}, {address=127.0.0.1:27002, type=Unknown, state=Connecting, exception={com.mongodb.MongoException$Network: Exception opening the socket}, caused by {java.net.ConnectException: Connection refused: connect}}]
    at com.mongodb.BaseCluster.getDescription(BaseCluster.java:128)
Run Code Online (Sandbox Code Playgroud)

代码:

    public class MongoDbConnectDatabase {

    public static void …
Run Code Online (Sandbox Code Playgroud)

java database java-ee mongodb nosql

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

org.simpleframework.xml.core.PersistenceException:与A类不匹配的构造函数

我使用SimpleXML序列化(写入XML)没有任何问题.但是,当我尝试读取和反序列化为XML时,我得到以下异常.我正在使用lombok插件来提供诸如"@RequiredArgsConstructor"之类的构造函数.

错误消息是:"org.simpleframework.xml.core.PersistenceException:与A类不匹配的构造函数".

如果您愿意,我可以提供代码以获取更多详细信息

java xml xml-parsing simple-framework

7
推荐指数
1
解决办法
2333
查看次数

将 Java 升级到 11 后,我收到 ExceptionInInitializerError

我将我的项目从 Java 8 升级到 Java 11 并收到了

Error: java: java.lang.ExceptionInInitializerError

在构建项目时。一切似乎都正常,但我不知道我是如何得到这种错误的。你有什么想法吗?

为了运行我使用的项目Run/Debug Configurations-> Spring Boot-> Application->Run

这是错误消息:

在此处输入图片说明

java intellij-idea java-11

6
推荐指数
0
解决办法
1729
查看次数

如何将 Flux&lt;Object&gt; 列表转换为 List&lt;Object&gt;

我有一个 Flux,我想将其转换为 List。我怎样才能做到这一点?

Flux<Object> getInstances(String serviceId); // Current one 
List<Object> getInstances(String serviceId); // Demanded one
Run Code Online (Sandbox Code Playgroud)

Java 8 或反应式组件有一个准备好的方法将其映射或转换为 List ??

我应该使用.map()

final List<ServiceInstance> sis = convertedStringList.parallelStream()
            .map( this.reactiveDiscoveryClient::getInstances )
            // It should be converted to List<Object>
Run Code Online (Sandbox Code Playgroud)

reactive-programming java-8 java-stream project-reactor reactive

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

如何在maven中使用tomcat插件部署多个wars

从我关注的论坛中,我尝试了一些方法来找到在 Maven 中使用 tomcat 插件部署多重战争的方法,但我无法成功。

我创建了第三个项目并使用了三个项目来部署它们,但我还没有这样做。你能告诉我怎么做吗?

最好的问候阿尔珀·科普兹

这是我使用的 pom.xml :

<project xmlns="http://maven.apache.org/POM/4.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>
tr.com.provus.pays
</groupId>
<artifactId>PAYSGroupProject</artifactId>
  <version>1.0</version>
  <packaging>pom</packaging>

  <modules>
    <module>../PAYSWeb</module>
    <module>../PAYSDashboard</module>
    <module>../PAYSStaticWeb</module>
  </modules>

  <name>PAYSGroupProject</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <build>
  <plugins>
    <plugin>
<groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
     <executions>
          <execution>
            <id>deploy</id>
            <phase>pre-integration-test</phase>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>

         <configuration>
       <warSourceDirectory>WebContent</warSourceDirectory>
        </configuration>
  </plugin>
  </plugins>
  </build>

</project>
Run Code Online (Sandbox Code Playgroud)

java deployment tomcat maven

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

升级到 Spring Boot 版本 2 后 Prometheus 无法工作

我之前可以在 Spring Boot Version 2 中使用 Prometheus,没有任何问题。将 Spring Boot 版本更新到 2.1.1 后。发布我遇到以下错误。

我将 Prometheus 版本从 0.2.0 升级到 0.6.0 但仍然遇到相同的错误。

您认为 prometheus 与 Spring Boot Version 2 不兼容吗?

问候

   Error :
   java.lang.IllegalStateException: Error processing condition on org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration.propertySourcesPlaceholderConfigurer
at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:64)
at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:108)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:181)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:141)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:117)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:327)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:232)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:691)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:528)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
at com.project.projectmine.Application.main(Application.java:26)
 Caused by: java.lang.IllegalStateException: Failed to introspect Class [io.prometheus.client.spring.boot.PrometheusEndpointConfiguration] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader@77556fd]
at …
Run Code Online (Sandbox Code Playgroud)

spring-boot prometheus spring-boot-maven-plugin prometheus-java

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

如何在休息webservice响应来之后渲染angular2 html页面

我可以得到休息webservice响应并在屏幕上控制它没有任何问题.但不幸的是,在页面中我可以看到werbservice调用结果的初始值.在我收到wbservice的回复后,我需要做什么才能呈现页面?我的意思是我可以看到userInfo和userName的初始值.您可以在下方看到该代码段.

关心Alper

  export class NavigationComponent implements OnInit {
response:any;
errorMessage:any;
form:FormGroup;
obj = {"one": "", "two": "", "three": "", "four": ""};
webserviceUrl = "https://httpbin.org/post";
webServiceUrlGet = "https://jsonplaceholder.typicode.com/posts/1";
username = "alper"
userInfo = "alper Info";
componentName =  'AppComponent';

ngOnInit():void {
  this.getUserName();
}

 getUserName() {

this.http.get(this.webServiceUrlGet)
  .subscribe(
    function (data) {
      this.userInfo = data.json();
      this.username = this.userInfo.userId;


    },
    error => this.errorMessage = <any>error);
return this.username;
}
Run Code Online (Sandbox Code Playgroud)

rest typescript angular

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