我知道在stackoverflow和其他论坛上有很多关于这个错误的问题和答案.但我还是找不到解决方案......
出于速度原因,我有一个实用程序类,它根据提供的语言环境加载所有静态数据映射(例如几个月).
所以这个实用程序类看起来像这样:
public static final String GLOBAL_MESSAGES = "globalMessages";
private static Map<Integer,Month> monthsMap;
private ResourceBundle getResourceBundle(Locale locale) {
ResourceBundle rb = ResourceBundle.getBundle(GLOBAL_MESSAGES, locale);
return rb;
}
private Map<Integer,Month> getMonths() {
if(monthsMap == null) {
setMonths();
}
return monthsMap;
}
private void setMonths() {
try {
monthsMap = getFactory().getDAO().getAllMonths();
} catch (SQLException e) {
logger.error(e);
} catch (EmptyResultException e) {
logger.error(e);
}
}
public Map<Integer,Month> getMonths(Locale locale) {
if(locale == null) {
return monthsMap;
} else {
if(this.locale != locale) …Run Code Online (Sandbox Code Playgroud) 我尝试在Eclipse中运行OSGi插件.它是空捆绑,但是eclipse总是发给我错误有我的控制台消息 http://pastebin.com/dqQfpQhd有 什么问题?
基本上,我的Web服务必须可以作为单个OSGi jar包进行部署.因此:
I'm attempting to use the maven-bundle-plugin to accomplish this. I've used Embed-Dependency to get all my compile and runtime dependencies in the bundle, and I've used Embed-Transitive to embed all the transitive dependencies. I then figured out how to use excludeDependencies to exclude Maven dependencies from the BND classpath (they are moved to Private-Package in the Manifest), but for the life of me I can't figure out how to get it to exclude the transitive dependencies. …
我已经制作了一个小型API Bundle和一个应该使用API的服务包.
在我的maven pom.xml文件中,我在正确的版本中添加了对我的api包的依赖,如下所示:
<dependency>
<groupId>at.foobar.osgi.api</groupId>
<artifactId>foobarapi</artifactId>
<version>1.0</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
我正在使用maven-bundle插件来创建捆绑包,因为我mvn clean install以前用jar文件创建.Manifest看起来像这样(服务):
Manifest-Version: 1.0
Private-Package: at.foobar.osgi.producer
Built-By: foobar
Tool: Bnd-0.0.238
Bundle-Name: foobarproducer
Created-By: Apache Maven Bundle Plugin
Bundle-Version: 1.0
Build-Jdk: 1.6.0_26
Bnd-LastModified: 1332185439257
Bundle-ManifestVersion: 2
Bundle-Activator: at.foobar.osgi.producer.Activator
Import-Package: at.foobar.osgi.api,org.osgi.framework;version="1.4"
Bundle-SymbolicName: at.foobar.osgi.producer.foobarproducer
Run Code Online (Sandbox Code Playgroud)
这对我来说似乎没问题.进口就在那里,所以一切都应该没问题.
现在我启动了equinox并安装了API和生产者包.然后我启动API,这很好.但是,当我想启动Producer服务时,我收到此错误:
org.osgi.framework.BundleException: The bundle "at.foobar.osgi.producer.foobarproducer_1.0.0 [4]" could not be resolved. Reason: Missing Constraint: Import-Package: at.foobar.osgi.api; version="0.0.0"
Run Code Online (Sandbox Code Playgroud)
看来框架找不到api,但是它的安装和启动?
我正在创建一个将数据从一个活动传输到另一个活动的意图,如下所示:
Intent intent = new Intent(this, ActivityHighScore.class);
intent.putExtra("USERNAME", username);
intent.putExtra("PLAYERMOVES", playerMoves);
this.startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
然后我想检查活动开始时是否存在所有这些数据,因为它可以从其他来源启动而不设置此数据.我正在使用这个声明:
Bundle bundle = getIntent().getExtras();
if (!bundle.getString("USERNAME").equals(null) && bundle.getInt("PLAYERMOVES") != 0){
String username = bundle.getString("USERNAME");
int playerMoves = bundle.getInt("PLAYERMOVES");
addHighScore(username, playerMoves);
}
Run Code Online (Sandbox Code Playgroud)
但这导致了一个无效的pointerexception,我完全确定如何.我以为我正在处理Strings和.equals(),但我认为......任何帮助都会非常感激.谢谢.
ClassCastException随机发生以恢复onRestoreInstanceState()中的Vector.通常,恢复向量很好,但有时会发生异常.
我认为它发生在活动进入后台并被破坏但我不确定.
有任何想法吗?谢谢.
Stack<LocationInfo> mLocationInfoVector;
@Override
protected void onSaveInstanceState(Bundle outState) {
outState.putSerializable("locationInfos", mLocationInfoVector);
super.onSaveInstanceState(outState);
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
if (savedInstanceState.getSerializable("locationInfos") != null) {
@SuppressWarnings("unchecked")
mLocationInfoVector= (Stack<LocationInfo>) savedInstanceState.getSerializable("locationInfos");
}
super.onRestoreInstanceState(savedInstanceState);
}
Run Code Online (Sandbox Code Playgroud)
添加:
我忘了附上异常日志.那是
java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.util.Stack
Run Code Online (Sandbox Code Playgroud) 我可以使用下面的ASP.NET MVC成功地包含带有ScriptBundle的jquery库
bundles.Add(new ScriptBundle("~/bundles/jquery").Include("~/Scripts/jquery-1.7.1.js"));
Run Code Online (Sandbox Code Playgroud)
但是,如果我更改为最小化库,我无法从浏览器中获取它
bundles.Add(new ScriptBundle("~/bundles/jquery").Include("~/Scripts/jquery-1.7.1.min.js"));
Run Code Online (Sandbox Code Playgroud)
代码有什么问题吗?
我创建了一个JavaFX应用程序,并使用Ant创建了它的本机包.当我尝试使用双击创建的包中的Jar启动应用程序时,它成功启动了我的应用程序.但是,当我尝试双击MyApplication.exe(比如说)时,它会抛出JavaFX Launcher Error"运行Application时出现异常".
我比较了两个jre,有很多缺少jar,exe,dll和我发现的一些属性文件.
我有这些环境设置 -
JAVA_HOME -- C:\Program Files\Java\jdk1.7.0_10
JREFX_HOME -- C:\Program Files\Oracle\JavaFX 2.2 Runtime
Path contains an entry of C:\Program Files\Java\jdk1.7.0_10\bin
Run Code Online (Sandbox Code Playgroud)
在我的build.xml中使用JAVA_HOME和JREFX_HOME来获取ant-javafx.jar和jfxrt.jar -
${env.JAVA_HOME}/lib/ant-javafx.jar
${env.JREFX_HOME}/lib/jfxrt.jar
Run Code Online (Sandbox Code Playgroud)
我创建包的步骤是 -
<target name="CreatingExe" depends="SignedJar">
<fx:deploy width="800" height="600" nativeBundles="all" outdir="${OutputPath}" outfile="${app.name}">
<fx:info title="${app.title}"/>
<fx:application name="${app.title}" mainClass="${main.class}"/>
<fx:resources>
<fx:fileset dir="${OutputPath}" includes="*.jar"/>
<fx:fileset dir="${WorkingFolder}/temp"/>
</fx:resources>
</fx:deploy>
</target>
Run Code Online (Sandbox Code Playgroud)
build.xml中还需要什么才能使应用程序正确启动exe?
谢谢
有点卡在这里,
我更改了我的应用程序的名称,将在设备上的图标下显示的位,包标识符对吗?我想向我的应用程序提交更新,但现在我的包标识符不同,并且没有可选择验证/分发的代码签名标识配置文件.如果标识符不同,我该如何提交我的应用程序?
真的很困惑
任何帮助将非常感激
谢谢
要将相对图像路径转换为绝对路径,有很多问题需要在stackoverflow中提出并回答,如下所示:
建议添加new CssRewriteUrlTransform()如下:
bundles.Add(new StyleBundle("~/Content/css/jquery-ui/bundle")
.Include("~/Content/css/jquery-ui/*.css", new CssRewriteUrlTransform()));
Run Code Online (Sandbox Code Playgroud)
这实际上已经救过我了.但是现在我将我的网站部署到应用程序(不是网站的根目录),仍然存在一个问题:
申请是:
http://localhost/sample/
Run Code Online (Sandbox Code Playgroud)
但图片网址如下:
http://localhost/css/imgs/spirit.png
Run Code Online (Sandbox Code Playgroud)
虽然它应该是:
http://localhost/sample/css/imgs/spirit.png
Run Code Online (Sandbox Code Playgroud)
虽然捆绑的CSS链接本身是正确和有效的.
bundle ×10
java ×4
osgi ×3
android ×2
maven ×2
ant ×1
asp.net ×1
asp.net-mvc ×1
css ×1
deployment ×1
equinox ×1
identifier ×1
ios ×1
javafx-2 ×1
javascript ×1
locale ×1
properties ×1
serializable ×1
struts2 ×1
xcode ×1