小编Nee*_*ets的帖子

来自十六进制代码的Apache POI XSSFColor

我想以十六进制代码将单元格的前景色设置为给定的颜色.例如,当我尝试将其设置为红色时:

style.setFillForegroundColor(new XSSFColor(Color.decode("#FF0000")).getIndexed());
Run Code Online (Sandbox Code Playgroud)

无论我在解码函数的参数中设置了什么十六进制值,getIndexed函数将始终返回黑色.

难道我可能做错了吗?我认为这是一个错误,但我不确定......

java apache-poi

36
推荐指数
3
解决办法
8万
查看次数

为什么我收到"使用GWT生命周期配置未涵盖的插件执行"错误?

我正在使用STS,我从另一台机器上导入了一个GWT项目.该项目使用m2eclipse.我在构建项目时遇到了这两个错误:

Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:gwt-maven-plugin:2.2.0:i18n (execution: default, phase: generate-sources)    pom.xml /contactsgwt    line 175
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-war-plugin:2.1.1:exploded (execution: default, phase: compile)  pom.xml /contactsgwt    line 198
Run Code Online (Sandbox Code Playgroud)

怎么了?有没有进一步的配置需要这样做才能gwt maven plugin工作?

pom.xml导致错误的代码:

<!-- GWT Maven Plugin -->
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>gwt-maven-plugin</artifactId>
    <version>2.2.0</version>
    <executions>
        <execution>
            <goals>
                <goal>compile</goal>
                <goal>test</goal>
                <goal>i18n</goal>
            </goals>
        </execution>
    </executions>
    <!-- Plugin configuration. There are many available options, see gwt-maven-plugin documentation at codehaus.org -->
    <configuration>
        <runTarget>Contacts.html</runTarget>
        <hostedWebapp>${webappDirectory}</hostedWebapp
        <i18nMessagesBundle>es.indra.gwt.contactsgwt.client.ContactsMessages</i18nMessagesBundle>
    </configuration>
</plugin>

<!-- Copy …
Run Code Online (Sandbox Code Playgroud)

eclipse gwt m2eclipse pom.xml maven

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

关闭它们的用户过滤问题

我刚刚开始使用Jira,而我遇到了问题导航器的问题.我想过滤问题,以便列表仅显示特定用户关闭的那些.我可以通过状态和/或解决方案来过滤问题,但不能通过最后更新它们的用户(也就是关闭它们的用户)来过滤问题.

我肯定答案是显而易见的,但我似乎无法找到如何做到这一点!

jira

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

将更改推送到googlecode时,在egit中无效的用户名/密码

我有一个用Git托管在googlecode上的项目.

我正在使用STG(SpringSource工具套件)和eGit.

我在家里克隆了存储库,我可以提交并成功推送更改.我在工作中做了同样的事情,当我尝试在提交后推送更改时,它显示以下错误:

https://myuser@code.google.com/p/myproject/: Invalid username/password.
You may need to use your generated googlecode.com password; see https://code.google.com/hosting/settings
Run Code Online (Sandbox Code Playgroud)

我第一次克隆存储库时输入了googlecode生成的密码(就像我在家里做的那样,这个错误从未出现过).我尝试再次输入,没有任何变化.

有谁知道是什么原因引起的?

谢谢!!

eclipse git google-code egit sts-springsourcetoolsuite

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

从maven执行测试时失败,但不是从Intellij执行

我正在使用JUnit,PowerMock,Spring Test和内存H2数据库编写单元测试.当我从Intellij运行测试时,一切都正常运行.但是当我从maven(来自Intellij或来自命令行)运行测试时,它们会失败.

这是我的配置:

   @EnableTransactionManagement
   @EnableJpaRepositories("my.app.repository")
   public class ApplicationTestConfiguration {
      @Bean
      public SimpleDriverDataSource dataSource() {
         SimpleDriverDataSource simpleDriverDataSource = new SimpleDriverDataSource();
         simpleDriverDataSource.setDriverClass(org.h2.Driver.class);
         simpleDriverDataSource.setUrl("jdbc:h2:mem:./ScenarioService;DATABASE_TO_UPPER=false;DB_CLOSE_DELAY=-1");
         simpleDriverDataSource.setUsername("sa");
         simpleDriverDataSource.setPassword("sa");
         return simpleDriverDataSource;
      }
      (...)
      private Properties hibernateProperties() {
         Properties props = new Properties();
         props.setProperty("hibernate.dialect","org.hibernate.dialect.H2Dialect");
         props.setProperty("hibernate.hbm2ddl.auto", "create-drop");
         props.setProperty("hibernate.show_sql","true");
         return props;
      }
   }
Run Code Online (Sandbox Code Playgroud)

这是一个示例测试:

@RunWith(PowerMockRunner.class)
@PowerMockRunnerDelegate(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {WebAppInitializer.class,ApplicationTestConfiguration.class, DirtiesContextTestExecutionListener.class})
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
public final class ReadTicketsTest {

    @Autowired //this is a spring JPARepository
    protected TestRepository testRepository;

    @Before
    public void init() {
         testRepository.save(engineConfig);
    }

    @Test
    public void ticketShouldBeRead() …
Run Code Online (Sandbox Code Playgroud)

java junit h2 spring-test maven

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

VMware vFabric tc Server Developer需要端口8080

我正在使用VMware vFabric tc Server Developer Edition v2.6附带的STS(SpringSource Tool Suite).问题是,每次启动它时,都会显示以下错误:

VMware vFabric tc Server Developer Edition v2.6所需的端口8080已在使用中.服务器可能已在另一个进程中运行,或者系统进程可能正在使用该端口.要启动此服务器,您需要停止其他进程或更改端口号.

我没有使用我所知道的那个端口.它一直很好,直到今天.

我也尝试更改端口号,但它不接受更改.例如,如果我将其更改为8081,然后重新启动STS,则会覆盖端口并将其重置为8080.

谁能提供一些想法来解决这个问题?

仅供我在VirtualBox中运行STS.

谢谢!

vmware sts-springsourcetoolsuite tcserver

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

更新sts或安装扩展时出现问题

我正在使用STS 2.5.0和我在尝试安装GWT扩展时遇到以下错误:

An error occurred while collecting items to be installed
session context was:(profile=com.springsource.sts.ide, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=).
No repository found containing: osgi.bundle,oracle.database.driver.jdk14,10.2.0.1
Run Code Online (Sandbox Code Playgroud)

然后我尝试将STS更新到最新版本(2.5.2),我得到了同样的错误.

有人碰巧知道问题是什么?

谢谢

eclipse gwt spring sts-springsourcetoolsuite

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

Subclipse"RA层请求失败"错误,Web浏览器没有错误

我正在使用STS 2.8.1(我认为它基于Eclipse Indigo)和Subclipse 1.6.18.

我正在尝试从存储库中检查一些代码,但是当我添加存储库位置时,我收到以下错误:

RA层请求失败
svn:服务器发送意外返回值(503 Service Unavailable)以响应OPTIONS请求'http:// abcom:18080/svn/myproject'

问题是,如果我尝试从Web浏览器(例如Chrome或IE)访问该存储库,我可以访问它.它询问我的用户名和密码,输入后我可以看到项目树.

有谁知道我为什么可以从网络浏览器访问而不是从STS访问?

为Subclipse正确配置了代理设置(我可以从STS访问其他存储库,但不能访问那个存储库).

eclipse subclipse svn sts-springsourcetoolsuite

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

H2 中用于单元测试的现有索引

我有一个在 MySQL 数据库上运行的服务。该服务是用 Java 编写的,并使用 Spring 和 JPA/Hibernate。我们使用 H2 数据库进行单元测试。问题是当我们运行测试时,在模式创建阶段我们会看到以下错误:

Index "USERNAME_INDEX" already exists; SQL statement: create index userName_index on MyTable1 (userName)
Run Code Online (Sandbox Code Playgroud)

问题似乎是我们的域类对于不同的表具有相同名称的索引:

MyTable : userName_index on column userName
MyTable1 : userName_index on column userName
Run Code Online (Sandbox Code Playgroud)

由于我们只看到MyTable1的错误,因此我们猜测MyTable的索引创建成功,然后MyTable1的索引创建失败。

显然,在 H2 中,索引名称在每个模式中必须是唯一的,但 MySQL 允许索引具有相同的名称,只要它们位于不同的表中即可。

我们无法更改索引名称。我还尝试将 MySQL 模式添加到连接 URL,如下所示:

"jdbc:h2:mem:./MyService;MODE=MySQL;DB_CLOSE_DELAY=-1;"
Run Code Online (Sandbox Code Playgroud)

如何使用当前索引名称使单元测试与 H2 一起工作?

java mysql junit spring h2

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

使用VMWare vFabric tc Server和maven找不到org.springframework.web.servlet.DispatcherServlet

我知道之前发布的问题与此问题非常相似.但该解决方案不适用于我的问题.

我正在尝试用Maven开始一个基本的Spring项目.这是我的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>es.indra</groupId>
  <artifactId>springappUV</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <properties>
    <org.springframework.version>3.1.1.RELEASE</org.springframework.version>
  </properties>
  <packaging>war</packaging>
  <dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.10</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
        <scope>provided</scope>
    </dependency>
  </dependencies>
</project>
Run Code Online (Sandbox Code Playgroud)

这是我的web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>springappUV</display-name>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>

  <servlet>
    <servlet-name>springapp</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
       <param-name>contextConfigLocation</param-name>
       <param-value>/WEB-INF/spring/app-config.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>springapp</servlet-name>
    <url-pattern>*.htm</url-pattern>
  </servlet-mapping>
</web-app>
Run Code Online (Sandbox Code Playgroud)

我正在使用VMWare vFabric tc Server Developer Edition v2.6(STS附带的那个).当我用它运行webapp时,我收到以下错误:

GRAVE: El Servlet …
Run Code Online (Sandbox Code Playgroud)

spring spring-mvc pom.xml maven sts-springsourcetoolsuite

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

用Javascript创建错误的日期

我有一个看似无助的问题,我确信我错过了一些非常愚蠢的东西.我有以下Javascript函数验证日期:

function validateDate(date){
    var re = /\b\d{1,2}[\/-]\d{1,2}[\/-]\d{4}\b/;
    if(!re.test(date))
        return false;

    var separator = (date.indexOf("/") != -1) ? "/" : "-";
    var aux = date.split(separator);
    var day = parseInt(aux[0]);
    var month = parseInt(aux[1]);
    var year = parseInt(aux[2]);
    alert(aux[0]+" "+aux[1]+" "+aux[2]);
    var dateTest = new Date(year,month-1,day);
    alert(dateTest); //2nd alert
    if(dateTest.getDate() != day)
        return false;
    if(dateTest.getMonth()+1!= month)
        return false;
    if(dateTest.getFullYear() != year)
        return false;

    return true;    
}
Run Code Online (Sandbox Code Playgroud)

第一个警报始终显示正确的值.例如05/07/2011,如果传入日期,一切正常.第二个警报显示"Tue Jul 5 00:00:00 UTC+0200 2011"哪个是正确的.但现在,如果我将日期月更改为8月或9月,则创建日期是错误的.例如,对于日期05/08/2011,将显示第二个警报"Sun Dec 5 00:00:00 …

javascript

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

Junit测试方法中的模型参数

我是新来的人,正在学习Spring-MVC和Junit。

我正在尝试使用Junit为此基本控制器方法实现测试方法:

public String home(Model model) {
        model.addAttribute(new Contact());
        logger.info("Welcome home!");
        return "home";
    }
Run Code Online (Sandbox Code Playgroud)

测试方法如下:

public void testHome() throws Exception{
        ContactsController contactsController=new ContactsController();
        Assert.assertEquals("home",contactsController.home(new Model()));
    }
Run Code Online (Sandbox Code Playgroud)

问题是,由于Model是接口,所以我显然无法创建新的Model对象以将其作为参数传递给contactsController.home(...)。你会给我什么选择?我不知道该怎么做。

谢谢

junit controller model spring-mvc

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

使用JDOM使用单引号保存XML文件

我必须使用Java修改XML文件中的一些属性.输入XML具有用单引号括起的所有属性值.

但是在对文档进行所有更改后,当我将文档保存到XML文件中时,所有属性值都被双引号括起来.

XMLOutputter xmlOutput = new XMLOutputter();
xmlOutput.output(doc, new FileWriter(path));
Run Code Online (Sandbox Code Playgroud)

有什么方法可以让输出器使用单引号?

谢谢

java jdom

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