EJB - MDB and Session and Entity - Seem to always run under same Thread
I am working on an application that implemets a connection from an MDB to a Session EJB which inturn connects to a Entity EJB. All connections are impemented as Local Home. I use log4j for tracing and notice that the thread ID reported for all activity is the same "Thread ID: MessageListenerThreadPool : 0" .
This confuses me because I thought that all EJB's would execute under different threads. Have I done something wrong? Have I missinterpreted the EJB implementation? Any opinions would be greatly appreciated!!
Hi Kelly,
This is a slight misinterpretation of the EJB threading requirements. There are a couple different issues as play here. First, the main threading guarantee made by the spec is that a particular instance of an EJB will not be invoked by the container on more than one thread at a time. This is one of the guarantees that simplifies the EJB programming model so that developers don't have to do anything special (e.g. the use of synchronized blocks) to handle concurrent access. Second, the EJB Local programming model requires that invocations have pass-by-reference semantics. Of course, the easiest way for the container to provide that behavior is to literally make the local invocation on the same thread.
The call-flow you're describing touches a single instance from three different beans, so the threading guarantee is not violated. Hope that clears things up a bit.
--ken
Similar Messages
-
I recently updated? to Lion from 10.6.8(snow leopard), and things seem to be running slower. Has anyone had similar problems? I have Feb 2011 Macbook pro 13" 2.3 Ghz.
As Shootist pointed out, the system uses more power.
However, initially it will reindex the hard drive for spotlight, which will slow things down temporarily.
It also must rebuild caches that eventually will speed things up.
If it has completed indexing the hard drive (no dot pulsing in the spyglass), then there might be something wrong.
Start by booting into the Recovery HD (a partition created with Lion that has Disk Utility and reinstallation options) by holding down cmd-r when you restart. You can let go when the gray screen appears.
When it boots, select Disk Utility and Repair the drive.
If that doesn't speed things up, try re-installing the OS from the same Recovery HD. It won't delete any of your files, but it has helped some people whose Macs ran slow after installing Lion.
Also, how much memory do you have? Lion needs RAM so maxing your Mac out might also help. -
I have a new ipad and a iphone 5 which are under same Apple ID. I lso have a macbook that uses an older apple ID. How can I get the macbook to have same Apple ID as the other 2 devices
Have a read here...
https://discussions.apple.com/message/18409815?ac_cid=ha
And See Here...
How to Use Multiple iDevices with One Computer -
My iPad 2 had trouble updating an app and now seems to be running slower
Earlier this evening, my iPad 2 had an app update notification for words with friends hd free. I clicked the update but everything stalled. It took forever to update the app and now my entire iPad seems to be running slow. I have tried resetting it, updating it to 4.3.2 and nothing seems to work. Should I perform a factory restore?
The whole iTunes store had issues all day, nothing was downloadable (video, apps,etc).
It had nothing to do with your iPad.
A reinstall should still put you at 4.3.2. -
Orion-ejb-jar works in oc4j, but seemingly ignored while running in jdev
I'm using OC4J 9.0.2.0 and JDeveloper 9.0.2.
I have a set of entity classes. I'm trying to map the entity name to a different table name, and map the field names to different column names.
I have an ejb-jar.xml that sets the ejb-name, and I have an orion-ejb-jar.xml that uses the ejb-name, specifies a "table-name", and uses "cmp-field-mapping" elements. The "table-name" and "cmp-field-mapping" elements do what I said, using a table name different from the ejb name, and db column names different from the field names.
When I build and deploy this in standalone OC4J, it works fine. It creates the exact table and column names that I specified.
Now, how the heck do I get this to work in JDeveloper 9.0.2? Is this impossible as of this version? I need to know this.
In JDeveloper, I can edit the orion-ejb-jar.xml file, and I can do the "Edit Settings" option, and that all looks correct, but when I finally run the embedded OC4J, it creates the wrong tables with the wrong attributes.I tried a simple test case and it seems to work fine
I create a entity bean by name "foo" with 2 fields "col1" (CMP PK) and "col2" (CMP field)
Select orion-ejb-jar.xml in project and right-click on it and choose settings
Select foo in the upper left hand items
Added table name on the right hand side "deployfoo"
Select CMP Field Mappings on the lower left hand side
Select col1 and in the persistence name add "firstcolumn"
Seelct col2 and in the persistence namd add "secondcolumn"
When I run the bean the table is created with the above name and columns
Message in log window
<<
Auto-creating table: create table deployfoo (firstcolumn VARCHAR2(255) not null primary key, secondcolumn VARCHAR2(255) null)
>>>
raghu
JDev Team -
Which version of Acrobat and Adobe Reader could be run under Win7
Someone tell me my plugin works fine under win7 with Acrobat 8,but others tell me not.
Also Adobe Reader seems not always works fine under win7 with my plugin under win7.
Anyone help me?Thanks,Bernd.
What about Acrobat 7 and 8?
I know the lates release of Adobe Reader/Acrobat can be run under windows 7. -
I have erased and restored my 24 inch Intel iMac. I have upgraded to the last version of X os. My system is running WAY slower than it was before. Even opening windows seems to lag and the spinning wheel come up for everything. Every task is slow, even typing this! lol
Here are my specs:
Model Name: iMac
Model Identifier: iMac8,1
Processor Name: Intel Core 2 Duo
Processor Speed: 2.8 GHz
Number Of Processors: 1
Total Number Of Cores: 2
L2 Cache: 6 MB
Memory: 4 GB
Bus Speed: 1.07 GHz
Boot ROM Version: IM81.00C1.B00
SMC Version (system): 1.30f1
Any ideas would be helpful. Is this a hardware issue?
Thanks!Matt:
Thanks for the update. It is good to know that the maintenance procedures helped. Regular maintenance and a good backup are key to computer security. Gulliver's article has a suggested schedule. Dr. Smoke's FAQ on Backup and Recovery has excellent information and advice. I part company with him on his insistence on Retrospect, which I have found to be difficult to use. SuperDuper has been shown the best backup software in these tests.
If you usually leave your computer on or asleep, it is good practice to shut down and start up in Safe Mode occausionally. I do it about once weekly.
Good luck.
cornelius
Message was edited by: cornelius -
What is, "Motion Calibration" and why is it always running?
I recently upgraded from a 4s to a 6 so a lot of things are new to me. But why is, "Motion Calibration" running 24/7 in Location Services? Won't that nuke my battery?
I think I might be able to answer this now, although it may be a little late in coming. The reason this setting was introduced was probably not to determine how many steps you take, but to correlate it more specifically to your distance. It must have been introduced when Apple started work on the Watch and realized they couldn't put GPS into it to measure distance running.
Instead, blurbs on Apple's site say that the watch learns what your stride is based on a few runs with your iPhone. Because there is no third-party app the Watch can tap into in order to measure this, this setting must have been placed there in order for a user to be able to have these measurements ready for when they do purchase and pair their Watch with their iPhone. The Watch would then be immediately able to access both walking and running distance that had been measured more accurately by the iPhone for months. If you deactivate it, you can still get a very accurate step count, but the distance is a guesstimate based on your height. With Location Services enabled, Apple can measure distance much better, and this aids the fitness experience in the Apple Watch. -
Shuffle mode seems to always play similar/same songs
I don't know if its my imagination but when I use shuffle mode it seems to play similar or the same songs. Often I don't hear a lot of the music I know is there (1500+ songs). I've tried just restarting shuffle a few times which seems to start a shuffle at a different point.
Does anyone know if shuffle changes its variety of songs when its used or does it tend to repeat the same shuffle sequence.
ThanksI don't think its your imagination, I have noticed this also. There are many posts about this issue.
I have created a smart playlist for Not Played, and I shuffle from that when I want to hear different music. -
EJB ACLs and permissions, help needed urgently
Hello,
I am using WL6.1. I need to use weblogic.security.acl.Security.checkPermission
to check if a user has permission to acess an EJB method. I know one can call
the method and check the exception to see yes or no. But that requires knowing
the method signature (parameters and return types etc.).
I read the documentation and here is what I got:
ACLs and permissions for WebLogic EJBs differ from ACLs and permissions for other
kinds of WebLogic Server resources in the following ways:
1. EJB ACLs are configured in the access control properties of the EJB's deployment
descriptor.
2. Permissions are granted on individual methods of a bean; there are no predefined
permissions.
3. Permissions on EJBs are granted to Roles, which map to groups in WebLogic Server.
So if I read it correctly:
1. One does not need to use WL console to configure EJB ACLs? If otherwise, how
do we do it?. There is no documentation for it.
2. What is the ACLName to use when I call the method weblogic.security.acl.Security.checkPermission(java.security.Principal
principal, java.lang.String aclName,
java.security.acl.Permission permission,
char sep)?
I tried with JNDI name and EJB name and nothing seems to work.
Can anyone help me out?
Thanks.
Ling WangIt all depends on where do you want to keep your ACLs and the rest of security.
Simplest will be fileRealm, but it has limited capability (10k ACLs I recall).
You do not heed console to set it up. Here is an excert from ACL file:
acl.read.OT_INTEGRATIONOBJREF=everyone
acl.read.OT_ORGTRANSPORT=OrgAdmin,AppAdmin
acl.read.OT_ORGUNITOFMEASURE=OrgAdmin,AppAdmin
# from nonWorkflowEvents.template
acl.execute.ET_QUERY=everyone
acl.execute.ET_BATCH=everyone
read/execute is action. Caps keep resource (name). On the right hand is a list
of roles. The security call will be lokking like:
boolean result = Security.hasPermission("ET_BATCH",
new PermissionImpl("read"), '.');
It does not throw, just returns a boolean.
Now, this is all about programmatic security. If you are up to declarative, you
need to assign role names to method names in deployment descriptor of your bean
and map them to actual roles.
Also you may have problems while asking security question about another principal
(nto the one currently logged in). Not that it does not work -- just needs caution.
Hope it helps.
"Ling Wang" <[email protected]> wrote:
>
Hello,
I am using WL6.1. I need to use weblogic.security.acl.Security.checkPermission
to check if a user has permission to acess an EJB method. I know one
can call
the method and check the exception to see yes or no. But that requires
knowing
the method signature (parameters and return types etc.).
I read the documentation and here is what I got:
ACLs and permissions for WebLogic EJBs differ from ACLs and permissions
for other
kinds of WebLogic Server resources in the following ways:
1. EJB ACLs are configured in the access control properties of the EJB's
deployment
descriptor.
2. Permissions are granted on individual methods of a bean; there are
no predefined
permissions.
3. Permissions on EJBs are granted to Roles, which map to groups in WebLogic
Server.
So if I read it correctly:
1. One does not need to use WL console to configure EJB ACLs? If otherwise,
how
do we do it?. There is no documentation for it.
2. What is the ACLName to use when I call the method weblogic.security.acl.Security.checkPermission(java.security.Principal
principal, java.lang.String aclName,
java.security.acl.Permission permission,
char sep)?
I tried with JNDI name and EJB name and nothing seems to work.
Can anyone help me out?
Thanks.
Ling Wang -
DBMS connection speed: Session vs Entity
Environment: WLS6.1 SP3, W2K, Oracle 8.1.7, OCI Driver
Hi,
we are experiencing performance problem when getting a connection from a
pool.
Getting a connection from a stateless session bean takes 300-500ms whereas
it takes 15ms
from an entity bean (local). Both session and entity beans are deployed in
the same ear.
In both cases we're getting the datasource using the following code snippet
Properties p = new Properties();
bla bla bla ...
Context ic = new InitialContext(p);
DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/XXX");
and
DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/YYY");
When getting the connection, we are experiencing the speed difference
described above.
connection conn = ds.getConnection();
Why do we have this difference? We have the reference to the datasource
already.
There is no further JNDI lookup. Is there something we are missing?
Thanks
Arnaud
Entity descriptor
<resource-ref>
<res-ref-name>jdbc/XXX</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Application</res-auth>
</resource-ref>
WLS specific
<reference-descriptor>
<resource-description>
<res-ref-name>jdbc/XXX</res-ref-name>
<jndi-name>jdbc/MyDataSource</jndi-name>
</resource-description>
</reference-descriptor>
Session descriptor
<resource-ref>
<res-ref-name>jdbc/YYY</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Application</res-auth>
</resource-ref>
WLS specific
<reference-descriptor>
<resource-description>
<res-ref-name>jdbc/YYY</res-ref-name>
<jndi-name>jdbc/MyDataSource</jndi-name>
</resource-description>
<ejb-local-reference-description>
<ejb-ref-name>ejb/XXX</ejb-ref-name>
<jndi-name>ejb/XXXLocal</jndi-name>
</ejb-local-reference-description>
</reference-descriptor>Hi Arnaud,
"Arnaud Benjacar" <[email protected]> wrote in message news:[email protected]...
<JDBCConnectionPool DriverName="oracle.jdbc.driver.OracleDriver"
InitialCapacity="5" MaxCapacity="10" Name="myPool"
Properties="user=M594;password=M594;dll=ocijdbc8;protocol=oci8"
Targets="ilimdev" URL="jdbc:oracle:oci8:@ilimdev"/>
<JDBCTxDataSource JNDIName="jdbc/MyDataSource"
Name="My Tx Data Source" PoolName="myPool" Targets="ilimdev"/>This configuration is far from the best performing one. I suggest you
to change it to:
<JDBCConnectionPool DriverName="oracle.jdbc.driver.OracleDriver"
Properties="user=M594;password=M594;dll=ocijdbc8;protocol=oci8"
InitialCapacity="20" MaxCapacity="20" Name="myPool"
LoginDelaySeconds="1" RefreshMinutes="99999"
ShrinkPeriodMinutes="5" ShrinkingEnabled="false"
TestConnectionsOnReserve="true" TestConnectionsOnRelease="false"
TestTableName="DUAL"
Targets="ilimdev" URL="jdbc:oracle:oci8:@ilimdev"/>
This configuration will perform better and will not spend time recreating
connections and will require less synchronized operations inside the
pool.
BTW, in your code sample you look up two datasources. Are they bound
to different pools?
Regards,
Slava Imeshev
>
>
>
"Slava Imeshev" <[email protected]> wrote in message
news:[email protected]...
Hi Arnaud,
Could you post an extract from config.xml in part of the connection
pools and datasources? I'm asking because the configuration
you have may be not tailored to best performance.
Regards,
Slava Imeshev
"Arnaud Benjacar" <[email protected]> wrote in message
news:[email protected]...
Environment: WLS6.1 SP3, W2K, Oracle 8.1.7, OCI Driver
Hi,
we are experiencing performance problem when getting a connection from a
pool.
Getting a connection from a stateless session bean takes 300-500mswhereas
it takes 15ms
from an entity bean (local). Both session and entity beans are deployedin
the same ear.
In both cases we're getting the datasource using the following codesnippet
Properties p = new Properties();
bla bla bla ...
Context ic = new InitialContext(p);
DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/XXX");
and
DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/YYY");
When getting the connection, we are experiencing the speed difference
described above.
connection conn = ds.getConnection();
Why do we have this difference? We have the reference to the datasource
already.
There is no further JNDI lookup. Is there something we are missing?
Thanks
Arnaud
Entity descriptor
<resource-ref>
<res-ref-name>jdbc/XXX</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Application</res-auth>
</resource-ref>
WLS specific
<reference-descriptor>
<resource-description>
<res-ref-name>jdbc/XXX</res-ref-name>
<jndi-name>jdbc/MyDataSource</jndi-name>
</resource-description>
</reference-descriptor>
Session descriptor
<resource-ref>
<res-ref-name>jdbc/YYY</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Application</res-auth>
</resource-ref>
WLS specific
<reference-descriptor>
<resource-description>
<res-ref-name>jdbc/YYY</res-ref-name>
<jndi-name>jdbc/MyDataSource</jndi-name>
</resource-description>
<ejb-local-reference-description>
<ejb-ref-name>ejb/XXX</ejb-ref-name>
<jndi-name>ejb/XXXLocal</jndi-name>
</ejb-local-reference-description>
</reference-descriptor> -
Hi,
I have JRE 1.5.0_05 and 1.4.2_04 installed and currently applet in browser is always run under jre 1.5. How to run the applet under jre 1.4.2 in browser?
Thanks a lotHi,
Thanks for the info. I was thinking that the note didn't work for me, apparently I didn't use the conventional APPLET tag.
Is there other way to switch JRE if I'm not using APPLET tag? -
Same thread for ServletRequestListener and Servlet request?
Does ServletRequestListener methods execute in the same thread that the Servlet.service method?
I wonder if the answer is always 'yes'. And I hope it will. I've been reading the specs but found nothing related.
I think it's an important issue because this way you can take advantage and share data between listener and request in a ThreadLocal object for a request.
Can anyone help me?
Thanks in advance.
Message was edited by:
puchericoI've checked it up for Tomcat (version 5). I can say it is true for Tomcat: For a given request, the service method and request listeners are executed in the same thread. But who can say this is true for all Application Servers....! and who can say it will be true for future version of Tomcat!
Because of the lack in the spec (I haven't found any comment on this subject) I am still not sure if I can rely on this property! -
My computer seems like it runs slower since upgrade.
Is it just me or has mountain lion affected the speed of my computer. I also switched to Firefox and got rid of unneeded stuff so as to clear hard drive space. Loading seems slower, everything seems a little bit slower. I know I should have more than 25 gigs available on the hard drive, but it has been that way even before the upgrade. So no change in that department.
I'm using a 2009 macbook. Can anyone think of any reason besides the hard disk space? I had only 25 gigs before the upgrade and it seemed to be running fine.How much RAM do you have? More is always better and it is cheap right now
OWC http://www.macsales.com/
Crucial http://www.crucial.com / -
Correct Principal not showing up in the Session and Entity EJB layer
In our app a user is authenticated via the web container. The web layer then makes
calls to various session EJB's.
In our session bean, calls to sessionContext.getCallerPrincipal().getName() sometimes
returns "SYSTEM" instead of
the principal's name that was authenticated at the web container level.
In our entity beans, calls to entityContext.getCallerPrincipal().getName()
sometimes returns "<anonymous>" instead of the principal's
name.
A) Why isn't the principal's name = context's principal's name?
B) Can we ensure that principal's name isn't lost?
As per the documentation, the user principal is associated with the current thread,
so why is it that when calls are made in the same thread of execution from the
web layer to the EJB layer we are losing the right principal. Btw, the Principal
is always correct in the Web layer. We do not have any RunAs options set in our
EJB deployment descriptors.
What are we doing wrong?You aren't doing anything wrong. This is a bug in the webservices.
kapil khanna wrote:
In our app a user is authenticated via the web container. The web layer then makes
calls to various session EJB's.
In our session bean, calls to sessionContext.getCallerPrincipal().getName() sometimes
returns "SYSTEM" instead of
the principal's name that was authenticated at the web container level.
In our entity beans, calls to entityContext.getCallerPrincipal().getName()
sometimes returns "<anonymous>" instead of the principal's
name.
A) Why isn't the principal's name = context's principal's name?
B) Can we ensure that principal's name isn't lost?
As per the documentation, the user principal is associated with the current thread,
so why is it that when calls are made in the same thread of execution from the
web layer to the EJB layer we are losing the right principal. Btw, the Principal
is always correct in the Web layer. We do not have any RunAs options set in our
EJB deployment descriptors.
What are we doing wrong?
Maybe you are looking for
-
Problems with wireless connection between new macbook and older imac
I have just bought a 2.0 ghz macbook core2duo and am unable to connect to my wireless internet network at home. My wireless connection is set up through the airport card in my 17" flat panel imac (i.e. I am using the imac as the internet base station
-
Hi experts, I have a bit of a problem here wit a flat file to IDOC interface. My input CSV file structure (shortened) is as follows - <?xml version="1.0" encoding="UTF-8"?> <ns0:POINBOUND_MT xmlns:ns0="urn:xx:xi:dwn:xx:pf:xxx:poinbound:100"> <Reco
-
Drag and Drop is duplicating images on an iPad...?
Hi, I have a drag and drop interaction in my CP8 course. I'm dragging several sources into one target, and it's functioning perfectly in all browsers. However, when you complete the interaction on the iPad, it's duplicating the last image that the le
-
Using batch convert tool on my website
Can anyone help me out with a few questions: 1) How can I use Batch Convert tool on my website where I will be able to process the files with an automated process? 2) How and from where can I get the API to embed on my website? 3) I want to automa
-
Hi All, The requirement is to display columns in the form dynamically based on the user input. For example if a country is chosen, each of the states is to come as a column. So based on the country, the no. of states is likely to change. This would c