Stanley George

Ranch Hand
+ Follow
since Dec 09, 2000
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 Stanley George

The error was glaring at me from the stack trace:

16:35:40,545 ERROR JDBCExceptionReporter:58 - DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, SQLERRMC: DB2ADMIN.CAT

By default DB2 was appending the username to the table 'DB2ADMIN.CAT' when it should have been 'STANLEY.CAT'. All I had to do was change the mapping file Cat.hbm.xml to have the tablename as 'STANLEY.CAT' instead of just 'CAT'.

Thanks for looking.
Cheers
Hi all
I successfully ran a simple example on Hibernate 2.1.3 on Oracle 9i.

I am now trying to do it with Hibernate 3.0 on DB2 8.1.3 UDB. It is giving me an org.hibernate.exception.SQLGrammarException. From the generated sql, it looks like it cannot get the object's attribute values.

I would appreciate any help/pointers/links. Thanks a lot.

Hibernate version: 3.0 rc1

Mapping documents:
Cat.hbm.xml
-------------
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
<class name="com.stanleygeorge.hibernate3example.businessEntities.Cat" table="CAT">
<id name="id" type="integer" column="CAT_ID" unsaved-value="0">
<generator class="identity"/>
</id>

<property name="name" type="string" column="NAME"/>
<property name="weight" type="integer" column="WEIGHT"/>
</class>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():

CatManager.java
---------------
Configuration cfg = new Configuration();
cfg.addClass( Cat.class );

SessionFactory sessions = cfg.buildSessionFactory();
session = sessions.openSession();
tx = session.beginTransaction();

session.save(newCat);

tx.commit();
session.close();...

Full stack trace of any exception that occurs:
org.hibernate.exception.SQLGrammarException: could not insert: [com.stanleygeorge.hibernate3example.businessEntities.Cat]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:59)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1747)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2149)
at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:34)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:238)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:158)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:104)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:184)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:173)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:429)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:424)
at com.stanleygeorge.hibernate3example.businessEntities.CatManager.adoptCat(CatManager.java:35)
at com.stanleygeorge.hibernate3example.businessEntities.CatManager.main(CatManager.java:53)
Caused by: com.ibm.db2.jcc.a.SqlException: DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, SQLERRMC: DB2ADMIN.CAT
at com.ibm.db2.jcc.a.co.e(co.java:1361)
at com.ibm.db2.jcc.a.co.a(co.java:984)
at com.ibm.db2.jcc.b.bd.g(bd.java:121)
at com.ibm.db2.jcc.b.bd.a(bd.java:42)
at com.ibm.db2.jcc.b.r.a(r.java:31)
at com.ibm.db2.jcc.b.bp.g(bp.java:103)
at com.ibm.db2.jcc.a.co.g(co.java:968)
at com.ibm.db2.jcc.a.cp.T(cp.java:1378)
at com.ibm.db2.jcc.a.cp.d(cp.java:1781)
at com.ibm.db2.jcc.a.cp.L(cp.java:348)
at com.ibm.db2.jcc.a.cp.executeUpdate(cp.java:331)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1737)
... 15 more

Name and version of the database you are using:
DB2 8.1.3 UDB

The generated SQL (show_sql=true):
[insert into CAT (NAME, WEIGHT, CAT_ID) values (?, ?, default)]

Debug level Hibernate log excerpt:

hibernate.log
-------------
16:35:38,052 DEBUG DTDEntityResolver:53 - found http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath
16:35:38,312 INFO HbmBinder:256 - Mapping class: com.stanleygeorge.hibernate3example.businessEntities.Cat -> CAT
16:35:38,342 DEBUG HbmBinder:1086 - Mapped property: id -> CAT_ID
16:35:38,362 DEBUG HbmBinder:1086 - Mapped property: name -> NAME
16:35:38,362 DEBUG HbmBinder:1086 - Mapped property: weight -> WEIGHT
16:35:38,372 DEBUG Configuration:1035 - Preparing to build session factory with filters : {}
...

16:35:39,343 DEBUG DriverManagerConnectionProvider:115 - created connection to: jdbc b2:animals, Isolation Level: 2
16:35:39,343 DEBUG DriverManagerConnectionProvider:129 - returning connection to pool, pool size: 1
...

16:35:39,704 DEBUG SessionFactoryImpl:149 - Session factory constructed with filter configurations : {}
16:35:39,714 DEBUG SessionFactoryImpl:152 - instantiating session factory with properties: {java.runtime.name=Java(TM) 2
...

16:35:40,345 DEBUG SessionFactoryObjectFactory:39 - initializing class SessionFactoryObjectFactory
16:35:40,355 DEBUG SessionFactoryObjectFactory:76 - registered: ff8080810284182d0102841831390000 (unnamed)
16:35:40,355 INFO SessionFactoryObjectFactory:82 - Not binding factory to JNDI, no JNDI name configured
16:35:40,355 DEBUG SessionFactoryImpl:249 - instantiated session factory
16:35:40,355 INFO SessionFactoryImpl:366 - Checking 0 named queries
16:35:40,415 DEBUG SessionImpl:229 - opened session
16:35:40,415 DEBUG JDBCTransaction:46 - begin
16:35:40,415 DEBUG AbstractBatcher:379 - opening JDBC connection
16:35:40,415 DEBUG DriverManagerConnectionProvider:93 - total checked-out connections: 0
16:35:40,415 DEBUG DriverManagerConnectionProvider:99 - using pooled JDBC connection, pool size: 0
16:35:40,415 DEBUG JDBCTransaction:50 - current autocommit status: false
16:35:40,425 DEBUG DefaultSaveOrUpdateEventListener:159 - saving transient instance
16:35:40,425 DEBUG AbstractSaveEventListener:89 - generated identifier: , using strategy: org.hibernate.id.IdentityGenerator
16:35:40,425 DEBUG AbstractSaveEventListener:132 - saving [com.stanleygeorge.hibernate3example.businessEntities.Cat#<null>]
16:35:40,435 DEBUG AbstractSaveEventListener:193 - executing insertions
16:35:40,445 DEBUG BasicEntityPersister:1705 - Inserting entity: com.stanleygeorge.hibernate3example.businessEntities.Cat (native id)
16:35:40,445 DEBUG AbstractBatcher:258 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
16:35:40,455 DEBUG SQL:292 - insert into CAT (NAME, WEIGHT, CAT_ID) values (?, ?, default)
16:35:40,455 DEBUG AbstractBatcher:343 - preparing statement
16:35:40,495 DEBUG BasicEntityPersister:1587 - Dehydrating entity: [com.stanleygeorge.hibernate3example.businessEntities.Cat#<null>]
16:35:40,535 DEBUG AbstractBatcher:266 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
16:35:40,535 DEBUG AbstractBatcher:363 - closing statement
16:35:40,545 DEBUG JDBCExceptionReporter:49 - could not insert: [com.stanleygeorge.hibernate3example.businessEntities.Cat] [insert into CAT (NAME, WEIGHT, CAT_ID) values (?, ?, default)]
com.ibm.db2.jcc.a.SqlException: DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, SQLERRMC: DB2ADMIN.CAT
at com.ibm.db2.jcc.a.co.e(co.java:1361)
at com.ibm.db2.jcc.a.co.a(co.java:984)
at com.ibm.db2.jcc.b.bd.g(bd.java:121)
at com.ibm.db2.jcc.b.bd.a(bd.java:42)
at com.ibm.db2.jcc.b.r.a(r.java:31)
at com.ibm.db2.jcc.b.bp.g(bp.java:103)
at com.ibm.db2.jcc.a.co.g(co.java:968)
at com.ibm.db2.jcc.a.cp.T(cp.java:1378)
at com.ibm.db2.jcc.a.cp.d(cp.java:1781)
at com.ibm.db2.jcc.a.cp.L(cp.java:348)
at com.ibm.db2.jcc.a.cp.executeUpdate(cp.java:331)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1737)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2149)
at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:34)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:238)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:158)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:104)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:184)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:173)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:429)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:424)
at com.stanleygeorge.hibernate3example.businessEntities.CatManager.adoptCat(CatManager.java:36)
at com.stanleygeorge.hibernate3example.businessEntities.CatManager.main(CatManager.java:54)
16:35:40,545 WARN JDBCExceptionReporter:57 - SQL Error: -204, SQLState: 42704
16:35:40,545 ERROR JDBCExceptionReporter:58 - DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, SQLERRMC: DB2ADMIN.CAT
16:35:40,545 WARN JDBCExceptionReporter:57 - SQL Error: -727, SQLState: 56098
16:35:40,545 ERROR JDBCExceptionReporter:58 - DB2 SQL error: SQLCODE: -727, SQLSTATE: 56098, SQLERRMC: 2;-204;42704;DB2ADMIN.CAT
16:35:40,555 WARN JDBCExceptionReporter:57 - SQL Error: -727, SQLState: 56098
16:35:40,555 ERROR JDBCExceptionReporter:58 - DB2 SQL error: SQLCODE: -727, SQLSTATE: 56098, SQLERRMC: 2;-204;42704;DB2ADMIN.CAT
16:35:40,565 DEBUG JDBCTransaction:124 - rollback
Kee,
Try using this audio format : AudioFormat(AudioFormat.MPEG_RTP, 44100, 16, 2);
You may also want to try replacing MPEG_RTP with GSM_RTP.

Cheers
13 years ago
Kee,
Since you are on the same LAN, I don't think it is a firewall issue.

Try using this audio format : AudioFormat(AudioFormat.MPEG_RTP, 44100, 16, 2);
You may also want to try replacing MPEG_RTP with GSM_RTP.

Cheers
[ January 23, 2005: Message edited by: Stanley George ]
13 years ago
Raj,
As your code is working in Windows, I think it could be a firewall issue in Linux.

Generally a firewall prevents non-HTTP connections initialed by remote machines. Since JMF uses RTP, the firewall blocks it. This is true with mobile ad-hoc networks too.

You can try disabling the firewall using the following command in Linux as root:
service iptables stop

Cheers
[ January 05, 2005: Message edited by: Stanley George ]
13 years ago
Raj,
I am not sure what the problem is. Maybe you can try and use the 'tcpdump' tool in Linux. It spits out information about all the packets that are handled by your system. You can see the source and destination of packets sent via the port used by your application.

Did you try running it on a different OS? I would also look if it is a firewall issue.

Cheers
13 years ago
Hi guys,
Sorry for not being able to respond for a long time. Here are some answers. Hope you find them helpful.

abhisek tripathi:
> I m new to JMF .can u give me a hint

Ahishek,
I read the Programmer's Guide 3-4 times to understand the working of JMF. The JMF API is a good reference when you are reading the guide. You can view the Programmer's Guide at:
http://java.sun.com/products/java-media/jmf/1.0/guide/index.html

-------------------

Sergiu Voicu:
> Does anybody have any idea if an internet voicechat can be done ?

Sergiu,
It can be done. I have made a voicechat app in JMF and it works on dialup!

-------------------

tanay dey:
> When i use the same port number in both AudioTransmit &
> AudioReceive class then a got a problem

Tanay,
Sockets are endpoints to applications that are communicating over the network. If there are multiple applications listening on the same IP Address, they are differentiated by different ports. When you instantiate AudioTransmit & AudioReceive on the same port, it creates contention. The first one to be instantiated will bind the port. No other application/instance may use that port as long as it is bound. Try using different port numbers.

-------------------
Cheers to all
Stanley George
[ November 05, 2004: Message edited by: Stanley George ]
14 years ago
Hi,
I have written a code in C and I am trying to call it in Java.

I used the free compiler lcc to create a dll:

lcc windowssysteminfo.c -If:\j2sdk1.4.2_03\include -If:\j2sdk1.4.2_03\include\win32

lcclnk -dll "windowssysteminfo.obj" netapi32.lib

I get this error:
Specified export _JNI_OnLoad@8 is not defined
Specified export _JNI_OnUnload@8 is not defined
Missing exports. Aborting

Java forum classifies it as: Bug ID: 4202204
This is what they gave as a solution:
Make JNI_CreateJavaVM, JNI_DefaultJavaVMInitArgs, and JNI_GetCreatedJavaVMs JNIIMPORT instead of JNIEXPORT.

I noticed that the above code is applicable when we call Java in C. What I am trying to do is the opposite.

Any suggestions would be highly appreciated.

Thanks
14 years ago
Hi all,
My code runs correctly when i run the clients one after another without using threads.
I am getting this following error when i run my multi-threaded server. When a server accepts a client connection, ClientHandler is the thread that handles that client.
Exception in thread "main" java.io.StreamCorruptedException: invalid stream header
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:737)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:253)
at comm.DOMTransfer.<init>(DOMTransfer.java:25)
at ClientHandler.<init>(ClientHandler.java:18)
at GridInfo.main(GridInfo.java:34)
This is where the error occurs:
input = new ObjectInputStream(socket.getInputStream());
Thank you for your time.
Stanley George
14 years ago
Hi Ali,
The following code works for me:
public void sendFile(File file, Socket socket) throws Exception {
FileInputStream fis = new FileInputStream(file);
DataOutputStream dos = new
DataOutputStream(socket.getOutputStream());
DataInputStream dis = new DataInputStream(fis);
int b = dis.read();
while (b != -1) {
dos.write(b);
b = dis.read();
}
dos.flush();
}
public void recvFile(File file, Socket socket) throws Exception {
FileOutputStream fos = new FileOutputStream(file);
DataOutputStream dos = new DataOutputStream(fos);
DataInputStream dis = new DataInputStream(socket.getInputStream());
int b = dis.read();
while (b != -1) {
dos.write(b);
b = dis.read();
}
dos.flush();
dos.close();
}
Cheers
Stanley George
[ April 09, 2004: Message edited by: Stanley George ]
Hi all,
I am getting this exception while sending and XML document from a client to a server. It works the first time, but not after that.
I have a server which is listening for client connections. When a client connects, it spawns a new thread (ClientHandler) to handle this client. The client sends and XML document to the server. The server prints this out.
The code works fine for the first client. For the next client it gives me the following exception:
javax.xml.transform.TransformerException:java.net.SocketException: Broken pipe
at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:336)
...
The same code works for multiple clients if I am not sending the XML Document.
This is where the error occurs:
public void tcpSendXMLDoc(Document doc, Socket socket) {
throws IOException, TransformerException,TransformerConfigurationException {
// Use a Transformer for output
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();

ObjectOutputStream oos =
new ObjectOutputStream(socket.getOutputStream());
ObjectInputStream ois =
new ObjectInputStream(socket.getInputStream());

DOMSource source = new DOMSource(doc);
StreamResult result = new StreamResult(oos);
transformer.transform(source, result);
}
The Error is show at the last line:
transformer.transform(source, result);
What could be wrong?
Thanks
Stanley George
[ April 09, 2004: Message edited by: Stanley George ]
hello friends,
i have tried VoIP using datasink. the datasink has the IP address of the receiver. receiver listens at its own IP address. works perfect.
the problem is, i want to reverse the IP address requirement. i.e i want the receiver to listen at the IP address of the transmitter. i tried it but i am not getting any audio.am i missing something here?
any and all suggestions are welcome
thank you very much
stanley
16 years ago
hello,
there is a cool app called java2exe made by a gr8 guy jerry jongerius. u can create exe files with it!
u can download the shareware version from:
http://www.duckware.com
warm regards
-stanley
16 years ago
hello all,
can we have a server on the internet wich acts as a buffer between the transmitter and the receiver? then we will not need IP address..
just a theory...is this a practical solution?
can anybody give ANY tips regarding this?
thank you very much.
warm regards,
stanley
16 years ago
hello,
how can ur RTPPlayer and Transmitter(capture & transmit) work behind a proxy?
i have read that u can use HTTP tunneling to get into firewalls. but how can i use this for RTP??
thank u very much
warm regards,
stanley
16 years ago