Craig Williams

Greenhorn
+ Follow
since Apr 26, 2004
Merit badge: grant badges
For More
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 Craig Williams

Hello

Basically i want to transfer files(local drive) from one system to another system.
No web application is involved here.
Which one is best ....

URLConnection or Socket Programming ...
whether this type of file transfer is possible ...
We assume there is no Firewall is enable.
Hello Everybody

I want to view the log file in Unix OS.Normally we use tail command to view
the log file contents dyanmically (as the log file changes, it shows the latest change to that log file).
Basically i want to simulate the same thing with Swing component.
Kindly let me know which component i can use.. more like editor where i would give the file to be viewed..It should be dynamically show me the content of the log file.

Shed some light on this.I would really appreciate
16 years ago
Hello Everybody

I am facing very big issue in Prod environment(SUSE Linux) when we deploy our application in a machine(acting as DHCP) which
have two LAN cards.
Our application is built on J2SDK.1.4.2 with JBoss Messaging(jboss-messaging-1.0.1.GA)
we have tested our application well in terms of messaging also.

I will just explain the scenario
MachineA - machine with LAN Card-A,IP Address-172.19.6.6
MachineB(acting as DHCP) - machine with LAN Card-A,IP Address-172.19.6.7 and LAN Card-B,IP Address-10.0.18.101
MachineC - machine with LAN Card-B,IP Address-10.0.18.102

All the machine has got SUSE Linux

Messaging should flow from MachineB to MachineA and vice versa
Messaging should flow from MachineB to MachineC and vice versa
But any point of time , MachineC cannot communicate directly to MachineA.It can be only thru MachineB

I have JBoss Messaging Server running in MachineA and MachineB alone.
I have also specified the following below entries.I have also changed the IP address respective to thier JBoss Messaging Server
in the below entries

Config details
==============
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming rg.jnp.interfaces
java.naming.provider.url=jnp://127.0.0.1:1099

All topic related configurations are done already and messaging flows cleanly when tested with
machine having single LAN cards

Now MachineB(with Two LAN Card) wants to receive the message from MachineA
all config details specified above are done duly at MachineB in order to connect with JBoss Messaging server running on MachineA
and also tested when MachineB has single LAN card.
when i start the receiver at MachineB(With two LAN card) , i get exception at receiver side.
I have attached the logs along with the exception for your reference .

Following is the information i got when i execute "ifconfig" in SUSE Linux:


starahdsat:/opt/test # ifconfig
eth0 Link encap:Ethernet HWaddr 00:19 B:2F:24:F9
inet addr:10.0.18.101 Bcast:10.0.18.255 Mask:255.255.255.0
inet6 addr: fe80::219 bff:fe2f:24f9/64 Scope:Link
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:7876 errors:0 dropped:0 overruns:0 frame:0
TX packets:15737 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:516182 (504.0 Kb) TX bytes:23280180 (22.2 Mb)
Interrupt:11


eth1 Link encap:Ethernet HWaddr 00:80:C8:04:6E:39
inet addr:172.19.6.7 Bcast:172.19.6.255 Mask:255.255.255.0
inet6 addr: fe80::280:c8ff:fe04:6e39/64 Scope:Link
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:9697 errors:0 dropped:0 overruns:0 frame:0
TX packets:1598 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:860343 (840.1 Kb) TX bytes:250335 (244.4 Kb)
Interrupt:10 Base address:0xbc00


lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:373 errors:0 dropped:0 overruns:0 frame:0
TX packets:373 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:42085 (41.0 Kb) TX bytes:42085 (41.0 Kb)


Exception

DEBUG 2007-Apr-09 03:20:17 readSlotWithFields slot=java.lang.StackTraceElement field=fileName<<-reading Object
DEBUG 2007-Apr-09 03:20:17 Reading string with utfSize=31 isLong=false
DEBUG 2007-Apr-09 03:20:17 readString: ulling data to Buffer at pos 0 size= 0
DEBUG 2007-Apr-09 03:20:17 FieldName on Read=methodName
DEBUG 2007-Apr-09 03:20:17 readSlotWithFields slot=java.lang.StackTraceElement field=methodName<<-reading Object
DEBUG 2007-Apr-09 03:20:17 Reading string with utfSize=6 isLong=false
DEBUG 2007-Apr-09 03:20:17 readString: ulling data to Buffer at pos 0 size= 0
DEBUG 2007-Apr-09 03:20:17 FieldName on Read=declaringClass
DEBUG 2007-Apr-09 03:20:17 readSlotWithFields slot=java.lang.StackTraceElement field=declaringClass<<-reading Object
DEBUG 2007-Apr-09 03:20:17 Reading string with utfSize=56 isLong=false
DEBUG 2007-Apr-09 03:20:17 readString: ulling data to Buffer at pos 0 size= 0
DEBUG 2007-Apr-09 03:20:17 objectFromDescription::reading new definition
DEBUG 2007-Apr-09 03:20:17 Reading object for id=16 classLoader=sun.misc.Launcher$AppClassLoader@542e4b1b className = java.lang.StackTraceElement
DEBUG 2007-Apr-09 03:20:17 defaultRead::class java.lang.StackTraceElement contains 1 slots
DEBUG 2007-Apr-09 03:20:17 defaultRead::slot[0]=java.lang.StackTraceElement
DEBUG 2007-Apr-09 03:20:17 readSlotWithFields slot=java.lang.StackTraceElement
DEBUG 2007-Apr-09 03:20:17 FieldName on Read=lineNumber
DEBUG 2007-Apr-09 03:20:17 FieldName on Read=fileName
DEBUG 2007-Apr-09 03:20:17 readSlotWithFields slot=java.lang.StackTraceElement field=fileName<<-reading Object
DEBUG 2007-Apr-09 03:20:17 Reading string with utfSize=18 isLong=false
DEBUG 2007-Apr-09 03:20:17 readString: ulling data to Buffer at pos 0 size= 0
DEBUG 2007-Apr-09 03:20:17 FieldName on Read=methodName
DEBUG 2007-Apr-09 03:20:17 readSlotWithFields slot=java.lang.StackTraceElement field=methodName<<-reading Object
DEBUG 2007-Apr-09 03:20:17 Reading string with utfSize=6 isLong=false
DEBUG 2007-Apr-09 03:20:17 readString: ulling data to Buffer at pos 0 size= 0
DEBUG 2007-Apr-09 03:20:17 FieldName on Read=declaringClass
DEBUG 2007-Apr-09 03:20:17 readSlotWithFields slot=java.lang.StackTraceElement field=declaringClass<<-reading Object
DEBUG 2007-Apr-09 03:20:17 Reading string with utfSize=32 isLong=false
DEBUG 2007-Apr-09 03:20:17 readString: ulling data to Buffer at pos 0 size= 0
DEBUG 2007-Apr-09 03:20:17 objectFromDescription::reading new definition
DEBUG 2007-Apr-09 03:20:17 Reading object for id=20 classLoader=sun.misc.Launcher$AppClassLoader@542e4b1b className = java.lang.StackTraceElement
DEBUG 2007-Apr-09 03:20:17 defaultRead::class java.lang.StackTraceElement contains 1 slots
DEBUG 2007-Apr-09 03:20:17 defaultRead::slot[0]=java.lang.StackTraceElement
DEBUG 2007-Apr-09 03:20:17 readSlotWithFields slot=java.lang.StackTraceElement
DEBUG 2007-Apr-09 03:20:17 FieldName on Read=lineNumber
DEBUG 2007-Apr-09 03:20:17 FieldName on Read=fileName
DEBUG 2007-Apr-09 03:20:17 readSlotWithFields slot=java.lang.StackTraceElement field=fileName<<-reading Object
DEBUG 2007-Apr-09 03:20:17 Reading string with utfSize=18 isLong=false
DEBUG 2007-Apr-09 03:20:17 readString: ulling data to Buffer at pos 0 size= 0
DEBUG 2007-Apr-09 03:20:17 FieldName on Read=methodName
DEBUG 2007-Apr-09 03:20:17 readSlotWithFields slot=java.lang.StackTraceElement field=methodName<<-reading Object
DEBUG 2007-Apr-09 03:20:17 Reading string with utfSize=6 isLong=false
DEBUG 2007-Apr-09 03:20:17 readString: ulling data to Buffer at pos 0 size= 0
DEBUG 2007-Apr-09 03:20:17 FieldName on Read=declaringClass
DEBUG 2007-Apr-09 03:20:17 readSlotWithFields slot=java.lang.StackTraceElement field=declaringClass<<-reading Object
DEBUG 2007-Apr-09 03:20:17 Reading string with utfSize=32 isLong=false
DEBUG 2007-Apr-09 03:20:17 readString: ulling data to Buffer at pos 0 size= 0
DEBUG 2007-Apr-09 03:20:17 objectFromDescription::reading new definition
DEBUG 2007-Apr-09 03:20:17 Reading object for id=24 classLoader=sun.misc.Launcher$AppClassLoader@542e4b1b className = java.lang.StackTraceElement
DEBUG 2007-Apr-09 03:20:17 defaultRead::class java.lang.StackTraceElement contains 1 slots
DEBUG 2007-Apr-09 03:20:17 defaultRead::slot[0]=java.lang.StackTraceElement
DEBUG 2007-Apr-09 03:20:17 readSlotWithFields slot=java.lang.StackTraceElement
DEBUG 2007-Apr-09 03:20:17 FieldName on Read=lineNumber
DEBUG 2007-Apr-09 03:20:17 FieldName on Read=fileName
DEBUG 2007-Apr-09 03:20:17 readSlotWithFields slot=java.lang.StackTraceElement field=fileName<<-reading Object
DEBUG 2007-Apr-09 03:20:17 Reading string with utfSize=17 isLong=false
DEBUG 2007-Apr-09 03:20:17 readString: ulling data to Buffer at pos 0 size= 0
DEBUG 2007-Apr-09 03:20:17 FieldName on Read=methodName
DEBUG 2007-Apr-09 03:20:17 readSlotWithFields slot=java.lang.StackTraceElement field=methodName<<-reading Object
DEBUG 2007-Apr-09 03:20:17 Reading string with utfSize=17 isLong=false
DEBUG 2007-Apr-09 03:20:17 readString: ulling data to Buffer at pos 0 size= 0
DEBUG 2007-Apr-09 03:20:17 FieldName on Read=declaringClass
DEBUG 2007-Apr-09 03:20:17 readSlotWithFields slot=java.lang.StackTraceElement field=declaringClass<<-reading Object
DEBUG 2007-Apr-09 03:20:17 Reading string with utfSize=48 isLong=false
DEBUG 2007-Apr-09 03:20:17 readString: ulling data to Buffer at pos 0 size= 0
DEBUG 2007-Apr-09 03:20:17 objectFromDescription::reading new definition
DEBUG 2007-Apr-09 03:20:17 Reading object for id=28 classLoader=sun.misc.Launcher$AppClassLoader@542e4b1b className = java.lang.StackTraceElement
DEBUG 2007-Apr-09 03:20:17 defaultRead::class java.lang.StackTraceElement contains 1 slots
DEBUG 2007-Apr-09 03:20:17 defaultRead::slot[0]=java.lang.StackTraceElement
DEBUG 2007-Apr-09 03:20:17 readSlotWithFields slot=java.lang.StackTraceElement
DEBUG 2007-Apr-09 03:20:17 FieldName on Read=lineNumber
DEBUG 2007-Apr-09 03:20:17 FieldName on Read=fileName
DEBUG 2007-Apr-09 03:20:17 readSlotWithFields slot=java.lang.StackTraceElement field=fileName<<-reading Object
DEBUG 2007-Apr-09 03:20:17 Reading string with utfSize=17 isLong=false
DEBUG 2007-Apr-09 03:20:17 readString: ulling data to Buffer at pos 0 size= 0
DEBUG 2007-Apr-09 03:20:17 FieldName on Read=methodName
DEBUG 2007-Apr-09 03:20:17 readSlotWithFields slot=java.lang.StackTraceElement field=methodName<<-reading Object
DEBUG 2007-Apr-09 03:20:17 Reading string with utfSize=5 isLong=false
DEBUG 2007-Apr-09 03:20:17 readString: ulling data to Buffer at pos 0 size= 0
DEBUG 2007-Apr-09 03:20:17 FieldName on Read=declaringClass
DEBUG 2007-Apr-09 03:20:17 readSlotWithFields slot=java.lang.StackTraceElement field=declaringClass<<-reading Object
DEBUG 2007-Apr-09 03:20:17 Reading string with utfSize=48 isLong=false
DEBUG 2007-Apr-09 03:20:17 readString: ulling data to Buffer at pos 0 size= 0
DEBUG 2007-Apr-09 03:20:17 objectFromDescription::reading new definition
DEBUG 2007-Apr-09 03:20:17 Reading object for id=32 classLoader=sun.misc.Launcher$AppClassLoader@542e4b1b className = java.lang.StackTraceElement
DEBUG 2007-Apr-09 03:20:17 defaultRead::class java.lang.StackTraceElement contains 1 slots
DEBUG 2007-Apr-09 03:20:17 defaultRead::slot[0]=java.lang.StackTraceElement
DEBUG 2007-Apr-09 03:20:17 readSlotWithFields slot=java.lang.StackTraceElement
DEBUG 2007-Apr-09 03:20:17 FieldName on Read=lineNumber
DEBUG 2007-Apr-09 03:20:17 FieldName on Read=fileName
DEBUG 2007-Apr-09 03:20:17 readSlotWithFields slot=java.lang.StackTraceElement field=fileName<<-reading Object
DEBUG 2007-Apr-09 03:20:17 Reading string with utfSize=17 isLong=false
DEBUG 2007-Apr-09 03:20:17 readString: ulling data to Buffer at pos 0 size= 0
DEBUG 2007-Apr-09 03:20:17 FieldName on Read=methodName
DEBUG 2007-Apr-09 03:20:17 readSlotWithFields slot=java.lang.StackTraceElement field=methodName<<-reading Object
DEBUG 2007-Apr-09 03:20:17 Reading string with utfSize=3 isLong=false
DEBUG 2007-Apr-09 03:20:17 readString: ulling data to Buffer at pos 0 size= 0
DEBUG 2007-Apr-09 03:20:17 FieldName on Read=declaringClass
DEBUG 2007-Apr-09 03:20:17 readSlotWithFields slot=java.lang.StackTraceElement field=declaringClass<<-reading Object
DEBUG 2007-Apr-09 03:20:17 Reading string with utfSize=48 isLong=false
DEBUG 2007-Apr-09 03:20:17 readString: ulling data to Buffer at pos 0 size= 0
DEBUG 2007-Apr-09 03:20:17 FieldName on Read=cause
DEBUG 2007-Apr-09 03:20:17 readSlotWithFields slot=java.lang.Throwable field=cause<<-reading Object
DEBUG 2007-Apr-09 03:20:17 objectFromDescription::reading circular definition reference=3
DEBUG 2007-Apr-09 03:20:17 FieldName on Read=detailMessage
DEBUG 2007-Apr-09 03:20:17 readSlotWithFields slot=java.lang.Throwable field=detailMessage<<-reading Object
DEBUG 2007-Apr-09 03:20:17 Reading string with utfSize=60 isLong=false
DEBUG 2007-Apr-09 03:20:17 readString: ulling data to Buffer at pos 0 size= 0
DEBUG 2007-Apr-09 03:20:17 defaultRead::slot[1]=java.lang.Exception
DEBUG 2007-Apr-09 03:20:17 readSlotWithFields slot=java.lang.Exception
DEBUG 2007-Apr-09 03:20:17 defaultRead::slot[2]=org.jboss.aop.DispatcherConnectException
DEBUG 2007-Apr-09 03:20:17 readSlotWithFields slot=org.jboss.aop.DispatcherConnectException
DEBUG 2007-Apr-09 03:20:17 defaultRead::slot[3]=org.jboss.aop.NotFoundInDispatcherException
DEBUG 2007-Apr-09 03:20:17 readSlotWithFields slot=org.jboss.aop.NotFoundInDispatcherException
DEBUG 2007-Apr-09 03:20:17 FieldName on Read=oid
DEBUG 2007-Apr-09 03:20:17 readSlotWithFields slot=org.jboss.aop.NotFoundInDispatcherException field=oid<<-reading Object
DEBUG 2007-Apr-09 03:20:17 FieldName on Read=isException
DEBUG 2007-Apr-09 03:20:17 FieldName on Read=sessionId
DEBUG 2007-Apr-09 03:20:17 readSlotWithFields slot=org.jboss.remoting.InvocationResponse field=sessionId<<-reading Object
DEBUG 2007-Apr-09 03:20:17 Reading string with utfSize=34 isLong=false
DEBUG 2007-Apr-09 03:20:17 readString: ulling data to Buffer at pos 0 size= 0
ERROR 2007-Apr-09 03:20:17 Caught Exception:
org.jboss.aop.NotFoundInDispatcherException: Object with oid: -2147483646 was not found in the Dispatcher
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:85)
at org.jboss.jms.server.remoting.JMSServerInvocationHandler.invoke(JMSServerInvocationHandler.java:127)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:1008)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:857)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:454)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:541)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:261)
at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:172)
at org.jboss.remoting.Client.invoke(Client.java:589)
at org.jboss.remoting.Client.invoke(Client.java:581)
at org.jboss.jms.client.delegate.DelegateSupport.invoke(DelegateSupport.java:111)
at org.jboss.jms.client.delegate.ClientConnectionDelegate$createSessionDelegate_6052335267724906805.invokeNext(ClientConnectionDelegate$createSessionDelegate_6052335267724906805.java)
at org.jboss.jms.client.container.StateCreationAspect.handleCreateSessionDelegate(StateCreationAspect.java:101)
at org.jboss.aop.advice.org.jboss.jms.client.container.StateCreationAspect1.invoke(StateCreationAspect1.java)
at org.jboss.jms.client.delegate.ClientConnectionDelegate$createSessionDelegate_6052335267724906805.invokeNext(ClientConnectionDelegate$createSessionDelegate_6052335267724906805.java)
at org.jboss.jms.client.container.ConnectionAspect.handleCreateSessionDelegate(ConnectionAspect.java:164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
at java.lang.reflect.Method.invoke(Method.java:391)
at org.jboss.aop.advice.PerInstanceAdvice.invoke(PerInstanceAdvice.java:130)
at org.jboss.jms.client.delegate.ClientConnectionDelegate$createSessionDelegate_6052335267724906805.invokeNext(ClientConnectionDelegate$createSessionDelegate_6052335267724906805.java)
at org.jboss.jms.client.container.ClosedInterceptor.invoke(ClosedInterceptor.java:182)
at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:117)
at org.jboss.jms.client.delegate.ClientConnectionDelegate$createSessionDelegate_6052335267724906805.invokeNext(ClientConnectionDelegate$createSessionDelegate_6052335267724906805.java)
at org.jboss.jms.client.container.ExceptionInterceptor.invoke(ExceptionInterceptor.java:69)
at org.jboss.jms.client.delegate.ClientConnectionDelegate$createSessionDelegate_6052335267724906805.invokeNext(ClientConnectionDelegate$createSessionDelegate_6052335267724906805.java)
at org.jboss.jms.client.container.ClientLogInterceptor.invoke(ClientLogInterceptor.java:107)
at org.jboss.jms.client.delegate.ClientConnectionDelegate$createSessionDelegate_6052335267724906805.invokeNext(ClientConnectionDelegate$createSessionDelegate_6052335267724906805.java)
at org.jboss.jms.client.delegate.ClientConnectionDelegate.createSessionDelegate(ClientConnectionDelegate.java)
at org.jboss.jms.client.JBossConnection.createSessionInternal(JBossConnection.java:255)
at org.jboss.jms.client.JBossConnection.createSession(JBossConnection.java:91)
at com.tcs.retail.framework.messaging.core.consumer.MsgConsumer.consumeProcess(MsgConsumer.java:144)
at com.tcs.retail.framework.messaging.core.receiver.MessageReceiver.createConsumer(MessageReceiver.java:201)
at com.tcs.retail.framework.messaging.core.receiver.MessageReceiver.activateNormalConsumers(MessageReceiver.java:97)
at com.tcs.retail.framework.messaging.core.receiver.MessageReceiver.receive(MessageReceiver.java:45)
at com.tcs.retail.framework.messaging.core.receiver.MessageReceiver.main(MessageReceiver.java:280)
ERROR 2007-Apr-09 03:20:17 MsgConsumer : Exception Occured
Exception Cause --> org.jboss.jms.client.container.ExceptionInterceptor(org.jboss.jms.util.MessagingJMSException: Caught exception)
Exception Cause --> org.jboss.jms.client.delegate.ClientConnectionDelegate$createSessionDelegate_6052335267724906805(org.jboss.jms.util.MessagingJMSException: Caught exception)
Exception Cause --> org.jboss.jms.client.container.ClientLogInterceptor(org.jboss.jms.util.MessagingJMSException: Caught exception)
Exception Cause --> org.jboss.jms.client.delegate.ClientConnectionDelegate$createSessionDelegate_6052335267724906805(org.jboss.jms.util.MessagingJMSException: Caught exception)
Exception Cause --> org.jboss.jms.client.delegate.ClientConnectionDelegate(org.jboss.jms.util.MessagingJMSException: Caught exception)
Exception Cause --> org.jboss.jms.client.JBossConnection(org.jboss.jms.util.MessagingJMSException: Caught exception)
Exception Cause --> org.jboss.jms.client.JBossConnection(org.jboss.jms.util.MessagingJMSException: Caught exception)
17 years ago
I have unzipped version of Jboss4.0.4.GA.I have copied this folder in windows machine and executed 'run.bat' under bin directory.The Jboss server started without any problems.But when I copy the same folder to Linux machine and executed 'run.sh' under bin directory,the server didn't start and threw an error message
'The JVM option is invalid: -server
Could not create the Java virtual machine'

I am using SunJRE 1.4.2 on Windows machine
I am using IBMJRE 1.4.2 on Linux machine

Is there any problem with IBM JRE 1.4.2.If any problem with JRE , is there any patch available to be used with JBoss.

Please provide suitable solution to overcome this problem.
17 years ago
Hello everybody

we are developing a new swing based application which needs to be deployed in Linux machine and also in Windows machine.
basically we need installer to do deployment in Linux environment.

I have seen RPM packages being used as an installer in Linux.

Is there any way we can create package of that sort to deploy my application in linux enviornment. If so ,please tell me ways to create that package ..

Is there any way to create package apart from RPM.

I also need the same thing to be done in windows .please suggest me a way to do the same thing
17 years ago
I am very new to J2ME .I have 4+ year experience in J2EE.
We have developed a swing application which is going to run on POS terminal in retail stores.

We need to make that application run on PDA and as well as Mobile .

I am assuming that deploying an application in PDA or Mobile needs J2ME as java platform... If this assumption is wrongg, please correct me .

Need a very good book for better understanding of J2ME developement.

Also need forums on these type of developement apart from Javaranch .

This is my first post in this topic.
17 years ago
Thanks very much.
Also saw the link which you specified in your reply.
The problem is with the conversion of encrypted text to String.
17 years ago
I use DES algorithm to create a key and store it in a file which can be used for future encryption and decryption of the confidential data in our project.

I use doEncrypt() method to encyrpt the data and the encrypted data gets stored in table under a column of type VARCHAR(10) in MYSql database.
When i retrieve the data from that column i get a different value compared to the value that gets stored in that column, because of that i could not able to decrypt the encrypted text to the original content.
Following is the exception i got when decrypting

javax.crypto.IllegalBlockSizeException: Input length (with padding) not multiple of 8 bytes
at com.sun.crypto.provider.SunJCE_h.a(DashoA12275)
at com.sun.crypto.provider.SunJCE_h.b(DashoA12275)
at com.sun.crypto.provider.SunJCE_h.b(DashoA12275)
at com.sun.crypto.provider.DESCipher.engineDoFinal(DashoA12275)
at javax.crypto.Cipher.doFinal(DashoA12275)
at com.tcs.retail.pos.encrypt.CryptographySvcImpl.doDeCrypt(CryptographySvcImpl.java:172)
at com.tcs.retail.pos.service.UserSvcImpl.loginUser(UserSvcImpl.java:276)
at com.tcs.retail.pos.service.UserSvcImpl.main(UserSvcImpl.java:756)

Help me on this to find out a suitable solution.


Following are the methods which does the following operations
process() - Stores the generated key into a file called "key.bin" using saveToFile()

doEncrypt() - takes in actual data that needs to be encrypted and it makes use of getDataFromFile() and getKey().

getDataFromFile() - retrieves the keydata from the filee "key.bin"

getKey() - converts the keydata to acutal key that can be used for encryption and decryption process.

doDeCrypt() - does the decryption process.

// this method wud be called only once for the very first(may be in constructor), when key needs to be stored in a file
private void process()
{
try {
KeyGenerator keyGen = KeyGenerator.getInstance("DES") ;
keyGen.init(56);
Key poKeyObj = keyGen.generateKey();
byte[] keyData = poKeyObj.getEncoded();
saveToFile(keyData);
} catch (Exception e) {
e.printStackTrace();
}
}

// Method to Save the keydata in a file
private void saveToFile(byte[] byteData)
{
FileOutputStream fos = null ;
try {
fos = new FileOutputStream(new File("key.bin") );
fos.write(byteData);
fos.flush();
fos.close();
} catch (Exception e) {
e.printStackTrace();
}
}

// Method to encrypt the actual data
public String doEncrypt(String data) {
byte[] keyData = null ;
SecretKey key = null ;
String psEncryptedData = "" ;
try {

// Getting the keydata from another method
keyData = getDataFromFile("key.bin");

// Converting the keydata to SecretKey
key = getKey(keyData);
Cipher encryptCipher = Cipher.getInstance("DES/ECB/PKCS5Padding");
encryptCipher.init(Cipher.ENCRYPT_MODE,key);
byte[] actualData = data.getBytes();
byte[] ciphertext = encryptCipher.doFinal(actualData);
psEncryptedData = new String(ciphertext);
} catch (Exception e) {
e.printStackTrace();
}
return psEncryptedData;
}

// Method to get the keydata from a file
private byte[] getDataFromFile(String fileName )
{
FileInputStream fis = null ;
byte[] keyData = null ;
try
{
fis = new FileInputStream(new File(fileName) );
int iLength = fis.available();
keyData = new byte[iLength];
fis.read(keyData);
fis.close();
}
catch(Exception e)
{
e.printStackTrace();
}
return keyData ;
}

// Method to convert keydata to actual key that can be used for encryption or decryption
private SecretKey getKey(byte[] encodedData ) throws Exception
{
SecretKey key = null ;
SecretKeyFactory secKeyFactory = null ;
DESKeySpec keySpec = null ;

secKeyFactory = SecretKeyFactory.getInstance("DES");
keySpec = new DESKeySpec(encodedData);
key = secKeyFactory.generateSecret(keySpec);
return key ;
}

// Method to decrypt the encrypted text
public String doDeCrypt(String data)
{
byte[] keyData = null ;
SecretKey key = null ;
String psActualData = "" ;
byte[] encryptedData = null ;
byte[] actualDataObj = null ;
try
{
// Get the keydata from a file
keyData = getDataFromFile("key.bin");
// convert the keydata to secretkey
key = getKey(keyData);
encryptedData = data.getBytes();
Cipher decryptCipher = Cipher.getInstance("DES/ECB/PKCS5Padding");
decryptCipher.init(Cipher.DECRYPT_MODE,key );
actualDataObj = decryptCipher.doFinal(encryptedData);
psActualData = new String(actualDataObj);

} catch (Exception e) {
e.printStackTrace();
}
return psActualData ;
}
17 years ago
Hi
We have a requirement to store files into database and later we need to retrieve it.We need to store Excel files with contents.We have a column of type of Blob in Oracle Database 9.X.we have used OraclePreparedStatement,BLOB of oracle implementation to store the excel file content into database.the data gets stored in the database.We have used Oracle implementation of BLOB and OracleResultSet to retrieve the data from that BLOB column.After retrieving and converting into physical file ,when i tried to open the excel file,i get a popup "Unable to Read" and file gets opened,but i cud not able to find any contents in the excel file.
Please tell a suitable way to handle this type of issues.