小编Mar*_*rda的帖子

"无法找到Spring NamespaceHandler"错误

我正在使用Spring创建一个独立的Sava应用程序来处理JDBC访问.该应用程序在每次测试中都能正常工作,我决定需要一个jar来部署我们的客户端.

他们的类路径中可能没有spring,所以我使用maven-assembly-plugin来处理带有依赖项的jar创建.

但是,当我尝试运行该应用程序时:

java -jar target/myproject-0.0.1-SNAPSHOT-jar-with-dependencies.jar
Run Code Online (Sandbox Code Playgroud)

这会引发以下错误:

Exception in thread "main" org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/p]
Offending resource: class path resource [applicationContext.xml]

at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:80)
...and so on to the database access class of this project.
Run Code Online (Sandbox Code Playgroud)

applicationContext.xml文件位于projectbase/src/main/resources中.它放在目标/包名基础上.

applicationContext.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:p="http://www.springframework.org/schema/p"
   xmlns:context="http://www.springframework.org/schema/context"
   xsi:schemaLocation="http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
   http://www.springframework.org/schema/context
   http://www.springframework.org/schema/context/spring-context-3.0.xsd">


    <bean id="dataSourceDesenv" class="org.apache.commons.dbcp.BasicDataSource"... />

    <bean id="simpleJdbcDaoSupport" class="org.springframework.jdbc.core.simple.SimpleJdbcDaoSupport"
      p:dataSource-ref="dataSourceDesenv" />

    <bean id="simpleJdbcTemplate" class="org.springframework.jdbc.core.simple.SimpleJdbcTemplate">
        <constructor-arg ref="dataSourceDesenv" />
    </bean>

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

java spring maven-2

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

Boto3 Kinesis视频GetMedia和OpenCV

我正在尝试使用Boto3从kinesis获取视频流,然后使用OpenCV显示源并同时将其保存到文件中.

获取签名URL然后获取Getmedia请求的过程似乎完美无缺,就在我尝试使用OpenCV渲染它时,它似乎无法正常工作.

数据肯定会流向流

import boto3
import numpy as np
import cv2

kinesis_client = boto3.client('kinesisvideo',
                              region_name='eu-west-1',
                              aws_access_key_id='ACC',
                              aws_secret_access_key='KEY'
                              )

response = kinesis_client.get_data_endpoint(
    StreamARN='ARN',
    APIName='GET_MEDIA'
)
video_client = boto3.client('kinesis-video-media',
                            endpoint_url=response['DataEndpoint']
                            )
stream = video_client.get_media(
    StreamARN='ARN',
    StartSelector={'StartSelectorType': 'NOW'}
)
# print(stream)


datafeed = stream['Payload'].read()
fourcc = cv2.VideoWriter_fourcc(*'XVID')
out = cv2.VideoWriter('output.avi',fourcc, 20.0, (640,480))

while(True):
        ret, frame = stream['Payload'].read()


        out.write(frame)

        cv2.imshow('frame',frame)
        if cv2.waitKey(1) & 0xFF == ord('q'):
            break
        else:
            break
cap.release()
out.release()
cv2.destroyAllWindows()
Run Code Online (Sandbox Code Playgroud)

python opencv amazon-web-services amazon-kinesis boto3

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

Docker:使用LetsEncrypt的HTTPS代理

我正在尝试制作一个安全的Docker代理作为概念证明。似乎即将开始工作(端口80有效,b.example.com出现“ It Works!”页面)。但是,控制台在生成密钥时显示错误。

docker-compose.yml

version: '2'

services:
  nginx-proxy:
    image: jwilder/nginx-proxy
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./certs:/etc/nginx/certs:ro
      - /etc/nginx/vhost.d
      - /usr/share/nginx/html
      - /var/run/docker.sock:/tmp/docker.sock:ro

  nginx-letsencrypt:
    image: jrcs/letsencrypt-nginx-proxy-companion
    volumes:
     - ./certs:/etc/nginx/certs:rw
     - /var/run/docker.sock:/var/run/docker.sock:ro
    volumes_from:
     - nginx-proxy:rw
    environment:
      - LETSENCRYPT_TEST=true

  site-b:
    image: httpd
    networks:
      - reverse-proxy
      - back
    environment:
      - VIRTUAL_PORT=1234
      - VIRTUAL_HOST=b.example.com
      - LETSENCRYPT_HOST=b.example.com
Run Code Online (Sandbox Code Playgroud)

错误

nginx-letsencrypt_1 | 2018-04-27 11:41:40,244:ERROR:simp_le:1446:CA将某些授权标记为无效,这可能意味着它无法访问http://example.com/.well-known/acme-challenge/ X。您是否在-d example.com:path或--default_root中设置了正确的路径?您所有的域名都可以通过互联网访问吗?请检查您域的DNS条目,主机的网络/防火墙设置以及您的网络服务器配置。如果域的DNS条目同时设置了A和AAAA字段,则某些CA(如Let's Encrypt)将通过IPv6执行质询验证。如果您的DNS提供商没有正确回答CAA记录请求,那么“让我们加密”将不会为您的域颁发证书(请参阅https://letsencrypt.org/docs/caa/)。授权失败:https://acme-v01.api.letsencrypt。

docker docker-compose lets-encrypt jwilder-nginx-proxy

5
推荐指数
0
解决办法
768
查看次数

无法初始化scala上的类异常(可能是squeryl bug)

我正在使用scala 2.8.1,scalatra 2.0.0.M2,squeryl 2.8.0和scalate 2.0.0以及sbt开发Web应用程序

我遇到了问题,显然是模型或架构类.当我运行我的测试时,我得到一个:

java.lang.NoClassDefFoundError: Could not initialize class org.mycompany.myproject.model.myschema
Run Code Online (Sandbox Code Playgroud)

如果我尝试在sbt的console-quick上运行以下代码,我会收到一个错误:

import org.mycompany.myproject.model.myschema
myschema.mytable
Run Code Online (Sandbox Code Playgroud)

错误:

java.lang.RuntimeException: Could not deduce Option[] type of field 'field1' of class org.mycompany.myproject.model.myotherclass
Run Code Online (Sandbox Code Playgroud)

正如我所料,无论我尝试在该架构上调用什么方法,都会弹出错误.

现在,这是我的架构在该表声明附近的样子:

object myschema extends Schema {
  val myotherclasses = table[myotherclass]
  val otherClassManyToMany = manyToManyRelation(yetanotherclass, mytables).
       via[myotherclass]((e,ssr, sse) => (e.id === sse.leftId, sse.rightId === ssr.id))
...
}
Run Code Online (Sandbox Code Playgroud)

这是我的代码表的样子:

class myotherclass(
  val rightId: Long,
  val field1: Option[Long],
  val field2: Option[Long],
  val foreiginKey: Long,
  val leftId: Long) extends KeyedEntity[CompositeKey2[Long, Long]] {
  def id …
Run Code Online (Sandbox Code Playgroud)

scala sbt squeryl

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