peter tong

Ranch Hand
+ Follow
since Mar 15, 2008
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
56
Given in last 30 days
2
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by peter tong

Tim Holloway wrote:

peter tong wrote:

Himai Minh wrote:First of all, have you tried @Autowired instead of @Inject?
Secondly, do you have @ComponentScan (basePackages = "....") //where basePackage is the name of the base package such as "com.example" ?



Oh, yes, after change to @Autowired, apple1 can be injected

But why @Inject cannot?
My classpath has javaee-web-api-8.0-sources.jar.



Because @Inject is a CDI annotation, not a Spring annotation.

@Autowired tells Spring to consult its BeanFactory, construct the bean to be injected (if it's not already existing) and set the property value to reference that bean. @Inject references the CDI container, not Spring.



"@Inject references the CDI container, not Spring.", yes, I try to use @Inject and test in wildfly server, then even @Inject can do what I want.
2 days ago

Himai Minh wrote:First of all, have you tried @Autowired instead of @Inject?
Secondly, do you have @ComponentScan (basePackages = "....") //where basePackage is the name of the base package such as "com.example" ?



Oh, yes, after change to @Autowired, apple1 can be injected

But why @Inject cannot?
My classpath has javaee-web-api-8.0-sources.jar.
4 days ago
I have no used @SpringBootApplication annotation, in fact I am new in spring, I expect Spring container will create and manage the TestController class as it has @Controller annotation and will instantiate, inject its member field.
I have checked my application pom, it has not use spring boot. the pom is as follow:


Is this related?
5 days ago
when enter url http://localhost:8080/MySpringMvc/home/test1, I expect apple1 will be injected but not, its value is null, why?







6 days ago
Oh yes, in \.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\server.xml, I found something



I have deleted and added the server in tomcat many times, but don't know why this settings is still in tmp0\conf\server.xml
1 month ago
but I have no application deployed, it is a fresh tomcat..., so don't know why it try to connect oracle for what application?

1 month ago
the tomcat is freshly installed and no any web project on it, I can succesfully start up by using apache-tomcat-9.0.41\bin\startup.bat, but if I start up inside eclipse, many error show in console as follow: why?

1 month ago
RAD7.5, ws server 7.0
if I modified file in my workspace and start the server, the following error is shown:


[12/5/16 16:41:01:381 CST] 00000017 wtp           W org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ArchiveImpl cleanupAfterTempSave Rename failure during final save; transfer failure failure during final save;this may result in a failure to save updates to the archive, or in a corruption of the original archive.
[12/5/16 16:41:01:611 CST] 00000017 SystemErr     R org.eclipse.jst.j2ee.commonarchivecore.internal.exception.SaveFailureException: IWAE0017E Unable to replace original archive: C:\Program Files\IBM\SDP\runtimes\base_v7\profiles\AppSrv03\wstemp\wstemp\app_158ce240c1f\mrg\cwss_apps.war
[12/5/16 16:41:01:611 CST] 00000017 SystemErr     R at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ArchiveImpl.cleanupAfterTempSave(ArchiveImpl.java:496)
[12/5/16 16:41:01:611 CST] 00000017 SystemErr     R at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ArchiveImpl.extractNoReopen(ArchiveImpl.java:1165)
[12/5/16 16:41:01:611 CST] 00000017 SystemErr     R at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ArchiveImpl.extractNoReopen(ArchiveImpl.java:1024)
[12/5/16 16:41:01:611 CST] 00000017 SystemErr     R at com.ibm.ws.management.application.AppUpdate.createDirsInPath(AppUpdate.java:206)
[12/5/16 16:41:01:611 CST] 00000017 SystemErr     R at com.ibm.ws.management.application.AppUpdate.mergeFiles(AppUpdate.java:128)
[12/5/16 16:41:01:611 CST] 00000017 SystemErr     R at com.ibm.ws.management.application.task.FileMergeTask.updatePartialEar(FileMergeTask.java:376)
[12/5/16 16:41:01:611 CST] 00000017 SystemErr     R at com.ibm.ws.management.application.task.FileMergeTask.update(FileMergeTask.java:301)
[12/5/16 16:41:01:611 CST] 00000017 SystemErr     R at com.ibm.ws.management.application.task.FileMergeTask.performTask(FileMergeTask.java:148)
[12/5/16 16:41:01:611 CST] 00000017 SystemErr     R at com.ibm.ws.management.application.SchedulerImpl.run(SchedulerImpl.java:294)
[12/5/16 16:41:01:611 CST] 00000017 SystemErr     R at java.lang.Thread.run(Thread.java:767)



I already installed the latest fix patch:FP0000041
4 years ago
In my rad 7.5, WebSphere Application Server v7.0, when I start it, the console show:
[12/5/16 15:38:45:259 CST] 00000008 SystemOut     O startup HTTP server on http://10.171.34.21:9083/cwss/soap
[12/5/16 15:38:45:306 CST] 00000000 TCPChannel    I   TCPC0001I: TCP Channel TCP_2 is listening on host *  (IPv6) port 9081.
1) I don't know where the 9083 is defined in "startup HTTP server on http://10.171.34.21:9083/cwss/soap"?
2) also should the above two statement use the same port? now one is 9083, one is 9081.
3) if I have another application and want to call the function in this server, should I use 9081 or 9083?
attached images are the console output and the admin console port setting.


4 years ago
if each character takes up between 1 and 4 bytes in UTF-8, then if the field in database is defined as varchar2(100 bytes), then


x should be less than or equal to 25 characters? (25 * 4 bytes = 100 bytes)
4 years ago
my jvm flie.encoding system property is Cp1252
I see the following code (with some modification):


What is the above code

doing exactly?

is this the same if I change System property file.encoding=UTF-8 and then

4 years ago
for java split function with input string
boo:and:foo
and regex
o+

"boo:and:foo".split("o+", -1);

the result is three string
'b','':and:f'',''

why the empty string between 'oo' is not counted but the last '' is counted?
the last '' is come from the end of the whole string (:foo)?
what is the exact meaning of the '+'  in the regex 'o+'?
4 years ago
then I try


the "|" is never occur in the empty input string, but it also return length = 1, why again?


input string = ""
input.split("\|", 0).length = 1
str[0]=
end



sorry that I am not very clear about String.split() function.

>
5 years ago
Great, thaks for the help
5 years ago
I still find some problem about String.split function as following example



I expect it return 3 as str[0]='06265680,8800.00', str[1]='00496455,5076.72', str[2]='', but in fact it returns


input string = "06265680,8800.00|00496455,5076.72|"
input.split("|", -1).length = 36
str[0]=
str[1]=0
str[2]=6
str[3]=2
str[4]=6
str[5]=5
str[6]=6
str[7]=8
str[8]=0
str[9]=,
str[10]=8
str[11]=8
str[12]=0
str[13]=0
str[14]=.
str[15]=0
str[16]=0
str[17]=|
str[18]=0
str[19]=0
str[20]=4
str[21]=9
str[22]=6
str[23]=4
str[24]=5
str[25]=5
str[26]=,
str[27]=5
str[28]=0
str[29]=7
str[30]=6
str[31]=.
str[32]=7
str[33]=2
str[34]=|
str[35]=
end



why it breakdown each character??

If I want it to return str[0]='06265680,8800.00', str[1]='00496455,5076.72', str[2]='', how should I modify the program?>
5 years ago