Eric Cornely

Greenhorn
+ Follow
since Aug 03, 2011
Eric likes ...
Eclipse IDE Java Linux
Merit badge: grant badges
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Eric Cornely

Thanks a lot for that clear explanation.

Ramy Nady wrote:
I don't completely understand what exactly you mean by sharing instance in multiple threads , what ever situation you have container ensure that ONLY one thread can access any bean instance at the same time.



What I mean is I do a single JNDI lookup to obtain one reference of a SLSB in the client and pass that reference to many threads running concurrently. Then what does the server do ?
Is it using different server instances concurrently or using any kind of lock as you confirmed it ensures one instance is not used by many thread at a time.

I don't have time to explain a lot but you should have a look to @Embedded in JPA specification I think it could help you.

EDIT: Sorry this was the opposite having multiples objects mapped to one table
Well this should work but as you state something about admins... shouldn't you implement any kind of security ?

In you web.xml you add security constraints (why not a basic authentication or form based), configure the server with a Realm of any kind (often a properties file) and in the servlet use the request.getUserPrincipal() to know which admin is logged.

Then I would prefer a database or any kind of file to store the admin specific values rather than the web.xml but it's up to you...

Let's imagine something like this.getClass().getResourceAsStream("/"+request.getUserPrincipal()+"_config.properties") than you can have any number of properties files in your war corresponding to the admin user name and you validate its right in the container realm.
9 years ago
Hello,

I'm trying to understand the concurrent model of each EJB session bean types.

The singleton is well documented and seems clear to me... Only one instance and many threads using it but each method by default is synchronized because @Lock is defaulted to WRITE. We can let multiple threads use on method with @Lock(READ).

The stateless beans are in a pool I think I read somewhere that the container will ensure only one thread is using one instance at a time but this instances are recycled/reused so many threads can use the same instance but one at a time.
  • Is this correct ? or is it possible that multi-threading occur in one instance of SLSB ?
  • If in the client I obtain a single reference of a SLSB and share this "instance reference" in multiple threads is it true that all the threads could use different instances on the server side ?


  • The stateful instance I obtain in the client is linked to one server instance and any method call will target the same instace. If many threads are using the same reference, all method calls will be synchronized and waiting for a certain amount of time that can be defined in @AccessTimeout and if the timeout is reach will end with a ConcurrentAccessException.
  • Can we use @Lock(READ) and let many thread use the same method like in a singleton ?


  • Many thanks for your help

    Hello,

    I'm trying to migrate a big application from JBoss 5 to JBoss 7.

    The Jboss 5 was configured with many diffrent datasources, activeMQ and Jackrabbit so what I first did is creating a really simple web application (single war) using all those resources just to write their instance in a servlet assuring myselft that the server configuration for the resources was ok.

    Here's the web.xml : http://pastebin.com/BbRwbyvL
    the jboss-web.xml : http://pastebin.com/ipLZnq0y
    the jboss-deployment-structure.xml : http://pastebin.com/uKm8SQbx

    And it works perfectly well.


    But when I try to deploy the real big application wich is a ear file here's the error I get :

    16:29:14,889 DEBUG [org.jboss.security] (MSC service thread 1-2) PBOX000307: Constructing JBossPolicyConfiguration with contextID EtrmIppEar-48.0-SNAPSHOT.ear!Etrm-48.0-SNAPSHOT.war
    16:29:14,889 DEBUG [org.jboss.as.security] (MSC service thread 1-2) Cannot create permissions with 'null' metaData for id=EtrmIppEar-48.0-SNAPSHOT.ear!Etrm-48.0-SNAPSHOT.war
    16:29:14,905 INFO [org.jboss.web] (ServerService Thread Pool -- 57) JBAS018210: Register web context: /Etrm
    16:29:14,905 DEBUG [org.jboss.security] (MSC service thread 1-3) PBOX000307: Constructing JBossPolicyConfiguration with contextID EtrmIppEar-48.0-SNAPSHOT.ear!EtrmPortal-48.0-SNAPSHOT.war
    16:29:14,905 DEBUG [org.jboss.as.security] (MSC service thread 1-3) Cannot create permissions with 'null' metaData for id=EtrmIppEar-48.0-SNAPSHOT.ear!EtrmPortal-48.0-SNAPSHOT.war
    16:29:14,905 INFO [org.jboss.web] (ServerService Thread Pool -- 56) JBAS018210: Register web context: /EtrmPortal
    16:29:14,920 DEBUG [org.apache.catalina.startup] (ServerService Thread Pool -- 57) Pipeline Configuration:
    16:29:14,920 DEBUG [org.apache.catalina.startup] (ServerService Thread Pool -- 57) org.apache.catalina.core.ValveBase/1.0
    16:29:14,920 DEBUG [org.apache.catalina.startup] (ServerService Thread Pool -- 57) org.apache.catalina.core.StandardContextValve/1.0
    16:29:14,920 DEBUG [org.apache.catalina.startup] (ServerService Thread Pool -- 57) ======================
    16:29:14,920 DEBUG [org.apache.catalina.session] (ServerService Thread Pool -- 57) Registering null
    16:29:14,920 DEBUG [org.apache.catalina.startup] (ServerService Thread Pool -- 56) Pipeline Configuration:
    16:29:14,920 DEBUG [org.apache.catalina.startup] (ServerService Thread Pool -- 56) org.apache.catalina.core.ValveBase/1.0
    16:29:14,920 DEBUG [org.apache.catalina.startup] (ServerService Thread Pool -- 56) org.apache.catalina.core.StandardContextValve/1.0
    16:29:14,920 DEBUG [org.apache.catalina.startup] (ServerService Thread Pool -- 56) ======================
    16:29:14,920 DEBUG [org.apache.catalina.session] (ServerService Thread Pool -- 56) Registering null
    16:29:15,108 ERROR [org.apache.catalina.core] (ServerService Thread Pool -- 57) JBWEB001103: Error detected during context /Etrm start, will stop it
    16:29:15,514 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 57) MSC00001: Failed to start service jboss.web.deployment.default-host./Etrm: org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./Etrm: org.jboss.msc.service.StartException in anonymous service: JBAS018040: Failed to start context
    at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:96)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [rt.jar:1.6.0_35]
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [rt.jar:1.6.0_35]
    at java.util.concurrent.FutureTask.run(FutureTask.java:138) [rt.jar:1.6.0_35]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_35]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_35]
    at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_35]
    at org.jboss.threads.JBossThread.run(JBossThread.java:122)
    Caused by: org.jboss.msc.service.StartException in anonymous service: JBAS018040: Failed to start context
    at org.jboss.as.web.deployment.WebDeploymentService.doStart(WebDeploymentService.java:161)
    at org.jboss.as.web.deployment.WebDeploymentService.access$000(WebDeploymentService.java:60)
    at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:93)
    ... 7 more

    16:29:15,655 ERROR [org.apache.catalina.core] (ServerService Thread Pool -- 56) JBWEB001103: Error detected during context /EtrmPortal start, will stop it
    16:29:15,702 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 56) MSC00001: Failed to start service jboss.web.deployment.default-host./EtrmPortal: org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./EtrmPortal: org.jboss.msc.service.StartException in anonymous service: JBAS018040: Failed to start context
    at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:96)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [rt.jar:1.6.0_35]
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [rt.jar:1.6.0_35]
    at java.util.concurrent.FutureTask.run(FutureTask.java:138) [rt.jar:1.6.0_35]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_35]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_35]
    at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_35]
    at org.jboss.threads.JBossThread.run(JBossThread.java:122)
    Caused by: org.jboss.msc.service.StartException in anonymous service: JBAS018040: Failed to start context
    at org.jboss.as.web.deployment.WebDeploymentService.doStart(WebDeploymentService.java:161)
    at org.jboss.as.web.deployment.WebDeploymentService.access$000(WebDeploymentService.java:60)
    at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:93)
    ... 7 more

    16:29:15,920 DEBUG [org.jboss.as.osgi] (Controller Boot Thread) BundleContext not available for management operation



    Does someone have any idea on how I could get more information on what's going wrong ?

    (I just have to say that I tried with Dependencies, Class-Path, etc. ended-up with using a jboss-deployment-structure.xml for the ear file but when I just not require the javax.jcr module at all I have a ClassNotFoundException)
    11 years ago
    Hello,

    I'm working on a project with Spring 2.5.6 and Hibernate 3.6.3. In every environment we're using sequences to generate Integer id for all our entities so :



    But in my unit tests I'd like to use an in memory database like HSQL-DB and use an auto_increment so I would need to replace it by @GeneratedValue(strategy=GenerationType.IDENTITY).

    How can I override that annotation only for unit tests ?

    I'm already having a different spring configuration so I probably should be able to initialize a session factory that read XML definitions instead of annotations but how ?

    Here is the spring configuration for my sessionFactory :


    It's seems that I can easily override it according to that : http://docs.jboss.org/hibernate/annotations/3.5/reference/en/html/xml-overriding.html but how could I configure spring to configure hibernate so that it reads those files ?
    Hello,

    I'm trying to understand the ViewHelper Design Pattern and i developped a very simple application with a JSP which present a list of student information as a table.

    I found different ways of passing data to my view and wonder which one could be the correct implementation of a ViewHelper.

    First thing i did was using <jsp:useBean> to access a bean which has a getStudents() method.
    The second i tried was creating a servlet which add a "students" attribute to the request than dispatch to the jsp (view).
    If I understand the blueprints i could also create a tag library.

    What would be the right code to access data and prepare correct Data Transfer Objects in thoses different strategies ?

    Until now i thought about direct JDBC connection, DataSource lookup, found a way to lookup a named EntityManager but what would be the best one ?

    There could be also the business EJB lookup and then filter data to create DTOs but should give less performance as I would get all information to filter them. I prefer filtering in the query directly. Could'nt my EntityManager be considered in that case as my business tier ?

    I know there are lots of possibilities but my concern is finding the best one and/or the one that suites best the blueprint ViewHelper design pattern.

    Thank you.
    I agree that it's probably comming from social pressure and things like that but i'm from Beligum and we have so many different beers here that it's impossible no finding one with a taste you like.

    You have fruity beers, strong brown beers but also sweet and strong brown beers, blond beers, white beers, ... and my favourite ones are the triple which are blond sweet and strong beers.

    More than this, if you compare to other alcohols beer is one of the most easy to digest.

    You can drink a lot of beer feeling you thirst disappear before feeling ill or drunk.
    12 years ago
    Hello,

    I'm learning EJB 3.0 and need to get an application working both on glassfish and weblogic.

    I developped a very simple stateless session bean and until now just tried to look it up using jndi in a console client.

    I got it working once when specifying @Stateless(mappedName="TestBean") and noticed that for glassfish the mappedName can be use to lookup my bean and in weblogic i need to add "#" and the @Remote qualified name.

    Now the question is what would be the mappedName of a bean if i only use @Stateless ?

    In glassfish, you can access such a bean simply using it's qualified name but what about weblogic ?

    I deployed my bean in weblogic with just @Stateless and browsed the JNDI tree but all i can see is /StatelessSessionBeanStatelessSessionBean_jarTestBean_Home which cannot be casted in my @Remote TestBeanRemote.

    Is it possible to lookup an ejb when not specifying any mappedName when using weblogic ?


    Remark: i'm using glassfish 3.0.1, weblogic 11g (10.3.4.0), JDK 1.6, eclipse
    12 years ago