我想建立一个程序集,然后签名。我的问题是 jarsigner 不是对程序集进行签名,而是对独立的 jar 文件进行签名。你能告诉我有什么问题吗?使用 Ant 多年后,Maven 对我来说似乎是“魔法”。我看不到插件合作和相互传递信息的方式。
执行后mvn install,我得到两个 jar 文件,一个被调用example-1.0.0-SNAPSHOT.jar并且这个被签名,一个被调用example-1.0.0-jar-with-dependencies.jar并且这个没有签名。我不需要独奏,只需要大会,但签名。
这是我的 pom.xml:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>sign</id>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
<configuration>
<keystore>${project.basedir}\keystore\mykeystore</keystore>
<alias>myalias</alias>
<storepass>...</storepass>
<keypass>...</keypass>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>make-my-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<archive>
<manifest>
<mainClass>com.example.FooBar</mainClass>
</manifest>
</archive>
<appendAssemblyId>true</appendAssemblyId>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud) 我有一些Java实体类在我的生产代码中运行良好.我正在为这个应用程序编写一个自动化测试,我正在重用同一个类.
当测试应用程序以这种方式创建其实体管理器时:
Properties props = new Properties();
props.setProperty("provider", "org.apache.openjpa.persistence.PersistenceProviderImpl");
props.setProperty(...);
EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("foobar-upgrade-restful-test", props);
EntityManager entityManager = entityManagerFactory.createEntityManager();
Run Code Online (Sandbox Code Playgroud)
应用程序抛出一条错误消息,告知:
Caused by: <openjpa-2.2.0-r422266:1244990 fatal user error> org.apache.openjpa.persistence.ArgumentException: You have supplied columns for "com.foo.bar.server.commontypes.job.CompositeJob", but this mapping cannot have columns in this context.
at org.apache.openjpa.jdbc.meta.MappingInfo.assertNoSchemaComponents(MappingInfo.java:382)
at org.apache.openjpa.jdbc.meta.strats.FlatClassStrategy.map(FlatClassStrategy.java:51)
at org.apache.openjpa.jdbc.meta.ClassMapping.setStrategy(ClassMapping.java:392)
at org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy(RuntimeStrategyInstaller.java:56)
at org.apache.openjpa.jdbc.meta.MappingRepository.prepareMapping(MappingRepository.java:411)
at org.apache.openjpa.meta.MetaDataRepository.preMapping(MetaDataRepository.java:762)
at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:651)
... 72 more
Run Code Online (Sandbox Code Playgroud)
我并不是真的理解错误消息,因为同一个实体bean在Glassfish下的应用程序中工作,而persistence.xml也几乎相同.(在测试中我使用RESOURCE_LOCALtx而不是JTA,但我怀疑它与此错误有关.
你知道什么是错的吗?
我正计划在Android设备和使用商用蓝牙模块的自定义传感器之间使用通信协议.我会使用SPP配置文件,据说"向用户提供简单可靠的数据流,类似于TCP".
我对蓝牙技术不太熟悉,对设计这样的协议有一些疑问.
首先,我不清楚是否必须担心传输的数据是否被传输.底层协议栈是否会保证我从InputStreamAndroid 读取的字节与UART在传感器端接收的字节相同?我是否必须定义我自己的受CRC或东西保护的数据包,或者它是否过度杀伤?
从Android蓝牙文档中我不清楚如果信号很弱并且丢失了一段时间,我的应用程序会发生什么.我是否立即获得IOException或者平台为我提供了一些隐藏的错误处理和恢复,这会使我看不到这么短暂的中断?
谢谢你的建议.
我这样发送电子邮件:
@Test
public void testEmailCharacterSet() throws MessagingException, UnsupportedEncodingException {
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
mailSender.setDefaultEncoding("utf-8");
mailSender.setHost("*****");
mailSender.setUsername("*****");
mailSender.setPassword("*****");
Properties properties = new Properties();
properties.setProperty("mail.mime.charset", "utf-8");
mailSender.setJavaMailProperties(properties);
MimeMessage mimeMessage = mailSender.createMimeMessage();
MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, false, "utf-8");
mimeMessage.setContent("Árvízt?r? tükörfúrógép 3", "text/html");
helper.setFrom("noreply@foobar.com");
helper.setTo("foobar@gmail.com");
mailSender.send(mimeMessage);
}
Run Code Online (Sandbox Code Playgroud)
正如你所看到的,我在任何地方设置utf-8.我的问题是传出的原始字节仍然是Latin1,至少这是我在Wireshark中看到的:
Date: Sun, 17 May 2015 18:16:21 +0200 (CEST)
From: noreply@foobar.com
To: foobar@gmail.com
Message-ID: <13648335.0.1431879381653.JavaMail.foo@foo-dell>
MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
=C1rv=EDzt?r? t=FCk=F6rf=FAr=F3g=E9p 3
.
Run Code Online (Sandbox Code Playgroud)
所以基本上标题都是UTF-8,但是输出字节已经包含问号,其中ő和ű应该出现,这是Latin1中缺少的两个字符.JVM file.encoding不是UTF-8,但我正在寻找一种方法来保持原样,并仅在电子邮件方面解决这个问题.
谢谢!
更新
我之前已成功使用普通的旧方法发送电子邮件,有趣的是,它仍然有效:
Message mimeMessage = …Run Code Online (Sandbox Code Playgroud) 这个问题是关于使用MPEG-DASH和/或HLS的视频流.我试图了解商业DRM系统(例如EZDRM,BuyDRM等)与简单加密流式传输(例如AES-128加密的HLS)相比所增加的价值.我在商业口号中有点迷失.
因此,如果我有实时或VOD流,如果我"免费"使用HLS,我可以轻松发送使用AES-128加密的流.在我看来,当我为我的MPEG-DASH流设置付费DRM时,基本上会发生相同的事情,流被加密并且细节以标准化方式共享(CENC).
因此,在播放器方面的两种情况下,我所需要的只是解密的关键.从任何Web服务单独获取该密钥应该不是什么大问题.这就是全部..?
基于此,实现一些自定义密钥提供程序服务将非常简单,但显然市场由大型提供商拥有,因此我必须在这里忽略一些重要方面.
(澄清一下:我不是在讨论DRM中的所有内容,只是当我有一些直播视频和一个提供这些视频的网站时)
任何帮助和良好的综合文章链接表示赞赏.
有没有一种好方法可以获取集群中运行的 Java Web 应用程序的登录用户数?
我写了一个简单的HttpSessionListener静态字段,但我想这在集群中不起作用。我可以看到有一个 Spring Security 解决方案,但我在一些论坛上读到这在集群中仍然不行。
我必须在其中实现此用户计数的产品试图独立于应用程序服务器,目前我们支持 Tomcat、Weblogic 和 JBoss。目前我需要一个针对Weblogic 10.3集群的解决方案。
我有一个org.dom4j.Document特定的DefaultDocument实现的实例.我想在另一个节点之前插入一个新节点.我真的不明白dom4j api,我对Element和DOMElement和之间的区别感到困惑.
org.dom4j.dom.DOMElement.insertBefore不适合我,因为我拥有的节点不是DOMElement.DOMNodeHelper.insertBefore并不好,因为我有org.dom4j.Node实例,而不是org.w3c.dom.Node实例.我的天啊.
你能给我一些代码片段,为我做这个工作吗?
这就是我现在拥有的:
// puts lr's to the very end in the xml, but I'd like to put them before 'e'
for(Element lr : loopResult) {
e.getParent().add(lr);
}
Run Code Online (Sandbox Code Playgroud) 我有以下 POM 结构:
./foobar-common/pom.xml ./abc-window/pom.xml ./abc-datasource/pom.xml
abc-window 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>hu.abc.ringcore</groupId>
<artifactId>abc-window</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>abc-window</name>
<parent>
<relativePath>../foobar-common/pom.xml</relativePath>
<groupId>hu.abc.ringcore</groupId>
<artifactId>foobar-common</artifactId>
<version>1.0</version>
</parent>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>hu.abc.ringcore</groupId>
<artifactId>abc-datasource</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</configuration>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
abc-datasource 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>hu.abc.ringcore</groupId>
<artifactId>abc-datasource</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>abc-datasource</name> …Run Code Online (Sandbox Code Playgroud) 我正在玩Spring Boot并且有一些我不太了解的东西.我的@Controller应用程序中有2 秒,而第二个并没有真正接受REST调用,Thymeleaf正在跳转请求.
基本上我所拥有的是:
@Configuration
@ComponentScan
@EnableAutoConfiguration
public class Application {
public static void main(String[] args) throws Throwable {
SpringApplication.run(Application.class, args);
}
}
Run Code Online (Sandbox Code Playgroud)
然后
@Configuration
@EnableWebMvcSecurity
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled=true)
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
Environment env;
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/", "/home").permitAll()
.antMatchers("/webjars/**").permitAll()
.antMatchers("/console/**").permitAll()
.antMatchers("/resources/**").permitAll()
.anyRequest().authenticated();
http.formLogin().loginPage("/login").permitAll().and().logout()
.permitAll();
http.csrf().disable(); // for angularjs ease
http.headers().frameOptions().disable(); //for H2 web console
}
}
Run Code Online (Sandbox Code Playgroud)
和
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {
@Override
public void addViewControllers(ViewControllerRegistry …Run Code Online (Sandbox Code Playgroud)