Win a copy of Terraform in Action this week in the Cloud forum!

sze sze chan

Greenhorn
+ Follow
since Jul 27, 2011
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
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by sze sze chan


Wouter Oet wrote:Is it me or is that kind of wrong . You don't get how to logger works so you comment the logging statements, wouldn't learning how to logger works be a much better solution?



Hi,
I've tried to do research on logging and the properties set up thing kind of confuse me.
this program did not used the normal log4 jar or properties, the previous developer wrote a log4j.xml and log4j.dtd himself.
And sadly I can't figure out how does that two file function when I still very confuse with the basic logging thing. The previous developer didn't really give me much information...
And I did spent few days on that, it always tells me something like log4j properties is not configured. and I tried reinstall all plugins in a new package, it gives me this

The project deadline is just in few days and I still have many many other things to work on, those documentation, user guide, and the Linux thing.

It's all very very very new to me.So I've decided to spend my time on more urgent work.

And I'm not sure if the logging message will be printed when it runs on Unix? So I've tried to comment off the logging and hopefully it won't come out there .... I cant test it out because I still have the problem with class path setting on Unix.

Anyway, I will appreciate it if you could provide any suggestion based on this problem. thanks
10 years ago
Hi everyone,

i'm currently doing a code enhancement on a java program by using eclipse

the previouse version has used logger, and i have no idea how to use log at all....

so I've commanded off the log lines,

however, when i run the program, the program prints many log messages
something like this:


log4j: reset attribute= "false".
log4j: Threshold ="null".
log4j: Retreiving an instance of org.apache.log4j.Logger.
log4j: Setting [gic.dpms] additivity to [true].
log4j: Class name: [org.apache.log4j.rolling.RollingFileAppender]
log4j: Setting property [immediateFlush] to [false].
log4j: Setting property [fileNamePattern] to [/opt/pgadev/log/pegasus.log.%d].
log4j: Parsing layout of class: "org.apache.log4j.PatternLayout"

I'm wondering is there anyway to stop printing the log4j message?
any help will be much appreciated, thanks
10 years ago
Hi everyone,
im currently developing a java program which is run by eclipse and implement with spring framewrok.

And I'm currently facing some problem with spring. when i run the program , there are always few lines of INFO from spring in red:



The program will still be running after the red line print out and will always finish running the program successfully.

anyone has any idea on how to remove the red lines?

any help will be much appreciated .

Thanks !
10 years ago
Hi all,
i've done a java program by using spring framework and many other libraries
now i want to put the program on server so i can execute it by using statement: javac filename
but I'm not sure about the source of compiler, where should i put my libraries on server?
any help will be much appreciated.

thanks!
10 years ago
hummm....
are you trying to find what exception you getting after you input wrong host name ?

why don't you catch any exception then give it a invalid host name and e.tostring to print the exception name ?
for example

try{
your code
}catch(Exception e){
System.out.println("the exception is : " + e.toString());
}


Nathan Pruett wrote:You could call it with java.lang.Integer to be able to cast it to an int... but what are the actual parameters defined on the stored procedure?



Should be String in the stored procedure. I've tried to convert it into int but the error is still there
10 years ago

Nathan Pruett wrote:That error occurs because the parameters you're trying to use to call the stored procedure don't match the parameters that are actually declared on the stored procedure - either it expects some "in" parameters you aren't providing, or the the "out" parameter is declared as a different type than "String".



Hi, thank you for your reply!
are you saying that the String n_setNum = (String)sjc.executeFunction(Class.forName("java.lang.String")); is a different type as the "out" inside the oracle package?
is there anyway I can write String n_setNum = (String)sjc.executeFunction(Class.forName("java.lang.String")); as an integer ?
10 years ago
Hi everyone,

I'm very new to java and spring frame work, and i'm currently working on a java code enhancement program
.
And i'm having some trouble when calling the oracle package.
any help will be much appreciated ! thanks
Below is the error occurs:




the error occurs when the package is called,
the package name stored as below:




and the package is called by using simpleJdbcCall:




the package generates and return a set_nbr and the error occurs at this line:



i'm wondering is there anyway to write this variable : String n_setNum = (String)sjc.executeFunction(Class.forName("java.lang.String"));
as Integer ?
because it is going to store in integer and call another class

10 years ago

Paul Clapham wrote:That's all very well, but the log4j.properties file is where you declare your appenders, and you haven't shown us that.



thank you for your reply
hummm.... i don't have log4j.properties file inside my package....
should i just create one ? what should I put inside?
10 years ago
Hi everyone,

I'm very new to java and spring and I'm currently trying to enhance a set of java code by using eclipse 3.1.1 and Springframework 3.0.5
however, i'm stuck at this error :

log4j:WARN No appenders could be found for logger (org.springframework.core.io.support.PathMatchingResourcePatternResolver).
log4j:WARN Please initialize the log4j system properly.


I've defined logger in all of my classes that involves with logger.debug for example , in my main class:

JobMgmt.java


DBHelper.java


JdbcDao.java



i don't really understand or knowing how to use logger as I did not write the previous code myself.
does the " static private log logger = " means that it careates classes when it run ?
I've installed log4j.jar and spring-core.jar but it doesn't help

anyone has any idea how to solve or what might caused the problem ?
any help would be much approciated.
Thank you
10 years ago

Ulf Dittmer wrote:While we can't be sure what's going on since we don't know what the Scrambler and Encryptor classes are doing, calling "toString" on the output is a read flag - assuming that it converts a byte[] to a string, not specifying the encoding makes the code platform-dependent.

Make sure the key and the ciphertext are never stored (or used) as strings anywhere.



Hi, thank you for your reply, I'm still keep hitting the same BadPaddingException
I will really appreciate it if you could help, thanks

this is my Scramble.java:


and Encryptor.java
10 years ago
Hi all !
I'm very new to spring and eclipse, and I'm currently working on a codeEnhancement project.
It's my second day to post on this Forum(the only one forum i ever entered), and I think i'm already falling in love with this place!

I'm currently trying to decrypt a password from a decrypt file and use the password to connect to oracle database.
However, I've encourntered a number of errors with this

the first Error is when i set my proxy in eclipse, The error log pops out and states that:
Keybinding conflicts occurred.They may interfere with normail accelerator operation
org.eclipse.core.runtime.AssertionFailedException:assertion failed:
Unhandled event loop exception

Any help will be much appreciated



When i run my codes, it hits the following error:

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'PoolingDao' defined in class path resource [jobmgmt_beans.xml]: Invocation of init method failed; nested exception is javax.crypto.BadPaddingException: Given final block not properly padded
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
at net.CodeEnhancement.JobMgmt.main(JobMgmt.java:118)
Caused by: javax.crypto.BadPaddingException: Given final block not properly padded
at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
at com.sun.crypto.provider.AESCipher.engineDoFinal(DashoA13*..)
at javax.crypto.Cipher.doFinal(DashoA13*..)
at net.CodeEnhancement.Scrambler.unscramble(Scrambler.java:76)
at net.CodeEnhancement.JdbcDao.decrypt(JdbcDao.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1544)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
... 12 more


I've read some about BadPaddingException and there are people suggeting to store the encrypted variable in byte[].
I've tried it inside my DAO, but it still hits the same error during runtime.

Below is my JdbcDao.java:



and my jobmgmt_beans.xml which has the bean id= PoolingDao:



Any help will be much appreciated
10 years ago

Craig Walls wrote:
The DTD is *so* Spring 1.0.

Start with the following, then fill in the blanks:



thank you for your reply, now the little cross mark is gone :jumpingjoy
10 years ago

Sagar Rohankar wrote:

sze sze chan wrote:Do I need to set anything for proxy ?


Only if you're inside the proxy network.



hi ,
i've set the HTTP proxy and SSL proxy, which are the proxy and port.
but everytime i set it it has error : org.eclipse.core.runtime.AssertionFailedException:assertion failed;
any idea on what it this? btw, the red cross of jobmgmt_beans.xml is still there

thanks for your help
10 years ago

Sagar Rohankar wrote:

sze sze chan wrote:
I'm thinking could the problem caused by
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN //EN" "http://www.springframework.org/dtd/spring-beans.dtd">
inside the .xml file?
as I'm using sping 3x, is that the right dtd ?


This is the one I used in my project, try this:
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
OR I suspect the proxy problem if you're inside the network. The eclipse is trying tho access that DTD link but somehow not able to reach. Check you network connection in Eclipse.



Hi, i've tried the dtd link it still doesn't work.....
and I went to the eclipse network connection, it was set to "Direct connection to internet" and the proxy is by default, it's blank inside the manual proxy configuration. Do I need to set anything for proxy ?
10 years ago