我在JDK 1.7中使用Java Collections时出错:我在这行中遇到了这个例外: proposalStatuses.addAll(getAllSubmittedStatuses())
java.lang.UnsupportedOperationException
at java.util.AbstractList.add(Unknown Source)
at java.util.AbstractList.add(Unknown Source)
at java.util.AbstractCollection.addAll(Unknown Source)
Run Code Online (Sandbox Code Playgroud)
尝试将集合添加到列表中
/**
* Gets the all submitted statuses.
*
* @return the all submitted statuses
*/
private Collection<ProposalStatus> getAllSubmittedStatuses() {
return Arrays.asList(
ProposalStatus.SAVED_TO_IOS
, ProposalStatus.SENDED_TO_IOS_IN_PROGRESS
);
}
/**
* Gets the all received statuses.
*
* @return the all received statuses
*/
private Collection<ProposalStatus> getAllReceivedStatuses() {
Collection<ProposalStatus> proposalStatuses =
Arrays.asList(
ProposalStatus.RECEIVED_BY_IOS
, ProposalStatus.SUBMITTED_TO_IOS
, ProposalStatus.RECEIVED_IOS
);
proposalStatuses.addAll(getAllSubmittedStatuses());
return proposalStatuses;
}
Run Code Online (Sandbox Code Playgroud) 我试图从Nexus存储库中查看我的代码.首先,我用密码生成密码
mvn --encrypt-master-password _mypassword_
Run Code Online (Sandbox Code Playgroud)
这是我的c:/Users/joanet/.m2/settings-security.xml:
<settingsSecurity>
<master>{TnRCVc3cX6MH5qRXEMLwxjKGfXQu6v/6wR0rgHED2ws=}</master>
</settingsSecurity>
Run Code Online (Sandbox Code Playgroud)
这是我的c:/progs/PGM/apache-maven-3.0.5/conf/settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements. See the NOTICE file distributed with this work for additional
information regarding copyright ownership. The ASF licenses this file to
you under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of
the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required …Run Code Online (Sandbox Code Playgroud) 我刚刚为WebLogic Server版本12.1.3.0.0创建了一个身份验证提供程序,(身份验证提供程序通过在许多可配置的JAAS LoginModule之上构建身份验证序列来遵守标准JAAS框架.)但是当我启动Wl I时有这个错误:
这里的步骤:
1)设置ENV
%WL_HOME%/server/bin/setWLSEnv.cmd
Run Code Online (Sandbox Code Playgroud)
2)生成MBean和stubs:
java -cp %WL_HOME%/server/lib/* -verbose -DcreateStubs="true" \
weblogic.management.commo.WebLogicMBeanMaker -MDF WSAuthentication.xml \
-files C:\Development\Workspaces\Eclipse\WLAuthenticationProvider\src
Run Code Online (Sandbox Code Playgroud)
3)使用生成的存根和MBI文件打包认证提供程序和登录模块.
java -DMJF=C:\Development\Workspaces\Eclipse\WLAuthenticationProvider\jar\WSAuthentication.jar \
-Dfiles=C:\Development\Workspaces\Eclipse\WLAuthenticationProvider\src weblogic.management.commo.WebLogicMBeanMaker
Run Code Online (Sandbox Code Playgroud)
4)在startWebLogic.cmd中添加-DUseSunHttpHandler = true
weblogic.security.service.SecurityServiceRuntimeException: [Security:090877]Service Common JAASAuthenticationService unavailable, see exception text: com.bea.common.engine.ServiceInitializationException: com.bea.common.engine.SecurityServiceRuntimeException: [Security:097533]SecurityProvider service class name for MyAuthentication is not specified.
at weblogic.security.service.PrincipalAuthenticator.initialize(PrincipalAuthenticator.java:155)
at weblogic.security.service.PrincipalAuthenticator.<init>(PrincipalAuthenticator.java:315)
at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.doATN(CommonSecurityServiceManagerDelegateImpl.java:731)
at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.postInitializeRealm(CommonSecurityServiceManagerDelegateImpl.java:515)
at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.postLoadRealm(CommonSecurityServiceManagerDelegateImpl.java:861)
at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.postInitializeRealms(CommonSecurityServiceManagerDelegateImpl.java:927)
at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.postInitialize(CommonSecurityServiceManagerDelegateImpl.java:1109)
at weblogic.security.service.SecurityServiceManager.postInitialize(SecurityServiceManager.java:943)
at weblogic.security.SecurityService.start(SecurityService.java:159)
at weblogic.server.AbstractServerService.postConstruct(AbstractServerService.java:78)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.glassfish.hk2.utilities.reflection.ReflectionHelper.invoke(ReflectionHelper.java:1017)
at org.jvnet.hk2.internal.ClazzCreator.postConstructMe(ClazzCreator.java:388)
at …Run Code Online (Sandbox Code Playgroud) 我使用 Spring Initializer、嵌入式 Tomcat、Thymeleaf 模板引擎生成了一个 Spring Boot Web 应用程序,并将其打包为可执行 JAR 文件。
使用的技术:
Spring Boot 1.4.2.RELEASE、Spring 4.3.4.RELEASE、Thymeleaf 2.1.5.RELEASE、Tomcat Embed 8.5.6、Maven 3、Java 8
这是我的安全配置类:
@Configuration
@EnableWebSecurity
@PropertySource("classpath:/com/tdk/iot/config/app-${APP-KEY}.properties")
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Value("${securityConfig.formLogin.loginPage}")
private String loginPage;
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.formLogin()
.loginPage(loginPage)
.permitAll()
.loginProcessingUrl("/login")
.failureUrl("/login.html?error=true")
.defaultSuccessUrl("/books/list")
.and()
.exceptionHandling()
.accessDeniedPage("/denied")
.and()
.authorizeRequests()
.antMatchers("/mockup/**").permitAll()
.antMatchers("/books/**").permitAll()
.antMatchers("/welcome/**").authenticated()
.and()
.logout()
.permitAll()
.logoutSuccessUrl("/index.html");
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.passwordEncoder(new StandardPasswordEncoder())
.withUser("test1").password("test1").roles("ADMIN").and()
.withUser("test2").password("test2").roles("USER").and()
.withUser("test3").password("test3").roles("SUPERADMIN");
}
@Bean …Run Code Online (Sandbox Code Playgroud) authentication spring spring-mvc spring-security spring-boot
我使用Spring Initializer,嵌入式Tomcat,Thymeleaf模板引擎和包作为可执行JAR文件生成了一个Spring Boot Web应用程序.
使用的技术:
Spring Boot 1.4.2.RELEASE,Spring 4.3.4.RELEASE,Thymeleaf 2.1.5.RELEASE,Tomcat Embed 8.5.6,Maven 3,Java 8
这是我在启动数据库时调用的bean
@SpringBootApplication
@EnableAutoConfiguration
@Import({SecurityConfig.class})
public class BookApplication {
public static void main(String[] args) {
SpringApplication.run(BookApplication.class, args);
}
}
@Configuration
public class PersistenceConfig {
...
/**
* Creates an in-memory "books" database populated
* with test data for fast testing
*/
@Bean
public DataSource dataSource(){
return
(new EmbeddedDatabaseBuilder())
.addScript("classpath:db/H2.schema.sql")
.addScript("classpath:db/H2.data.sql")
.build();
}
Run Code Online (Sandbox Code Playgroud)
当我执行此插入时
CREATE TABLE IF NOT EXISTS t_time_lapse (
id bigint PRIMARY KEY,
name varchar(50) NOT …Run Code Online (Sandbox Code Playgroud) 我有一个基本的SpringBoot应用程序.使用Spring Initializer,嵌入式Tomcat,Thymeleaf模板引擎和包作为可执行的JAR文件.
这是主要的课程
@SpringBootApplication
public class TdkApplication {
public static void main(String[] args) {
SpringApplication.run(TdkApplication.class, args);
}
}
Run Code Online (Sandbox Code Playgroud)
这是一个控制器
@Controller
public class MockupIndexController {
@RequestMapping("/mockup/index")
public String welcome(Map<String, Object> model) {
return "mockups/index";
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的 pom.xml
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>com.tdk.iot.core</groupId>
<artifactId>tdk-core</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Run Code Online (Sandbox Code Playgroud)
但是当我把它放在URL中时:
http://localhost:8080/mockup/index
Run Code Online (Sandbox Code Playgroud)
我在控制台中获得了以下日志
o.s.web.servlet.DispatcherServlet : Servlet 'dispatcherServlet' configured successfully
o.s.web.servlet.DispatcherServlet : DispatcherServlet with name 'dispatcherServlet' processing GET request for …Run Code Online (Sandbox Code Playgroud) 我有一个基本的SpringBoot应用程序,嵌入式Tomcat,Thymeleaf模板引擎和包作为可执行的JAR文件.
我有这门课:
@Service
public class I18NService {
/** The application logger */
private static final Logger LOG = LoggerFactory.getLogger(I18NService.class);
@Autowired
private MessageSource messageSource;
...
}
Run Code Online (Sandbox Code Playgroud)
这个控制器
@Controller
public class ForgotMyPasswordController extends TdkController {
@Autowired
private I18NService i18NService;
@Autowired
private EmailService emailService;
...
}
Run Code Online (Sandbox Code Playgroud)
启动应用程序工作正常,此测试也正常工作
public class ForgotMyPasswordControllerTests {
private ForgotMyPasswordController controller;
@Before
public void setUp() throws Exception {
controller = new ForgotMyPasswordController();
}
@Test
public void testHandleListRequest() {
assertEquals("forgotmypassword/emailForm", controller.forgotPasswordGet());
}
}
Run Code Online (Sandbox Code Playgroud)
但是当我运行这个时:
@RunWith(SpringRunner.class)
@WebAppConfiguration
@WebMvcTest
public class MockMvcTests { …Run Code Online (Sandbox Code Playgroud) 安装oracle软件包之后
oracle-instantclient12.2-basiclite-12.2.0.1.0-1.x86_64.rpm
Run Code Online (Sandbox Code Playgroud)
和
oracle-instantclient12.2-tools-12.2.0.1.0-1.x86_64.rpm
Run Code Online (Sandbox Code Playgroud)
同 alien -i
我想运行该exp实用程序,但是我收到了一个错误
root@localhost:/usr/lib/oracle/12.2/client64/bin# ./exp
./exp: error while loading shared libraries: libclntsh.so.12.1: cannot open shared object file: No such file or directory
root@localhost:/usr/lib/oracle/12.2/client64/bin# export
declare -x DERBY_HOME="/usr/lib/jvm/java-8-oracle/db"
declare -x HOME="/root"
declare -x J2REDIR="/usr/lib/jvm/java-8-oracle/jre"
declare -x J2SDKDIR="/usr/lib/jvm/java-8-oracle"
declare -x JAVA_HOME="/usr/lib/jvm/java-8-oracle"
declare -x LANG="en_US.UTF-8"
declare -x LD_LIBRARY_PATH=":/usr/lib/oracle/12.2/client64/lib/libclntsh.so.12.1"
declare -x LESSCLOSE="/usr/bin/lesspipe %s %s"
declare -x LESSOPEN="| /usr/bin/lesspipe %s"
declare -x LOGNAME="root"
declare -x LS_COLORS="rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:"
declare -x MAIL="/var/mail/root"
declare -x OLDPWD="/root"
declare -x PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin"
declare -x PWD="/usr/lib/oracle/12.2/client64/bin" …Run Code Online (Sandbox Code Playgroud) 我有一个 SpringBoot 应用程序和一个从 CrudRepository
@Query("select cps from HotelPriceSummary cps where cps.price > 5 and cps.profilePercentage >= 70 ")
List<HotelPriceSummary> findMine(Pageable pageable);
Run Code Online (Sandbox Code Playgroud)
我想知道是否可以从对象中获取总页数 Pageable
我有一个基本的SpringBoot 2.1.5.RELEASE应用程序。使用Spring Initializer,JPA,嵌入式Tomcat,Thymeleaf模板引擎,并将其打包为带有某些RestController的可执行JAR文件。
在控制器的1中,这是我发送的正文:
{
"depositHotel": "xxx",
"destinationHotel": "aaa",
"depositHotelAmount": "0.2",
"destinationHotelAmount": "4",
"destinationAddress": [{
"address": "asdf",
"tag": ""
}],
"refundAddress": [{
"address": "pio",
"tag": ""
}]
}
Run Code Online (Sandbox Code Playgroud)
因此,我创建了该类以将其作为RequestBody发送:
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"address",
"tag"
})
public class Address {
public Address() {
super();
}
public Address(String address) {
super();
this.address = address;
}
@JsonProperty("address")
private String address;
@JsonProperty("tag")
private Object tag;
@JsonProperty("address")
public String getAddress() {
return address;
}
@JsonProperty("address")
public void setAddress(String address) {
this.address = address;
}
@JsonProperty("tag")
public …Run Code Online (Sandbox Code Playgroud) spring-boot ×6
spring ×4
spring-mvc ×4
java ×3
collections ×1
h2 ×1
json ×1
junit4 ×1
linux ×1
maven ×1
mockmvc ×1
mysql ×1
oracle12c ×1
oracleclient ×1
security ×1
ubuntu ×1
ubuntu-14.04 ×1
weblogic12c ×1