JNDI bind/rebind and object state question
Hi,
I have an object that is part of an EAR application that is deployed into an app server. I load a Webapp that initializes an object and then binds it to an initial context under java:comp/env setting some initial state.
However, when I access the object from an MDB as part of the EAR application, the state, when retrieved from the same context, was not retained. Here is the code I am using to bind the object to the context:
if (!object.isRunning()) {
System.out.println("Starting App...");
object.start();
try {
getNamingContext().bind(object);
} catch (Exception e) {
System.out.println("Name bound already, rebinding...");
try {
getNamingContext().rebind(object);
e.printStackTrace();
} catch (Exception e1) {
e1.printStackTrace();
System.out.println("Broker started...");
}When I retrieve the object from the initial context as part of a message received within an MDB, the state is such that the object is always failing the .isRunning method test and subsequently throws an exception.
What am I doing wrong? Is this related to the fact that possibly the WAR and the MDB create duplicate contexts when I expect there to be only one?
Any insight is greatly appreciated.
Thanks,
John
following procedure works fine for now, if there is any straight forward solutions,
that will be helpful.
1) Create the Subcontexts for each of the sub entries in the jndi name tree
2) bind the object to the last entry in the tree.
i.e if the jndi tree name is "one.two.three", and the bind object is Obj
ctx = ctx.createSubcontext("one");
ctx = ctx.createSubcontext("two");
ctx = ctx.bind("three", obj);
Thanks,
Gangs.
"Gangadhar" <[email protected]> wrote:
>
Hi,
I am trying to bind the local object to the Weblogic JNDI, using the
code below.
It works fine if the bind name is a straight forward String(not a tree).
It is
throwing naming Exception when i am trying to bind into a new tree.
Thanks,
Gangs.
//GETTING THE INITIAL CONTEXT:
private Context getInitialContext() throws NamingException {
Properties h = new Properties();
h.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
h.put(Context.SECURITY_PRINCIPAL, "user");
h.put(Context.SECURITY_CREDENTIALS, "password");
h.put(Context.PROVIDER_URL, url);
return new InitialContext(h);
} catch (NamingException ne) {
log("We were unable to get a connection to the WebLogic server
at "+url);
log("Please make sure that the server is running.");
throw ne;
private registerObject()
throws NamingException
// Lookup the beans home using JNDI
Context ctx = getInitialContext();
try{
//This binding works fine.
String bname = "Ganga";
ctx.bind("plainname", bname);
//This one throws an Naming Exception..
ctx.rebind("one.two.three", bname);
} catch(javax.naming.NameAlreadyBoundException nlb){
System.out.print(nlb.getMessage());
System.exit(0);
}catch(javax.naming.directory.InvalidAttributesException iae){
System.out.print(iae.getMessage());
System.exit(0);
}catch(NamingException ne){
System.out.print(ne.getMessage());
System.exit(0);
Exception msg is : Unable to resolve 'one.two.three' Resolved: '' Unresolved:'one'
Similar Messages
-
Docs about RowSet, and Object RowSet questions?
Docs about RowSet, and Object RowSet questions?
I can find RowSet forum, so I ask here!
Can you give me URLs where I can find more about RowSet and URLs for any RowSet implementation?
Does Borlans, Oracle, IBM, etc., have RowSet implementation?
I find out about Sun's RowSet implementation, but I can't find Object Rowset in this implementation?
Is it possible to develop Object RowSet and is it useful?
I know about O/R tools like Hibernate, but Object RowSet can be useful?
Run SQL query and get Objects, or maybe even run Object query (like EJB or Hibernate or JDO have) and get Objects.
No XML mapping mess and simmilar, like with EJB or Hibernate or JDO?You can try
http://java.sun.com/developer/Books/JDBCTutorial/chapter5.html
This is a tutorail for RowSet -
Reconciling garbage collection, heap overview, and object stats
First, both the JRockit RuntimeAnalyzer and Console are great tools. We use
them extensively so thank you.
I'm trying to reconcile the numbers in these three tabs.
1. How do I reconcile the Runtime Analyzer and Console output?
- The Heap overview tab in our application profile shows Heap Overview as
83% free.
- However, the Garbage Collection tab of the profile and Console shows the
application as oscillating between 50 Meg and 200 Meg of heap used. That's
25% (50Meg/200Meg) to 100%(200Meg/200Meg) used. How do I interpret the 83%
vs. the 100%?
I don't believe the 83% free, but I'm skeptical that we consume 150Meg of
memory in 50 seconds.
2. How do I reconcile the Object stats with the Garbage collection?
- Take the top heap user at end of recording, character buffer. It's 22.8%
of heap using 6,328 KB. If the heap is actually only 34Meg ( 17% of 200Meg.
I get the 17% from the 83% free), then 22.8% makes sense.
- So what's in the 200Meg of heap?
I sent this recording to the JRA team if you want to look at it.
Thanks
JeffI've never heard it put that way. Very interesting.
"Johan Walles" <johan@spamalamadingdong> wrote in message
news:41bf0be3@mail...
Note that the time it takes for the garbage collector to do its thing
grows with the amount of live data.
What the garbage collector really does is more like retaining the live
data than disposing of the garbage.
Regards //Johan
Jeff wrote:
Staffan,
Thanks - you clearly answered my questions. Now the follow-on questions:
1. Is there a way to get insight into what the 'dead' data is composed
of?
2. Is this pattern of consuming 3x the live data in about a minute
'typical' or a disaster in the making?
I'm trying to get a sense of what a reasonable target of 'dead' data is.
The system processes about a meg of data per second, including database
writes.
Thanks
Jeff
"sla" <[email protected]> wrote in message
news:33533893.1102952170368.JavaMail.root@jserv5...
Hi Jeff,
I'll try to answer the questions.
1) The Heap overview in the application profile is a snapshot of the heap
at the end of a garbage collection. At this time only live data is still
on the heap. So it looks like you have 17% of the heap filled with live
data (and some overhead as seen in the Heap overview).
In the garbage collection tab you can see the heap usage oscillating
between 35-40MB and 200MB. The lower value is right after a garbage
collection and the higher value is right before a garbage collection. The
garbage collector clears out about 160MB of "dead" data from the heap.
This is the amount of temporary objects that you created during the
garbage collection cycles.
2) The Object statistics are also taken right after a garbage collection.
At this time there is 34M of live data on the heap and of these about 22%
is taken up by character arrays (not unusual).
At this time the rest of the 200MB heap is empty. It's been cleared of
all temporary objects and is ready for allocation of new objects.
I hope this answered your questions.
Regards,
/Staffan -
System and Object privileges question
hello everyone.
I was really making it a priority to really understand both system and object privileges for users. I have setup a couple of 'sandboxes' at home and have done lots of testing. So far, it has gone very well in helping me understand all the security involved with Oralce (which, IMHO, is flat out awesome!).
Anyway, a couple of quick questions.
As a normal user, what view can I use to see what permissions I have in general? what about permissions on other schemas?
I know I can do a:
select * from session_privs
which lists my session privileges.
What other views (are they views/data dictionary?) that I can use to see what I have? Since this is a normal user, they don't have access to any of the DBA_ views.
I'll start here for now, but being able to see everything this user has, would be fantastic.
Cheers,
TCGSorry. should have elaborated more.
In SQLPLUS, (logged in while logged into my Linux OS), I am working to try and get sqlplus to display the results of my query so it is easy to read. Right now, it just displays using the first 1/4 or 1/3 of the monitor screen to the left. Make sense? So it does not stretch the results out to utilize the full screen. it is hard to break down and read the results because they are "stacked" on top of each other.
Would be nice if I could adjust sqlplus so the results are easier to read.
HTH.
Jason -
SCC4 and Object Changeability question
Gurus,
Note - Please do not send me links ,which has no reference to my questions whtsoever,pls provide me direct answers to the questions if possible.
1)do you need to open the system using SCC4 in order to make the "object changeability" option work??
2)what is the relation between SCC4 and "object changeability"
3)Can the Infopackage transported from dev to prod be changed with "object changeability" option??if yes how ?
or only object created in the production local be changed using "object changeability" option
or i can only change the transported Infopack in production using SCC4 ,system open
thanks in advance.1)do you need to open the system using SCC4 in order to make the "object changeability" option work??
ans) Pre-requisite -Close the system
2)what is the relation between SCC4 and "object changeability"
ans) Objects of the selected object types exist in your system as changeable with "object changeability option" even if this system is globally set to not changeable.
3)Can the Infopackage transported from dev to prod be changed with "object changeability" option??if yes how ?
or only object created in the production local be changed using "object changeability" option
or i can only change the transported Infopack in production using SCC4 ,system open
ans)"Choose Original Changeable" If you not only want to make objects which are generated in this system changeable, but also those that were imported. This option is required, for example, if you need to make repairs or want to change flexible starting times. Note: New imports can overwrite the changes again
I would advocate to read this link carefully -
http://help.sap.com/saphelp_nw04s/helpdata/en/0e/a7343e8c7f6329e10000000a114084/frameset.htm
Hope it Helps
Chetan
@CP.. -
Binds collections and forall statement
version 9.2.0.6
I would like to make this more dynamic in that the collection cList can be used only once and be used by all bind variables. The variable stmt would be dynamically generated in that case it would insert into any number of tables.
Can this be done?
Is this feature available in a newer version of Oracle?
create table d2 nologging as
select
rownum rn
,substr(dbms_random.string('x',5),1,10) v1
,sysdate d1
,round(dbms_random.value(1,10)) n1
,substr(dbms_random.string('x',5),1,10) v2
,rpad(' ',4000,' ') as concat
from dual connect by level <= 100;
-- no rows for our test
create table d3 nologging as
select
from d2 where 1 = 2;
-- setup for our test
update d2
set image = rpad(nvl(to_char(rn),' '),10,' ')
|| rpad(nvl(v1,' '),20,' ')
|| rpad(nvl(to_char(d1,'DD-MON-YYYY HH24:MI:SS'),' '),34,' ')
|| rpad(nvl(to_char(n1),' '),10,' ')
|| rpad(nvl(v2,' '),10,' ')
-- test got all locations right
select
to_number(rtrim(substr(image,1,10)))
,rtrim(substr(image,11,20))
,to_date(rtrim(substr(image,30,34)),'DD-MON-YYYY HH24:MI:SS')
,to_number(rtrim(substr(image,65,10))) AS n1
,rtrim(substr(image,75,10))
from d2;
-- here is where we do the work
declare
type charList is table of varchar2(4000);
cList charList;
d2l d2_list;
errors NUMBER;
dml_errors EXCEPTION;
PRAGMA exception_init(dml_errors, -24381);
sqlStmt varchar2(32000);
cursor cur is select image from d2;
bcLimit number := 23;
begin
sqlStmt := 'insert into d3 (rn,v1,d1,n1,v2)'
|| 'values (to_number(rtrim(substr(:a,1,10)))
,rtrim(substr(:a,11,20))
,to_date(rtrim(substr(:a,30,34)),''DD-MON-YYYY HH24:MI:SS'')
,to_number(rtrim(substr(:a,65,10)))
,rtrim(substr(:a,75,10)))';
open cur;
loop
fetch cur bulk collect into cList limit bcLimit;
exit when cList.count = 0;
begin
-- very very unfortunately the code is unable to have one using clause variable be applied to all bind variables
-- note the number of cList uses having the bind variables all name the same does not help
-- using only one gets a ORA-1008 error :(
FORALL i IN cList.FIRST..cList.LAST SAVE EXCEPTIONS execute immediate sqlstmt using cList(i),cList(i),cList(i),cList(i),cList(i);
-- FORALL i IN cList.FIRST..cList.LAST SAVE EXCEPTIONS execute immediate sqlstmt using cList(i); --< DOES NOT WORK :( I WISH IT WOULD!
EXCEPTION
WHEN dml_errors THEN
errors := SQL%BULK_EXCEPTIONS.COUNT;
dbms_output.put_line('number of errors is ' || errors);
FOR i IN 1..errors LOOP
dbms_output.put_line('Error ' || i || ' occurred during iteration ' || SQL%BULK_EXCEPTIONS(i).ERROR_INDEX);
dbms_output.put_line('Could not insert ' || cList(SQL%BULK_EXCEPTIONS(i).ERROR_INDEX));
dbms_output.put_line(SQLERRM(-SQL%BULK_EXCEPTIONS(i).ERROR_CODE));
END LOOP;
end;
end loop;
close cur;
dbms_output.put_line('h2');
end;
/The CREATE TABLE you post for table D2 has no column called 'image'. It would help somewhat if you posted a working example.
Also I am not clear why the INSERT INTO D3 statement in the anonymous block needs to be dynamic. -
Where is the getString() implementation for RS and Object class question
Dear all,
I had these two questions ringing since a long time.
1)ResultSet is an interface.
In my jdbc code I have generally written rs.getString() and rs.getInt etc.. without giving a second thought as to where exactly is this getter implemented !
I have RTF API .. without too much help.
Could some one kindly explain Where is the implementation of the getString method ?
2) Could you please tell why the Wait() Notify() and NotifyAll methods have been implemented in the Object class ? What was the need to define em in the Object class ?
Thanks in advance for your time spent on this.
RgdsSarvananda wrote:
In the MySQL driver for example it's implemented in com.mysql.jdbc.ResultSet Right. Now it makes sense to me. Every single db that gives me a driver will have their specific implementation for the interface methods of ResultSet.
>
why do you need that?
..Thats a design decision
One of my friends asked me this and I was caught unawares. Any ideas on what factors could have made this design decision ?
Rgds
>
In the MySQL driver for example it's implemented in com.mysql.jdbc.ResultSet Right. Now it makes sense to me. Every single db that gives me a driver will have their specific implementation for the interface methods of ResultSet.
>
why do you need that?
..Thats a design decision
One of my friends asked me this and I was caught unawares. Any ideas on what factors could have made this design decision ?
A desire to not have to couple your code to a particular database and JDBC driver. It's a classic example of the abstract factory pattern -
Controlling and object state from a button within an object state
I have a MSO with a set of fridge images, to show the different colourways, but I also want to be able to show open and closed versions of the images.
My idea was to have two MSO, one with the colour varients and one with the open varients and have a button inside the colour varient MSO so each colour shows its own button, but it looks like that button can only control the MSO that it is part of, is there anyway for it to trigger the second MSO?Ok well this is a screenshot from the laundry page, but its the same as fridge freezers.
There is a MSO called colour change, and the red box is the button which has a go to next state action.
I was going to have a second MSO with the open versions of the products that would be triggered by a button in each state of the first MSO, but this isn't possible.
I don't want to put all the images in one MSO because that button is specifically to change the colour of the product.
I guess one option could be to make each image in a scrollable frame so you swipe up/down to open/close.
Any other possibilities? -
JNDI / EJB deployment and clustering
I'm aware that replication isn't supported for stateful EJBs. But the
"serialization of the handle isn't supported" statement has me concerned.
So I'm looking for a little clarification on this scenario:
Let's say I've got a stateful session bean, which is accessed from a
servlet. For performance reasons, you want to find the colocated instance -
the smart stub should do this, right? To have it colocated in all
instances, then I need to deploy it into each server of the cluster. This
essentially bind()/rebind()'s (whichever call the container does during a
deploy operation) the EJB n times. Does each of those JNDI bind/rebind
calls "overwrite" the previous one, or does the replicated JNDI tree somehow
"keep" all the entries?
What happens if I bind/rebind "non-cluster enabled" objects into the JNDI
tree in each server to the same name (like a reference data table - doesn't
really need to be an RMI object, one per server is fine)? Will they get
"overwritten"? Should I need to take into account the server name when
binding into the tree, and then also use that for subsequent lookups?
Thanks for any input!
--Jason
Guys,
Thanks for the information.
The problem was that classpath, some other packages required for the Bean
were not in the weblogic\classes directory.
so that was it.
Thanks
/selvan
Murali Krishna Devarakonda wrote in message
<7qjkr1$7dl$[email protected]>...
Are you using the HOT DEPLOY feature(startweblogic.bat does it)?
Then you could go to the WebLogic Console, select the Bean, and Redploy.
You could also do it from a command line utility "weblogic.deploy".
If you didn't start the server with the hot deploy, you need to restartyour
server after any changes.
You should read the weblogic docs on the Hot Deploy feature. A different
classloader is used for it. Also, the standard weblogic classpath cannot
coexist with it.
Hot Deploy uses: (assuming your weblogic installation is in D:/WebLogic
D:\WebLogic\classes/boot
It will throw an exception if you have D:\weblogic\classes or
D:\WebLogic\lib\weblogicaux.jar in the system classpath. You need to use
the weblogic.classpath instead.
Regards,
Murali Krishna Devarakonda
Tamilselvan Ramasamy <[email protected]> wrote in message
news:7qi0ln$kpc$[email protected]..
Hello,
I have created bunch of EJB Components and deployed for WLS4.0 using the
following way. It works fine under WLS4.0
To compile java code -> javac *.java
Create SER file -> java weblogic.ejb.utils.DDCreator -d .
DeploymentDescriptor.txt
Create JAR file -> jar cmf manifest Bean.jar /directory
EJBC and deployment -> java weblogic.ejbc -d /targetDirectory Bean.jar
and also add an entry in the welogic.properties file
weblogic.ejb.deploy= ...
When I do the samething in the WLS4.5, it doesn't work, first of all,
JNDI
is not finding the home interface. It throws a naming Exception
please give me an idea hw do I deploy my Beans in the WLS4.5 using the
command line option. I don't have Visual Cafe to do that automatically.So
I
have to do that manually.
Thanks
/selvan
Captura Software Inc
[email protected] -
Bind Variable in SELECT statement and get the value in PL/SQL block
Hi All,
I would like pass bind variable in SELECT statement and get the value of the column in Dynamic SQL
Please seee below
I want to get the below value
Expected result:
select distinct empno ,pr.dept from emp pr, dept ps where ps.dept like '%IT' and pr.empno =100
100, HR
select distinct ename ,pr.dept from emp pr, dept ps where ps.dept like '%IT' and pr.empno =100
TEST, HR
select distinct loc ,pr.dept from emp pr, dept ps where ps.dept like '%IT' and pr.empno =100
NYC, HR
Using the below block I am getting column names only not the value of the column. I need to pass that value(TEST,NYC..) into l_col_val variable
Please suggest
----- TABLE LIST
CREATE TABLE EMP(
EMPNO NUMBER,
ENAME VARCHAR2(255),
DEPT VARCHAR2(255),
LOC VARCHAR2(255)
INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (100,'TEST','HR','NYC');
INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (200,'TEST1','IT','NYC');
INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (300,'TEST2','MR','NYC');
INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (400,'TEST3','HR','DTR');
INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (500,'TEST4','HR','DAL');
INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (600,'TEST5','IT','ATL');
INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (700,'TEST6','IT','BOS');
INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (800,'TEST7','HR','NYC');
COMMIT;
CREATE TABLE COLUMNAMES(
COLUMNAME VARCHAR2(255)
INSERT INTO COLUMNAMES(COLUMNAME) VALUES ('EMPNO');
INSERT INTO COLUMNAMES(COLUMNAME) VALUES ('ENAME');
INSERT INTO COLUMNAMES(COLUMNAME) VALUES ('DEPT');
INSERT INTO COLUMNAMES(COLUMNAME) VALUES ('LOC');
COMMIT;
CREATE TABLE DEPT(
DEPT VARCHAR2(255),
DNAME VARCHAR2(255)
INSERT INTO DEPT(DEPT,DNAME) VALUES ('IT','INFORMATION TECH');
INSERT INTO DEPT(DEPT,DNAME) VALUES ('HR','HUMAN RESOURCE');
INSERT INTO DEPT(DEPT,DNAME) VALUES ('MR','MARKETING');
INSERT INTO DEPT(DEPT,DNAME) VALUES ('IT','INFORMATION TECH');
COMMIT;
PL/SQL BLOCK
DECLARE
TYPE EMPCurTyp IS REF CURSOR;
v_EMP_cursor EMPCurTyp;
l_col_val EMP.ENAME%type;
l_ENAME_val EMP.ENAME%type;
l_col_ddl varchar2(4000);
l_col_name varchar2(60);
l_tab_name varchar2(60);
l_empno number ;
b_l_col_name VARCHAR2(255);
b_l_empno NUMBER;
begin
for rec00 in (
select EMPNO aa from EMP
loop
l_empno := rec00.aa;
for rec in (select COLUMNAME as column_name from columnames
loop
l_col_name := rec.column_name;
begin
l_col_val :=null;
l_col_ddl := 'select distinct :b_l_col_name ,pr.dept ' ||' from emp pr, dept ps where ps.dept like ''%IT'' '||' and pr.empno =:b_l_empno';
dbms_output.put_line('DDL ...'||l_col_ddl);
OPEN v_EMP_cursor FOR l_col_ddl USING l_col_name, l_empno;
LOOP
l_col_val :=null;
FETCH v_EMP_cursor INTO l_col_val,l_ename_val;
EXIT WHEN v_EMP_cursor%NOTFOUND;
dbms_output.put_line('l_col_name='||l_col_name ||' empno ='||l_empno);
END LOOP;
CLOSE v_EMP_cursor;
END;
END LOOP;
END LOOP;
END;user1758353 wrote:
Thanks Billy, Would you be able to suggest any other faster method to load the data into table. Thanks,
As Mark responded - it all depends on the actual data to load, structure and source/origin. On my busiest database, I am loading on average 30,000 rows every second from data in external files.
However, the data structures are just that - structured. Logical.
Having a data structure with 100's of fields (columns in a SQL table), raise all kinds of questions about how sane that structure is, and what impact it will have on a physical data model implementation.
There is a gross misunderstanding by many when it comes to performance and scalability. The prime factor that determines performance is not how well you code, what tools/language you use, the h/w your c ode runs on, or anything like that. The prime factor that determines perform is the design of the data model - as it determines the complexity/ease to use the data model, and the amount of I/O (the slowest of all db operations) needed to effectively use the data model. -
Bind a huge object to jndi tree in sun one 7
Hi we are loading all the master tables in to objects at the app server startup (SUN ONE 7) and then binding the whole object to the jndi tree. All the tables data in text files comes to about 5 MB and the serilized object with data to about 8 MB. But when the app server tries to bind the object the app server process consumes over 500MB of ram and gives OutOfmemoryError as the total ram is 512MB. why is it consuming so much memory. It does bind an object of about 5 MB but when trying to lookup subsequent to the first lookup it fails. Is this a bug or what??? the same thing works perfectly with Weblogic and Websphere and also Weblogic is very efficient in memory consumption and response time is amazing. For a 5 MB object the lookup takes about 5Secs in Weblogic and about 15Mins in Sun One. We might have to drop the Sun One App Srv and go for Weblogic though we dont want. Kindly provide some guidance. Thanks in advance.
Hi,
Refer http://java.sun.com/products/jndi/tutorial/objects/storing/remote.html
-amol -
Message driven beans and object binding
I want to write a message driven bean, and use javax.naming.Context's "bind(String,
Object)" method to bind the data to a key and eventually do a unbind(String) to
look up the data . Is binding/unbinding of object is allowed inside a message
driven bean or this violates the EJB2.0 spec? Also, does this have any negative
consequences if I use a Weblogic cluster as opposed to a single instance? Any
suggestions
Hi Austin,
- I don't know if it is "legal" in EJB 2.0
to call bind/unbind within an MDB. I
would assume so, but I'm not sure. You can try confirming with
the jndi and ejb newsgroups. Of course, if you don't
ask, then no one can tell you "no". ;-)
- Bind/unbind is a relatively expensive call performance-wise. I
suspect one might want to avoid doing too many of these per
second (the jndi newsgroup may be able to give pointers here.)
- Servers in a cluster do not instantly propagate bind/unbind info
to other servers in cluster, and JNDI may have trouble
efficiently supporting larger objects: both potential drawbacks
to using JNDI for data caching purposes.
Tom, BEA
Austin P wrote:
> I want to write a message driven bean, and use javax.naming.Context's "bind(String,
> Object)" method to bind the data to a key and eventually do a unbind(String) to
> look up the data . Is binding/unbinding of object is allowed inside a message
> driven bean or this violates the EJB2.0 spec? Also, does this have any negative
> consequences if I use a Weblogic cluster as opposed to a single instance? Any
> suggestions
-
Why is my text rasterized and blurry when it loads in an object state?
My fonts are coming out blurry when I use them in an object state and the state is displayed, but nice and clear when placed on the main page outside of an object state. I'm using viewer 25 for my folio version and viewing it in adobe content viewer on the ipad. It is not yet published. Thank you.
You need to keep in mind that DPS is still very much a cobbled onto InDesign solution. MSOs were intended for SWF output and any changes beyond that happen in the folio overlays panel.
BTW, your replies via email show up on the web. No need to reply more than once.
Bob -
BMP question : got javax.ejb.EJBException error Object state not saved
Could anybody please help me? I could not figure out what i did wrong.
I got the javax.ejb.EJBException error: Object state not saved
when i test the getname() method for findByPrimaryKey() and findAll() methods.
Here is my code:
package org.school.idxc;
import javax.sql.*;
import javax.naming.*;
import javax.ejb.*;
import javax.sql.*;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.Vector;
* Bean implementation class for Enterprise Bean: status
public class statusBean implements javax.ejb.EntityBean {
private javax.ejb.EntityContext myEntityCtx;
private int id;
private String name;
private DataSource ds;
private String dbname = "jdbc/idxc";
private Connection con;
* ejbActivate
public void ejbActivate() {
* ejbLoad
public void ejbLoad() {
System.out.println("Entering EJBLoad");
try
Integer primaryKey = (Integer) myEntityCtx.getPrimaryKey();
String sqlstmt = "select id, name from from status where id =?";
con = ds.getConnection();
PreparedStatement stmt = con.prepareStatement(sqlstmt);
stmt.setInt (1,primaryKey.intValue());
ResultSet rs = stmt.executeQuery();
if (rs.next())
this.id = rs.getInt(1);
this.name = rs.getString (2).trim();
stmt.close();
} // if
else
stmt.close();
throw new NoSuchEntityException ("Invalid id " + id);
}// else
} // try
catch (SQLException e)
System.out.println("EJBLOad : " + e.getMessage());
} // catch
finally
try
if (con != null)
con.close();
}// try
catch (SQLException e)
System.out.println("EJBLOad finally" + e.getMessage());
} // catch
}// finally
* ejbPassivate
public void ejbPassivate() {
* ejbRemove
public void ejbRemove() throws javax.ejb.RemoveException {
System.out.println ("Entering ejb Removed");
try
String sqlstmt = "delete from status where id=" + id;
con = ds.getConnection();
Statement stmt = con.createStatement();
stmt.executeUpdate(sqlstmt);
stmt.close();
}// try
catch (SQLException e)
System.out.println("Ejb Remove" + e.getMessage());
} // catch
finally
try
if (con!=null)
con.close();
}// try
catch (SQLException e)
System.out.println ("EJBRemoved " + e.getMessage());
} // catch
} // finally
* ejbStore
public void ejbStore() {
System.out.println("Entering the ejbStore");
try
String sqlstmt = "update status set id=" + id + ",name='" + name + "' where id=" + id;
con = ds.getConnection();
Statement stmt = con.createStatement();
if (stmt.executeUpdate(sqlstmt) != 1)
throw new EJBException ("Object state not saved");
stmt.close();
} // try
catch (SQLException e)
System.out.println ("EJBStore : " + e.getMessage());
}// catch
finally
try
if (con != null)
con.close();
} // try
catch(SQLException e)
System.out.println ("EJBStore finally " + e.getMessage());
} // catch
} // finally
* getEntityContext
public javax.ejb.EntityContext getEntityContext() {
return myEntityCtx;
* setEntityContext
public void setEntityContext(javax.ejb.EntityContext ctx) {
myEntityCtx = ctx;
try
InitialContext initial = new InitialContext();
ds = (DataSource)initial.lookup(dbname);
} // try
catch (NamingException e)
throw new EJBException ("set Entity context : Invalid database");
}// catch
* unsetEntityContext
public void unsetEntityContext() {
myEntityCtx = null;
* ejbCreate
public Integer ejbCreate(Integer key, String name) throws javax.ejb.CreateException {
this.id = key.intValue();
this.name = name;
System.out.println ("Entering ejbCreated!!!");
try
String sqlstmt = "insert into status(id,name) values (" + id + ",'" + (name == null ? "" : name) + "')";
con = ds.getConnection();
Statement stmt = con.createStatement();
stmt.executeUpdate(sqlstmt);
stmt.close();
}// try
catch (SQLException e)
System.out.println("EJBCreate : SQLEXception ");
}// catch
finally
try
if (con!=null)
con.close();
}// try
catch (SQLException e)
System.out.println ("EJB Created Finally : SQLException");
e.getMessage();
} // catch
}// finally
this.id = key.intValue();
this.name = name;
return key ;
* ejbPostCreate
public void ejbPostCreate(Integer id, String name) throws javax.ejb.CreateException {
* ejbFindByPrimaryKey
public Integer ejbFindByPrimaryKey(
Integer key) throws javax.ejb.FinderException {
try
String sqlstmt = "select id from status where id=" + key.intValue();
con = ds.getConnection();
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(sqlstmt);
if (!rs.next())
throw new ObjectNotFoundException();
} // if
rs.close();
stmt.close();
} // try
catch (SQLException e)
System.out.println ("EJBFindBYPrimaryKey " + e.getMessage());
} // catch
finally
try
if (con!=null)
con.close();
}// try
catch (SQLException e)
System.out.println ("EJB Find by primary key" + e.getMessage());
}// catch
}// finally
return key;
* @return Returns the name.
public String getName() {
return this.name;
* @return Returns id
public int getId() {
return this.id;
* @param name The name to set.
public void setName(String xname) {
this.name = xname;
* ejbFindByLastnameContaining
public Enumeration ejbFindAllNamne () throws javax.ejb.FinderException
try
String sqlstmt = "select id from status order by id";
con = ds.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(sqlstmt);
Vector keys = new Vector();
while (rs.next())
keys.add(new Integer(rs.getInt(1)));
}// while
rs.close();
s.close();
con.close();
return keys.elements();
} // try
catch (SQLException e)
throw new FinderException (e.toString());
} // catch
}Hi,
if you look at your error message you will see the problem. In your code you've missed to implement
public void ejbPassivate {}
so your code looks like this
import java.lang.Object;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import java.rmi.RemoteException;
import java.lang.Math;
import java.util.Random;
import java.io.*;
/** * Title: * Description: * Copyright: Copyright (c) 2001 * Company: * @author * @version 1.0 */
public class DiceEJB implements SessionBean, Serializable
public int[] Roll()
Random rng = new Random();
int[] diceArray = new int[5];
for(int i =0; i < diceArray.length;i++)
diceArray[i] = (Math.abs (rng.nextInt()) % 6) +1;
return diceArray;
public DiceEJB(){}
public void ejbCreate() {}
public void ejbRemove() {}
public void ejbActivate() {}
public void ejbPassivate() {}
public void setSessionContext (SessionContext sc)
private void writeObject(ObjectOutputStream oos) throws IOException
oos.defaultWriteObject();
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException
ois.defaultReadObject();
bye -
Where clause with a combination of And and Or statements - Basic question
Hi,
I have a where clause with a combination of And and Or statements... May I know which one would run first
Here is the sample
WHERE SITE_NAME = 'Q' AND ET_NAME IN ('12', '15') AND TEST_DATE > DATE OR SITE_NAME = 'E' AND ET_NAME IN ('19', '20')
can you please explain how this combination works
Thanks in advanceHi,
This reminds me of a great story. It's so good, it probably didn't really happen, but it's so good, I'm going to repeat it anyway.
IBM once had an "executive apptitude test" that they would give to job applicants. There were some questions you might call general knowlege or trivia questions, and each question had a weight (for example, answering an unimportant queestion might score one point, an important question might be 5 points.) One of the questions was "What is the standard width of a mobile home?", and the weight of the question was -20: answering the question correctly did serious harm to your score. The reasoning was that the more you knew about mobile homes, the less likely you were to be their kind of executive.
Now, as to your question, the correct answer is: I don't know. I don't want to know. Mixing ANDs and ORs without grouping them in parentheses is a really bad idea. Even if you get it right, it's going to confuse the next person who has to look at that code. Use parentheses to make sure the code is doing what you want it to do.
If you really want to find out, it's documented in the SQL language manual. Look up "Operators, prcedence"
http://docs.oracle.com/cd/E11882_01/server.112/e26088/operators001.htm#sthref815
You can easily do an experiment, using scott.emp, or even dual, where
WHERE (x AND y)
OR zproduces different results from
WHERE x
AND (y OR z)
Maybe you are looking for
-
I lost my iPhone 4S yesterday and it is showing as offline on fmip. Is it true that Apple can still track it even though it's off
-
I'm creating a page that uses a Spry Data Set for a book I'm working on. I have no problem with the data set when viewing the page in IE9 beta and Safari. Two separate testers who are using IE8 get the same error: "type="MM_SPRY_DATA_REFERENCE" ....
-
Adobe Digital Editions 3.0 stated "has encountered a problem and needs to close. We are sorry for the inconvenience." Sadly, it has been two weeks ago since I have been able to access my dictionary icon after receiving this message from Adobe. Hence,
-
OK here's my problem, I'm not great with PowerShell. I understand a little but that's about it and here's me scenario.I am creating a process to add users to a domain local group but it is spread across 3 domains. My add script works like a charm but
-
Help needed on Host Named Site Collection creation --- please help
Hi Friends, Question 1 Can we create Host Named Site Collection following the pattern below? We will have three Department head Host Named Site Collections, names – HRHead.ourdomain.com MarkettingHead.ourdomain.com AdminHead.ourdomain.com Under each