小编Hel*_*llo的帖子

在双节点wildfly集群中调用远程ejb

我试图在节点node1和node2的集群的每个节点上调用远程ejb,但我总是得到node1.在两个节点中将EJB和客户端代码部署为EAR文件.应用程序在Wildfly 9 ApplicationServer上运行.从node1调用客户端代码.

EJB代码:

@Remote
public interface SLSBRemote {
    public void test();
}

@Stateless(mappedName="SLSBEJB")
public class SLSBEJB implements SLSBRemote {
    @Override
    public void test() 
    {
       try {
          String nodeName = System.getProperty("jboss.node.name");
          if(nodeName == null) {
             nodeName = InetAddress.getLocalHost().getHostName();
          }
          log.debug("nodename: "+nodeName);
       } catch (Exception e) {
          log.error("Error",e);
       }
    }
}
Run Code Online (Sandbox Code Playgroud)

客户代码:

public class testEjb
{
    //invoking this method from other class. Able to pass node address
    public void testBean(List<String> nodes)
    {
       Properties properties = new Properties();
       properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
       Context …
Run Code Online (Sandbox Code Playgroud)

java remote-access java-ee ejb-3.1 wildfly-9

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

如何在visual studio 2010 Express Edition上启用C++ 11编译器?

我正在使用tbb :: parallel_for函数,它使用lambdas.我使用以下代码获得语法错误:

void parallel_relax( Class object, std::vector<Vertex *> verList ) {
    tbb::parallel_for (blocked_range<int>(0, verList.size()), [=](const blocked_range<Vertex *>& r) {
        for(Vertex *vit = r.begin(); vit != r.end(); ++vit) {
            Vertex *v = vit;
            object.function(v);
        }
    });
}
Run Code Online (Sandbox Code Playgroud)

语法错误:

syntax error : '['
1>main.cpp(16): error C2143: syntax error : missing ')' before '{'
1>main.cpp(16): error C2143: syntax error : missing ';' before '{'
1>main.cpp(17): error C2065: 'r' : undeclared identifier
1>main.cpp(17): error C2228: left of '.begin' must have class/struct/union
1>          type …
Run Code Online (Sandbox Code Playgroud)

c++ tbb visual-studio-2010 visual-c++ c++11

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

EJB 调度程序服务无状态与单例

我的应用程序有一个调度程序,需要每 10 秒运行一次以从数据库中提取新记录。我已经按照本指南实现了 ejb 调度程序服务,该服务运行良好。hit() 方法没有客户端,它应该仅作为调度程序运行。

仅单例方法,

@Singleton
@Startup
public class DataFetcherService {
    @Schedule(second="*/10", minute="*", hour="*", persistent=true)
    public void hit() {
           //do some stuff
           fetchData();
    }
    public void fetchData() {
          //Fetch new records from the database through DAO objects
    }
}
Run Code Online (Sandbox Code Playgroud)

如果我用@stateless替换@singleton有什么区别吗?请建议

更新:无状态方法,

@Singleton
@Startup
public class DataFetcherService {
    @EJB
    DataFetcherBean dataFetcherBean;
    @Schedule(second="*/10", minute="*", hour="*", persistent=true)
    public void hit() {
           dataFetcherBean.fetchData();
    }  
}
@Stateless
public class DataFetcherBean { 
    public void fetchData() {
          //Fetch new records from the database …
Run Code Online (Sandbox Code Playgroud)

scheduler ejb-3.1 jakarta-ee

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

为什么我的 Maven 指向旧的中央存储库 url?

我在通过 Maven 安装下载依赖项 jar 时遇到问题。

从 Eclipse 控制台,我可以说 maven 正在尝试从旧的中央存储库 url 下载 jar:“ https://repo.maven.apache.org/maven2 ”而不是“ http://repo1.maven.org/maven2/

我的 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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.xxxx</groupId>
  <artifactId>TestServices</artifactId>
  <version>7.0.3.6</version>
  <dependencies>
    <dependency>
        <groupId>javax.activation</groupId>
        <artifactId>activation</artifactId>
        <version>1.0.2</version>
        <scope>compile</scope>
    </dependency>
  </dependencies>
Run Code Online (Sandbox Code Playgroud)

我的构建失败并出现以下错误消息:

[ERROR] Failed to execute goal on project 'xxxyyy': Could not resolve dependencies for project xxxyyy:jar:4.0.3.6: The following artifacts could not be resolved: org.codehaus:xstream:jar:1.3.1, gxs:ai:jar:0.5, javax.activation:activation:jar:1.0.2, com.oracle.jdbc:classes12:jar:9.2.0.5, org.eclipse.core:resources:jar:3.1.0, org.eclipse.core:runtime:jar:3.2.0.v20060603, org.eclipse.emf:common:jar:2.2.1.v200609210005, org.eclipse.emf:ecore:jar:2.2.1.v200609210005, org.eclipse.emf:ecore.xmi:jar:2.2.1.v200609210005, org.eclipse.equinox:common:jar:3.2.0.v20060603, org.eclipse:osgi:jar:3.2.1.R32x_v20060919, org.eclipse.wst.xml:core:jar:1.1.1.v200609210600, org.eclipse:xsd:jar:2.2.1.v200609210005, javax.mail:mail:jar:1.3.2, org.apache:log4j:jar:1.2.8: Failure to find org.codehaus:xstream:jar:1.3.1 in ${localRepo} …
Run Code Online (Sandbox Code Playgroud)

java eclipse maven

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

Web服务提供者和消费者之间的证书机制

服务器和客户端在Web服务调用中放置ssl证书机制的确切步骤是什么?谁(客户端/服务器/两者)将生成.keystore,.p7b/.cer文件?我google了很多但找不到答案.就我而言,我是运行java应用程序的客户端,它使用soap webservice调用.我有一个由WebService提供者提供的.p7b文件.我知道在哪里放置文件(.keystore,.cer)以及如何在应用程序中使用它.

但是,我的问题是

  1. 我是否需要生成密钥库文件,还是应该从Web服务提供商处获取?如果我需要生成,怎么样?我需要私钥/密码吗?
  2. 我需要一个.cer文件,那么如何使用keytool将.p7b转换为.cer文件?

提前谢谢你的帮助.

java ssl web-services ssl-certificate

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

sed命令在solaris中工作,但在Linux中不工作

我是shell脚本和sed命令的新手.

以下sed命令在Solaris中有效但在Linux中出错:

sed -n 's/^[a-zA-z0-9][a-zA-z0-9]*[ ][ ]*\([0-9][0-9]*\).*[/]dir1[/]subdir1\).*/\2:\1/p'
Run Code Online (Sandbox Code Playgroud)

错误是:

sed: -e expression #1, char 79: Invalid range end
Run Code Online (Sandbox Code Playgroud)

我不知道为什么它会给出无效的范围结束错误.

regex linux bash shell sed

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

在 Jboss7 或 Wildfly 上访问多个 Web 应用程序

我知道我们可以在 JBoss 7 或 Wildfly 上部署多个 Web 应用程序。但是我们如何使用不同的端口访问不同的 Web 应用程序呢?我们在哪里为 Web 应用程序设置该端口?

例如,

  • application1 可在 xxxx:8080 上访问
  • application2 可在 xxxx:30000 上访问
  • application3 可在 xxxx:35000 上访问

jboss7.x wildfly wildfly-8 wildfly-9 wildfly-10

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

英特尔TBB concurrent_queue如何工作?它是否实现了细粒度的并行性?

我是英特尔TBB的新手.我正在使用concurrent_queue,以便在我的项目中实现细粒度的并行性.我几乎没有怀疑.这就是我的实施方式.

   thread_fun(arguments) {
      while(concurrent_queue.try_pop(v))
          operation on v;  //each thread executes its own operation(seperate v for each thread)
   }
   main() {
      for(..)
         concurrent_queue.push(); //fill the queue
      _beginthreadex(..); //create 8 win32 threads and pass concurrent_queue as an argument
   }
Run Code Online (Sandbox Code Playgroud)
  1. 我明确提到了线程的数量.我读到TBB将根据处理器核心数创建线程.我怎样才能实现这一目标?所以我不需要使用_beginthreadex函数显式创建线程?

  2. 我是否通过使用concurrent_queue实现了细粒度的并行性?

  3. 任务级并行性是什么意思?你如何用intel tbb实现任务级并行?我从队列中弹出元素.流行操作是否被视为一项任务?这意味着,所有弹出操作都被视为不同的任务.我用8个线程一次弹出8个元素.这意味着,我正在实现任务级并行性.我对么?

  4. 如果我在四核处理器(支持8个线程)上将线程数增加到32,那么concurrent_queue如何工作?是否只有8个线程同时在队列上执行或共32个线程同时执行?

请帮我.

c++ parallel-processing multithreading intel tbb

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

如何使 MDB 激活规范上下文属性可配置?

在我们的项目中,我们正在使用一个 MDB 来侦听特定队列上的消息。它被定义为注释。

例子:

@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "maxSessions", propertyValue = "20")})
Run Code Online (Sandbox Code Playgroud)

.

为了更改 maxSessions 的值,每次都必须编译代码。即使我在 ejb-jar.xml 中配置它而不是作为注释,我也需要编译代码并生成 EAR 文件。

有没有办法让它用户可配置(从属性文件中读取),以便不需要重新编译代码,只需将 maxSession 值更改为“30”并重新启动 jboss,它应该可以工作。

请帮忙。

参考代码:

@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "ABCQueue"),
@ActivationConfigProperty(propertyName = "maxSessions", propertyValue = "20"),    @ActivationConfigProperty(propertyName="maxMessagesPerSessions",propertyValue="15")})
public class ABCMDB implements MessageListener
{
   ----------- 
}
Run Code Online (Sandbox Code Playgroud)

java jms jboss-mdb wildfly

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

如何定义指向类成员函数的指针

与C++基础知识相关.我正在创建一个单链表.

class Linked_List
{
public: Linked_List();
    ~Linked_List();
        //Member Functions
    struct node* getHead(void);
private:
    struct node{
        int d;
        struct node* next;
    }*head;
};
struct node (Linked_List::*getHead)(void)
{
    return head;
}
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

"错误C2470:'getHead':看起来像一个函数定义,但没有参数列表;跳过明显的主体".

我试图在谷歌搜索,但没有用.任何建议PLZ.

c++ visual-studio-2010

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

子弹不显示<ul>

项目符号未显示.当我通过jsFiddle尝试相同时,它的工作原理.可能是什么原因?

         <div id="mainInfo" style="display: none;" title="Customer Information">
            <div id="greenCheck" style="display: none;">
                <img src= "IMAGE_SOURCE">
            </div>
            <div id="subInfo" style="display: none;">
            </div> 
         </div>
         <div>
            //button definition onclick="show()"![enter image description here][1]
         </div>

//javascript
function show() 
{
    var htmlstr = "<p><b>The customer provided the following:</b></p><br/><ul>";
    if(true)//some condition which i made true for testing
        {
             htmlstr = htmlstr + "<li>Date of Birth</li>";
             htmlstr = htmlstr + "<li>Social Security Number</li>";
        }
        htmlstr = htmlstr + "</ul>";
        document.getElementById('mainInfo').style.display = 'block';
        document.getElementById('greenCheck').style.display = 'block';
        document.getElementById('subInfo').style.display = 'block';
        jQuery("#subInfo").html(htmlstr); …
Run Code Online (Sandbox Code Playgroud)

html css jquery jquery-ui

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