小编Gau*_*ral的帖子

java.lang.ClassFormatError:类文件中的重复方法名称和签名

我们正在将应用程序升级Weblogic 10.3.010.3.6.当我们尝试部署它时,我们得到错误:

 java.lang.ClassFormatError: Duplicate method name&signature in class file...
Run Code Online (Sandbox Code Playgroud)

经过进一步调查,我们发现问题是由如下代码引起的:

interface Foo{ 
    void foo();
}
interface Bar{ 
    void foo();
}
interface Baz extends Foo, Bar{}
BazEJB implements Baz....
Run Code Online (Sandbox Code Playgroud)

这导致在Baz中生成2个foo方法.... ELOImpl.class当我们尝试部署ear文件时会导致此错误.

明显的解决方法是删除此模式,但还有其他建议吗?我们这里是错误的还是应该被视为weblogic中的错误?

我们仍然在使用EJB 2这种模式Weblogic 8.1 and 10.3.0

java ejb weblogic java-ee

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

如何使用Cache Control和ETag设置http标头

我想在谷歌建议的joomla网站中使用Cache Control和ETag.但不知道该怎么做.我搜索了很多,但找不到任何可怕的例子.

任何人都可以告诉我该怎么做.. ??

对于缓存控制我已经找到了这个例子,但这是完整的语法.. ?? 以及将它放在文件<head>标签中的位置index.php??

另请告诉我ETag的语法以及编写它的地方.

etag joomla caching cache-control pagespeed

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

如何欺骗位置在Android上使用LocationClient和Geofences进行测试?

我一直在使用LocationClient并设置了一个Geofence,但不知道如何测试它.

问题来自于您无法在模拟器中运行应用程序,因为模拟器中不可用的LocationClient用途GooglePlayServices.你也不能使用MockLocations我所知道的,因为你MockLocations通过创建一个Provider来使用,并且LocationClient不允许你设置一个Provider.

那么......我该怎么测试我的Geofence?(除了上车......).

java gps android location

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

在android中使用dom解析器获取值列表

我必须开发一个Android应用程序.

这里我遵循以下xml格式.

<Product>
<product name="viki" productid="111">
<ProductType>
<producttype>Nokia</producttype>
<producttype>Samsung</producttype>
</ProductType>
</product>
</Product>
Run Code Online (Sandbox Code Playgroud)

在这里,我必须获得particluar product的产品类型.所以我写了以下代码:

    if(subCategoryChildNode.hasChildNodes()){
            // parse 'Subcategory' childs
        NodeList productNL = subCategoryChildElmt.getElementsByTagName("product");
        if(productNL.getLength() > 0){

        ArrayList<Product> productAL = new ArrayList<Product>();
        Product productBean = null;
        for(int pCnt=0;pCnt<productNL.getLength();pCnt++){
            Node productNode = productNL.item(pCnt);

            Element productElmt = null;
            // parse 'product' tag attributes 
            if(productNode.hasAttributes()){
                productBean = new Product();
                productElmt = (Element)productNode;
                productBean.setmProductName(productElmt.getAttribute("name"));
            }
            if(productNode.hasChildNodes()){
                NodeList productTypeNL = productElmt.getElementsByTagName("ProductType");
                if(productTypeNL.getLength() > 0){
                    ArrayList<ProductType> ProductTypeAL = new ArrayList<ProductType>();
                    ProductType productTypeBean = null;
                    for(int ptCnt=0;ptCnt<productTypeNL.getLength();ptCnt++){
                    Node …
Run Code Online (Sandbox Code Playgroud)

java android xml-parsing domparser

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

打印功能无法在chrome中使用

我的网站上有一个print()函数,用于打印网站的特定部分.它工作正常Firefox,甚至开启,Internet explorer但不是在使用chrome.它会打开对话框窗口并获取页面计数,但无法获取内容(以chrome格式).

我的代码如下:

<a href="#" onclick="PrintElem('#press_releas11')"><img src="images/print_icon.png" width="35" height="23" /></a>

<div class="blog_post" id="press_releas11">
    <div class="post_title"><h3>title here</h3></div>
    <div class="post_article">content here</div>
</div>
Run Code Online (Sandbox Code Playgroud)

脚本:

<script type="text/javascript">

function PrintElem(elem)
{
    Popup($(elem).html());
}

function Popup(data) 
{
    var mywindow = window.open('', 'my div', 'height=400,width=600');
    mywindow.document.write('<html><head><title>PressReleases</title>');
    mywindow.document.write('<link rel="stylesheet" href="css/main.css" type="text/css" />');
    mywindow.document.write('</head><body >');
    mywindow.document.write(data);
    mywindow.document.write('data');
    mywindow.document.write('</body></html>'); 

    mywindow.document.close(); // necessary for IE >= 10
    mywindow.focus(); // necessary for IE >= 10

    mywindow.print();
    mywindow.close();

    return true;
}

</script>
Run Code Online (Sandbox Code Playgroud)

html javascript google-chrome

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

从JNI调用main方法失败

我创建了一个C++类,应该Main.main通过以下方式调用:http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/invocation.html#wp9502.

我没有让它工作所以我遵循:http://www.coderanch.com/t/525082/CPP/create-JVM-native-code-call

并且:

imp_JNI_Crea"> http://www.codeproject.com/Questions/263687/Linker-error-undefined-reference-to- imp _JNI_Crea

这些都没有奏效.所以我把我的代码改回了oracle所说的Invocation API文章(第一个链接).

我的C++代码如下所示:

在JNI.hpp文件中:

#include <jni.h>
#include <windows.h>
#include <iostream>

class Jvm
{
private:
    JavaVM* jvm;
    JNIEnv* env;
    JavaVMInitArgs jvm_args;
    JavaVMOption* options;

public:
    Jvm();
};
Run Code Online (Sandbox Code Playgroud)

在JNI.cpp文件中:

Jvm::Jvm()
{
    options = new JavaVMOption[3];

    options[0].optionString = "-Djava.compiler=NONE";
    options[1].optionString = "-Djava.class.path=C:/Users/Brandon/Documents/NetBeansProjects/Loader/build/classes";
    options[2].optionString = "-verbose:class";

    jvm_args.version = JNI_VERSION_1_6;
    jvm_args.nOptions = 3;
    jvm_args.options = options;
    jvm_args.ignoreUnrecognized = false;

    //JNI_GetDefaultJavaVMInitArgs(&jvm_args);
    JNI_CreateJavaVM(&jvm, reinterpret_cast<void**>(&env), &jvm_args);

    jclass MainClass = env->FindClass("loader.Main");


    //Crashes on the …
Run Code Online (Sandbox Code Playgroud)

c++ java java-native-interface jvm

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

如何使用整数值作为分隔符进行爆炸

我在这样的PHP中得到一个字符串值 -

How are you|1 I am fine|2 That is fine|3
Run Code Online (Sandbox Code Playgroud)

我想将此字符串分隔符转换为此整数值.基本上我需要这3个值.

How are you|1 
I am fine|2 
That is fine|3
Run Code Online (Sandbox Code Playgroud)

任何人都可以建议我能做些什么.

php substring explode delimiter

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

Java中的计时器

我正在尝试Thread.sleep()用java swing计时器替换,因为我听说这对于图形更好.

之前,我有这样的设置,但它干扰了图形.

while(counter < array.size){
Thread.sleep(array.get(counter).startTime);
//do first task
Thread.sleep(array.get(counter).secondTime);
//do second task
Thread.sleep(array.get(counter).thirdTime);
//do third task
counter++
}
Run Code Online (Sandbox Code Playgroud)

现在,我正在尝试Thread.sleep()用其中一个替换每个,然后我有在此之后发生的实际事件,但它似乎根本没有等待.

int test = array.get(counter).time;
ActionListener taskPerformer = new ActionListener(){
public void actionPerformed(ActionEvent evt){
}
};
Timer t = new Timer(test, taskPerformer);
t.setRepeats(false);
t.start();
Run Code Online (Sandbox Code Playgroud)

基本上,我如何确保程序等待而不给它任何代码在计时器内执行?谢谢!

java swing multithreading sleep timer

-1
推荐指数
1
解决办法
686
查看次数