This week's book giveaway is in the OCP forum.
We're giving away four copies of OCP Java SE 8 Programmer II Exam Study Guide and have Kathy Sierra, Bert Bates, & Elizabeth Robson on-line!
See this thread for details.
Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!

scott miles

Ranch Hand
+ Follow
since Jun 16, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
4
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by scott miles

I need to work on webservice project. So going through book to cover the basics of webservice project. But these are questions I am struggling with:-
1.Java API for XML Web Services(JAX-WS):- JAX-WS is nothing but just a java programming language API for creating web services which is now a part of core java starting from version 6 (though originally developed as part of Java Web Services Development Pack). Is it right?
2.All other webservices framework whether it is metro, jersey, glassfish uses the JAX-WS internally. Is it correct?
3.All webservices (SOAP) request are only http request (which internally containd soap document) ?
4.What is JAX-WS RI? From net I came to know that, it is a reference implementation of the JAX-WS specification. But then what is meaning of here reference implementation ? Is it just POC done using JAX-WS so that other people can refer it or its some pluggable component which we can directly use?
5 years ago
GMAIL allows inserting image inside body from local system/public web server both but for inserting the image
inside signature , it only allows the image from public web server not from local system.Is there any techincal limitation
in inserting the image inside signature from local system as gmail does not allow that?As per my understanding,
if GMAIL allows inserting image inside body from local system, it should allow for signature too?
For Information, here is the process to insert image in gmail signature.
http://email.about.com/od/gmailtips/qt/How-To-Add-An-Image-To-Your-Gmail-Signature.htm

Simlarly Yahoo does not allow insert the inserting the image in body anyhow. There is only one i figured it out we can do it on yahoo
i.e only on mozilla. Copy the image with CTRL+C and Then CTRL+V on Text Rich Editor. But chrome/IE does not seem to support that.


I am using tinymce as text rich editor for image signature. Is there a way i can upload upload from local system throw any of these options and it goes as part of body

1)Thrugh browsing to the director where image exist
OR
2)Drag/'drop
OR
3)CONTROL +C/CONTROL+V
5 years ago
I have three webapps app1, app2 and app3 using tomcat. app1 and app2 are web apps. app3 simply host singleton class which will be accessed by app1 and app2.

I am planning to use to `JNDI` lookup the singleton instance from app1 and app2. but i am not getting how to bind the singleton instance
with initial context on app3 and make it available to lookup from app1 and app2. Do i need to host the singleton instance as jmx service
first and then lookup? Sorry folks i am new to jndi and jmx service.But this is summary i get from lot of sites and blogs on net.
Just wanted to know how to host the singleton object as jmx service on app3?

This was asked at http://stackoverflow.com/posts/12662277/ but no answers . Any pointers will be helpful.
5 years ago
i have one struts2 application, working finr. But when i put <s:debug /> tag in jsp in html form or anywhere else, it throws

Struts Problem Report

Also i have mentioned `struts.devMode=true` in `struts.properties`.

The basic reason we get this kind of exception is when output of jsp has already been to browser but some content is still being evaluated but not sure why it is happening my scenario?


Here is the jsp though i have just kept the minimum information in it






Here is the Compile JSP File in tomcat work container for more information






Posted at http://stackoverflow.com/posts/10908424/edit too but have not got answer yet
5 years ago
This question has come out of understanding from Role of files .keystore and CAKey.pem in SSL?. The folks who have not gone thru that can skip that link as this is just summarization of different options of going for https.Here it is:-

There are two ways when i want to go for https. First is get the certificate from authorized CA like verisign like ecommerce site or bank goes for. This is affective but costly way.

Second is self signed certificate(which is good if we have one/few server).In this case browser can give the error site is risky. To get rid of that, we can go for import of server cerificate in the browser truststore.

In case if we have many servers, then we can go create your own CA and get the Certificate signed with this our own CA. To get rid of risky site error on browser, we can again go for import of CA cerificate in all the clients(Browser). Is this correct so that i can go ahead with best option which will suit me?

posted at http://stackoverflow.com/questions/9653447/different-options-ways-to-go-for-https too but still looking for response?
here are the steps I followed to move my webapplication on https/SSL

1) Download Win32OpenSSL_Light-0_9_8t from http://www.slproweb.com/products/Win32OpenSSL.html and install

2) In the OpenSSL installation directory, create subdirectory private. The Certificate Authority's private key will be stored here.
In the OpenSSL installation directory, create subdirectory newcerts. New certificates signed by the CA will be stored here.
In the OpenSSL installation directory, create an empty file named index.txt. OpenSSL keeps its signed certificates database in that file.
From the subdirectory bin/PEM/demoCA of the OpenSSL installation directory, copy the file serial to the OpenSSL installation directory. Open the copied serial file and edit it to read 00 and save. Each new CA-signed certificate's serial number is taken from this file's content, which is incremented each time a certificate is signed.

3) In openssl.cfg .Did the following changes
dir = c:/openssl <-- This is the OpenSSL installation directory
certificate = $dir/private/cacert.pem
#crl = $dir/crl.pem

4) Create Self-signed Certificate with command
cd /d "%OPENSSL_HOME%"
openssl req -new -x509 -days 2000 -keyout private\CAKey.pem -out private\CACert.pem -config bin\openssl.cnf

5)Convert the certificate PEM file to a DER encoded file
cd /d "%OPENSSL_HOME%"
openssl x509 -in private\CACert.pem -out private\CACert.cer -outform DER
This command creates file CACert.cer in the private subdirectory.


6) Modify Java Root Certificates

cd %JAVA_HOME%
keytool -import -keystore jre\lib\security\cacerts -alias AppOpenSSLCert -file %OPENSSL_HOME%\private\cacert.cer

This adds our self-signed CA certificate to Java's trusted CA certificates, which are kept in file jre\lib\security\cacerts in the Java JDK installation directory.
Our self-signed CA certificate was stored under the alias AppOpenSSLCert.

As per documentation it should have worked(i.e i tried hitting the URL with https) but it did not work . To make it work I had to run one more command i.e

7)
C:\Program Files\Java\jdk1.6.0_23>keytool -genkey -alias tomcat -keyalg RSA which generated .keystore file((which will have SSL certificate which will be send when client makes https request and client matches this certificates in truststore and private key)

Finally i made changes in server.xml and it worked
keystoreFile="c:/.keystore"
keystorePass="changeit"


Thats why whole confusion came to my mind. If we are using certificates pointed by .keystore file generated in 7th step,what is the purpose of steps i did from 1 to 6(CAKey.pem and CACert.pem files).

Last question on the verisign(http://www.verisign.com/ssl/ssl-information-center/how-ssl-security-works/. ) link. it talks about two certicates i.e SSL certificate and digital certificate. Where SSL certificate and digital certificate fit in above scenario?

Mohan Rao Sv wrote:To see the data in the value stack put your project development environment and use the tag in the jsp



Thanks for giving valuable information. But as soon as i do the above settings i see below error on web page




Do i need to do some other other setting too for this? i am putting <s:debug /> tag after var relationshipData got evaluated i.e after }(see below line 6)
6 years ago

I am new to strut 2 though I have worked on struts 1.2.In one of the pexisting project jsp file I have following code:

Request is coming CustomerRelationAction.java which has method getCustomerRelations() and getRelationId().

here are the questions :-
1.
I put breakpoint inside method getCustomerRelations().i see flow is coming four time inside this method. Two times at line 3 and another two times at line 4. As per my understanding flow should come only 1 time i.e at line 3. Once it completes getCustomerRelations at line 3 , should not put its value in value stack so that it can refer to it nextime it is refered (like it is being reffered at line 14 again)?

2.
getCustomerRelations() method returns the list of CustomerRelationData objects where CustomerRelationData class also contains the getRelationId() method.Now at line 5 we are refering value="relationId at line 5. On Which object(CustomerRelationAction.java or CustomerRelationData), getRelationId() method will be called? even i am not sure will the list object CustomerRelationData will be present on value stack or not?If yes at which line it will be put in value stack?

3.
Now the iterator completes at line 6.After that,now i refer the code <s:property value="relationId" /> again, On Which object(CustomerRelationAction.java or CustomerRelationData), getRelationId() method will be called?


posted at http://stackoverflow.com/questions/8930873/some-basic-queries-regarding-value-stack-in-struts-2 too but did not get any reply as of now.
6 years ago
i want to know for now, Is it possible in hibernate to create database schema if schema does not exist otherwise update the schema if it is already exist and there are some modification in hbm file with some value for property hibernate.hbm2ddl.auto .

As per my understanding create value will always drop the previous schema and create the new schema ? update value will not create new schema, it will just update the schem if exist a based on hbm.xml. Right?

Mine scheme is local schema not a production schema.

Bear Bibeault wrote:Of course there's a huge difference between those options.

But the question comes down to: why on earth does the 2nd web app need another port or Tomcat instance? A single Tomcat instance is capable of hosting as many web applications as the system is capable of supporting.



Do you mean if first web application is too heavy and single server is not able to handle /or may not provide good performation in that case second tomcat server will help in load balancing. Is it?
6 years ago
i already have one web application up on port 8080 on tomcat. Now i have another web application which i have got as war file. Both webapplications will be communicating with each other. i have been told by my senior to deploy this second web application on different tomcat directory on same machine. While doing this i came up with these two another options:-

1) we can deploy second webapplication on different port say 8888 on first tomcat directory itself.

2) we can deploy second webapplication on same port on first tomcat directory itself.

Option3 as suggested by my senior :- Deploy second webapplication on another tomcat directory on same machine itself.


As per my understanding there is no difference among above three options. Is that correct?


i am not getting the rationale behind deploying second webapplication on another tomcat directory which is on same machine itself ?
6 years ago
Me and my friends are cplanning bto construct a website for some company which it will be using for its commercial purpose.
My question here can we use miscrosoft sql server free edition for commercial purpose?

Apart from that miscrosoft sql server provides free edition and commercial edition both. What are the important features any company provide
in its commericial edition which it does not provide in free edition?
6 years ago
i specified the below properties in cfg file.

In my main1 program i create the person with id 1 and commited and made that thread on hold after commit. Then i start the another thread T2 which is getting ther person with id 1 with below code


when T2 passed above statement, it generate the below query in background


I am not sure why thread T2 reading from database instead of getting it from second level cache as i am using usage as read-write ?

My Mapping looks like



am using Hibernate with oracle . What will be default isolation level if transaction if i don't set it explicitly. Will it be read_commited (default for oracle)?If i want to set it something else say serilizable how can i set it in hibernate?
i have below main programme





When i run above prograame in eclipse i see below below queries generated on eclipse console at different lines mentioned in above programme.These are

Hibernate: select person0_.id as id0_0_, person0_.cname as cname0_0_, person0_.addressId as addressId0_0_ from MyProject1.person person0_ where person0_.id=? //Generated at line A

Hibernate: select max(id) from MyProject1.person //Generated at line B

Hibernate: select max(id) from MyProject1.Address //Generated at line B

Hibernate: select person0_.id as id0_0_, person0_.cname as cname0_0_, person0_.addressId as addressId0_0_ from MyProject1.person person0_ where person0_.id=? //Generated at line G

Hibernate: insert into MyProject1.Address (addressLine1, id) values (?, ?)//Generated at line H

Hibernate: insert into MyProject1.person (cname, addressId, id) values (?, ?, ?)//Generated at line H

Hibernate: insert into MyProject1.person (cname, addressId, id) values (?, ?, ?) //Generated at line H

Hibernate: insert into MyProject1.person (cname, addressId, id) values (?, ?, ?)//Generated at line H

As per my understanding when console is showing generated query its hitting the database right?

Another question is why it did not generate the queries select max(id) from MyProject1.person, select max(id) from MyProject1.Address at line C and D as it should get latest max value of ID for person and address from database in case some other session inserted a new person in between?

Similarily why it did not generate the query select person0_.id as id0_0_, person0_.cname as cname0_0_, person0_.addressId as addressId0_0_ from MyProject1.person person0_ where person0_.id=? at line E and F .How does session come to know that person for id 2 and 3 is not updated by any other session.

One more interesting fact i noted is that if i run the one more same program with creation of one person with id 4 in parallel and stop first programme at debug point at line above line A then proceed it once second programme is completed then line E and F also generate the query(basically hits the database) but query not generated at Line G. Not sure how session is behaving and how does it decide when to hit database/Generate query?