这是我使用Eclipse创建第一个Axis2 Web服务时遇到的错误.在我编写类之后,我使用Apache Axis2创建了Web服务.当我在eclipse中单击启动服务器按钮时,它会显示一条错误消息:
无法在localhost上发布Tomcat v6.0 Server的服务器配置.
多个上下文的路径为"/ FirstApache".
FirstApache是我之前创建的动态Web项目.我从Web服务向导的配置部分中选择了正确的Web项目.
我怎样才能解决这个问题?
我目前正在寻找一个可以在qr代码中编码文本的js库.到目前为止,我能找到的唯一一个看起来很破旧,尽管其他人声称正在使用它.示例页面不起作用.通过播放它,我设法生成代码,但它们不会被手机软件解码.
还有另一个库是js吗?有没有人设法让它工作?
我对从在线服务(kaywa,google等)中提取代码的解决方案不感兴趣.
更新:
嗯,你们是对的,那个图书馆确实有用.我的问题是我尝试将它包含在HTML5 Boilerplate页面中,而document.write似乎不起作用.无论如何我修改了示例代码,使浏览器在画布而不是表格中绘制,我向后获得了fillRect函数的顺序.以下是更正后的函数调用.
context.fillRect(c * UNIT_SIZE, r * UNIT_SIZE, UNIT_SIZE, UNIT_SIZE);
// it's column-row, not row-column; don't ask why :)
Run Code Online (Sandbox Code Playgroud)
因为我不再让我的图像转换:),现在qr解码很好.感谢您的支持.
我有两个项目,foo
并foo-web
在该com.example
组下.foo-web
取决于foo
.
为了能够在不依赖外部服务的情况下开发应用程序的UI部分,实现了虚拟DAO foo
(它们返回静态数据,因此我们不必连接到数据库等).
我们被要求将虚拟类移动到src/test/java
.这意味着它们不会部署foo.jar
到从Web项目构建的战争中.我在maven网站上找到了这些说明,但它们似乎对我不起作用.
在foo
的pom.xml
,我有:
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>test-jar</id>
<phase>test-compile</phase>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
在跑步mvn install
的时候foo-web
,在foo
我的目标中我会得到两个罐子:foo-1.0.0-SNAPSHOT.jar
和foo-1.0.0-SNAPSHOT-tests.jar
.它们都在本地maven存储库中安装得很好.
以前,foo-web
依赖关系看起来像这样:
<dependency>
<groupId>com.example</groupId>
<artifactId>foo</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
这将触发foo-1.0.0-SNAPSHOT.jar
战争中的部署.现在,我想部署-tests
jar,最好只用于"本地"配置文件.
我尝试过各种方法来做到这一点:
<profile>
<id>local</id>
<dependencies>
<dependency>
<groupId>com.example</groupId>
<artifactId>foo</artifactId>
<version>1.0.0-SNAPSHOT</version>
<type>test-jar</type>
</dependency>
</dependencies>
</profile>
Run Code Online (Sandbox Code Playgroud)
这会导致使用不同的名称部署源jar:com.example-foo.jar
并且不部署测试jar.我也尝试使用<classifier>
而不是 …
今天我在想这个,我意识到我这里没有清晰的图片.
以下是我认为是真实的一些陈述(如果我错了,请纠正我):
我很好奇我打电话后幕后发生的事情document.getElementById('foo')
.调用是否由解释器委托给浏览器本机代码,或者浏览器是否具有所有主机对象的JS实现?你知道他们对此做了什么优化吗?
我阅读了浏览器内部的这个概述,但它没有提到任何关于这个的内容.我有空的时候会浏览Chrome和FF源码,但我想先问一下这里.:)
我正在尝试在Spring上下文文件中创建一个对象数组,因此我可以将它注入一个声明如下的构造函数:
public RandomGeocodingService(GeocodingService... services) { }
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用<array>
标签:
<bean id="googleGeocodingService" class="geocoding.GoogleGeocodingService">
<constructor-arg ref="proxy" />
<constructor-arg value="" />
</bean>
<bean id="geocodingService" class="geocoding.RandomGeocodingService">
<constructor-arg>
<array value-type="geocoding.GeocodingService">
<!-- How do I reference the google geocoding service here? -->
</array>
</constructor-arg>
</bean>
Run Code Online (Sandbox Code Playgroud)
我无法在文档中找到有关如何执行此操作的示例或内容.此外,你有任何建议,以更好的方式来实现我正在尝试做的事情,请让我知道:).
当实例化一个Locale
用以下语言代码的任一对象:he
,yi
并且id
它不保留自己的价值.
例如:
Locale locale = new Locale("he", "il");
locale.getLanguage(); // -> "iw"
Run Code Online (Sandbox Code Playgroud)
造成这种情况的原因是什么方法可以解决这个问题?
我有几个DAO对象用于从数据库中检索信息,我真的想为它们编写一些自动化测试,但我很难弄清楚如何去做.
我正在使用Spring JdbcTemplate
来运行实际查询(通过预准备语句)并将结果映射到模型对象(通过RowMapper
类).
如果我要编写单元测试,我不确定如何/应该模拟对象.例如,由于只有读取,我会使用实际的数据库连接而不是模拟jdbcTemplate,但我不确定是否正确.
这是批次中最简单的DAO的(简化)代码:
/**
* Implementation of the {@link BusinessSegmentDAO} interface using JDBC.
*/
public class GPLBusinessSegmentDAO implements BusinessSegmentDAO {
private JdbcTemplate jdbcTemplate;
private static class BusinessSegmentRowMapper implements RowMapper<BusinessSegment> {
public BusinessSegment mapRow(ResultSet rs, int arg1) throws SQLException {
try {
return new BusinessSegment(rs.getString(...));
} catch (SQLException e) {
return null;
}
}
}
private static class GetBusinessSegmentsPreparedStatementCreator
implements PreparedStatementCreator {
private String region, cc, ll;
private int regionId;
private GetBusinessSegmentsPreparedStatementCreator(String cc, String …
Run Code Online (Sandbox Code Playgroud) 我目前正在开发一个涉及大量XSLT转换的项目,我真的需要一个调试器(我有1000多行的XSLT ,我没有写它们:-).
该项目是用C#编写的,并使用扩展对象:
xslArg.AddExtensionObject("urn:<obj>", new <Obj>());
Run Code Online (Sandbox Code Playgroud)
据我所知,在这种情况下,Visual Studio是唯一可以帮助我逐步调试转换的工具.由于扩展对象,静态调试器没有用处(当它到达引用其命名空间的元素时会抛出错误).幸运的是,我发现这个线程给了我一个起点(至少我知道它可以完成).
在搜索MSDN之后,我找到了可以进入转换的标准.它们列在这里.简而言之:
IXmlLineInfo
接口(XmlReader
&co.)的类加载XML和XSLTXSLTCompiledTransform
构造函数中使用的XML解析器是基于文件的(XmlUriResolver
应该可以工作).据我所知,我符合所有这些标准,但它仍然无效.相关代码示例发布如下:
// [...]
xslTransform = new XslCompiledTransform(true);
xslTransform.Load(XmlReader.Create(new StringReader(contents)), null, new BaseUriXmlResolver(xslLocalPath));
// [...]
// I already had the xml loaded in an xmlDocument
// so I have to convert to an XmlReader
XmlTextReader r = new XmlTextReader(new StringReader(xmlDoc.OuterXml));
XsltArgumentList xslArg = new XsltArgumentList();
xslArg.AddExtensionObject("urn:[...]", new [...]());
xslTransform.Transform(r, xslArg, context.Response.Output);
Run Code Online (Sandbox Code Playgroud)
我真的不明白我做错了什么.我检查了两个XmlReader
对象上的接口,然后实现了所需的接口.此外,BaseUriXmlResolver
继承自 …
在Java中调用类上的静态方法是否会触发静态初始化块来执行?
根据经验,我会说不.我有这样的事情:
public class Country {
static {
init();
List<Country> countries = DataSource.read(...); // get from a DAO
addCountries(countries);
}
private static Map<String, Country> allCountries = null;
private static void init() {
allCountries = new HashMap<String, Country>();
}
private static void addCountries(List<Country> countries) {
for (Country country : countries) {
if ((country.getISO() != null) && (country.getISO().length() > 0)) {
allCountries.put(country.getISO(), country);
}
}
}
public static Country findByISO(String cc) {
return allCountries.get(cc);
}
}
Run Code Online (Sandbox Code Playgroud)
在使用该类的代码中,我执行以下操作:
Country country = Country.findByISO("RO");
Run Code Online (Sandbox Code Playgroud)
问题是我得到了一个 …
我一直试图让它工作一段时间,但还没有运气.
我想JAVA_HOME
指向JDK7但是我想为JVM 5编译一个项目.我已经阅读了文档,我在SO上发现了类似的帖子,但它们似乎都没有在我的设置中工作.
我首先尝试设置target
,source
但我收到了一个错误:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
[ClassName]
不是抽象的,不重写抽象方法getParentLogger()
在CommonDataSource
据我所知,在JDK 7中更新了类,并且添加了抛出错误的额外方法.我需要使用具有旧实现的JDK 5的运行时,一切都应该正常工作.所以我这样做:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<verbose>true</verbose>
<source>1.5</source>
<target>1.5</target>
<compilerArguments>
<bootclasspath>${env.JAVA5_HOME}/jre/lib/rt.jar</bootclasspath>
</compilerArguments>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我在我的系统上正确设置了JAVA5_HOME,我可以看到它在日志中加载了正确的类,但是我遇到了另一个错误:
[loading ZipFileIndexFileObject[c:\Program Files\Java\jdk1.5.0_22\jre\lib\rt.jar(*.class)]]
...
...
[ClassName]
错误:包javax.crypto
不存在
这是公平的,因为我没有包括jce.jar
(加密类)bootclasspath
.但是有一件事让我感到困惑.即使bootclasspath
只包含Java 5运行时,我在类路径中有很多来自JRE7的库.它们没有在任何地方指定.
[类文件的搜索路径:c:\ Program Files(x86)\ Java\jdk1.5.0_22\jre\lib\rt.jar,c:\ Program Files\Java\jdk1.7.0_02\jre\lib\ext\dnsns.jar,c:\ Program Files\Java\jdk1.7.0_02\jre\lib\ext\localedata.jar,c:\ Program Files\Java\jdk1.7.0_02\jre\lib\ext\sunec.jar, c:\ Program Files\Java\jdk1.7.0_02\jre\lib\ext\sunjce_provider.jar,c:\ Program Files\Java\jdk1.7.0_02\jre\lib\ext\sunmscapi.jar,c:\ Program Files\Java\jdk1.7.0_02\jre\lib\ext\zipfs.jar,...]
如果我尝试添加jce.jar(来自JRE5),我会回到第一个错误:
<plugin>
<groupId>org.apache.maven.plugins</groupId> …
Run Code Online (Sandbox Code Playgroud) java ×6
javascript ×2
maven ×2
spring ×2
axis ×1
browser ×1
c# ×1
dao ×1
debugging ×1
dependencies ×1
deployment ×1
dom ×1
eclipse ×1
javabeans ×1
jdbctemplate ×1
jdk1.5 ×1
locale ×1
qr-code ×1
static ×1
testing ×1
tomcat ×1
web-services ×1
xslt ×1