comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * what is a design pattern and a framework - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/94501b11b82cdbb2 * jsp, containers, beans and persistence - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/47085d2436bae214 * Struts Server-Side Form Validation - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e8d7503f3780d747 * Debugging ANT build scripts - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a174637837f5a523 * Algorithm, please help - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8bcd7defb3cda029 * count file pages - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e5a8a03f1b71d9c4 * performance of double checked locking - 3 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6881393065d8371a * Communication between applets in seperate browswer windows? - 7 messages, 4 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4095d0c98d1e8cdf * Setting Java Virtual Memory - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/991635c2a770e75c * Calling Axis WebService out of .net Client - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/eaf2df6380fd7c0 * Threadsafe Timers? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/84b90615248a59bc * SCJP 5.0 Beta - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ccda6850cafec98b * Connection Pooling - c3p0 - Tomcat. - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8bdefe9f4a95f2fb ============================================================================== TOPIC: what is a design pattern and a framework http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/94501b11b82cdbb2 ============================================================================== == 1 of 1 == Date: Thurs, Dec 16 2004 1:40 pm From: Andrew Thompson On Thu, 16 Dec 2004 13:20:05 +0100, Michael Borgwardt wrote: > IINET wrote: .. >> I use search >> engines AND newsgroups, as do many people. > > That's fine, as long as you use search engines *first* and ask on newsgroups > only if the search engine did not provide an adequate answer. Using a seach engine is not as easy as it seems, and most of us could benefit from search tips that others have discovered. What is the *exact* search string you used[1]? Why were the hits not relevant? [1] ( Complete URL please) -- Andrew Thompson http://www.PhySci.org/codes/ Web & IT Help http://www.PhySci.org/ Open-source software suite http://www.1point1C.org/ Science & Technology http://www.LensEscapes.com/ Images that escape the mundane ============================================================================== TOPIC: jsp, containers, beans and persistence http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/47085d2436bae214 ============================================================================== == 1 of 1 == Date: Thurs, Dec 16 2004 5:46 am From: "milkyway" Hello, Thank you for the information. This clears up quite a bit for me ;-) Kind Regards. ============================================================================== TOPIC: Struts Server-Side Form Validation http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e8d7503f3780d747 ============================================================================== == 1 of 2 == Date: Thurs, Dec 16 2004 6:04 am From: "timmac" I'm hoping someone can help me with form validation using struts and the commons validator. I have everything set up, and as far as I can tell, it's identical to examples I've seen elsewhere. Client-side (javascript) validation works fine, but when I attempt server-side validation, it seems to perform no validation at all. Any ideas? The relevant portion of my struts-config.xml is: <form-beans> <form-bean name="registerFormBean" type="com.pixel.pool.RegisterFormBean" /> </form-beans> ..... <action path="/register" forward="/register.jsp" /> <action path="/register-submit" type="com.pixel.pool.Register" name="registerFormBean" scope="request" validate="true" input="input"> <forward name="input" path="/register.do" /> <forward name="success" path="/thankYou.jsp" /> </action> I have the RegisterFormBean class extending ValidatorForm as well. Anyone know what I'm missing? Thanks in advance, Tim MacDonald == 2 of 2 == Date: Thurs, Dec 16 2004 10:41 am From: Sudsy timmac wrote: <snip> > I have the RegisterFormBean class extending ValidatorForm as well. > Anyone know what I'm missing? Do you have the plug-in defined in the struts-config.xml file? Do you have the field validations specified in one of the files named in the pathnames property? Sounds basic, I know, but these elements are essential... ============================================================================== TOPIC: Debugging ANT build scripts http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a174637837f5a523 ============================================================================== == 1 of 2 == Date: Thurs, Dec 16 2004 6:07 am From: "illusions" Hello, I would like to know about the debugging capabilities of ANT. Basically I have an ANT build script written by a colleague and I wanted to step through each target to see what are the various tasks that are beings called. I tried using the -debug option but that output a whole lot of information without any pause. Could you suggest any other better method of debugging. Thaks, Swathi == 2 of 2 == Date: Thurs, Dec 16 2004 3:05 pm From: Collin VanDyck illusions wrote: > Hello, > I would like to know about the debugging capabilities of ANT. Basically > I have an ANT build script written by a colleague and I wanted to step > through each target to see what are the various tasks that are beings > called. I tried using the -debug option but that output a whole lot of > information without any pause. Could you suggest any other better > method of debugging. > Thaks, > Swathi > You could write a custom task that outputted some text to the console and insert your task inside of each target with an appropriate message. ============================================================================== TOPIC: Algorithm, please help http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8bcd7defb3cda029 ============================================================================== == 1 of 1 == Date: Thurs, Dec 16 2004 2:25 pm From: "John B. Matthews" In article <[EMAIL PROTECTED]>, "HS1" <[EMAIL PROTECTED]> wrote: > Hello all > > I have a vector that store answer objects. Each object has a question number > and answer value that can be presented as following: > ----------------------------------------------- > > Question number |Answer > > 3 Y > 5 N > 8 Y > 10 N > .... .. > > 3 Y > 5 N > 8 Y > 10 N > .. ... > > 3 N > 5 Y > 8 Y > 10 N > ... .. > > What I have to do is to determine how many percent answer is "Y" or "N" for > each question. > For example: > > question 3: 13% yes and 87% no > question 5: 23% yes and 68% no > > It can be seen that those objects are separated into groups and each has > same number of questions. I also have the list of question numbers (e.g: 3, > 5, 8, 10...). > > What is the best solution for this. Could you please help > [...] > I have this solution but it run many times through the vector of answer > objects Excellent! You have an algorithm, but you have observed that it requires many passes through the vector to examine each element. You wonder how to do the work in one pass. Assume n is the number of distinct question numbers. Instead of a single variable to total the positive answers, consider an array, indexed by question number: int[] yes = new int[n] Loop through the vector elements, one at a time. When an answer is yes, increment that question number's entry in the yes array: yes[questionNumber] += 1; After a single pass through the vector, yes will have the total number of yes's for each question number. -- John jmatthews at wright dot edu www dot wright dot edu/~john.matthews/ ============================================================================== TOPIC: count file pages http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e5a8a03f1b71d9c4 ============================================================================== == 1 of 1 == Date: Thurs, Dec 16 2004 9:42 am From: "juicy" yes. ============================================================================== TOPIC: performance of double checked locking http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6881393065d8371a ============================================================================== == 1 of 3 == Date: Thurs, Dec 16 2004 3:49 pm From: "Gerald Thaler" Hello The double checked locking idiom (thread safe singelton pattern) now works correct under the current memory model: public class MySingleton { private static volatile MySingleton instance; public static MySingleton getInstance() { if (instance == null) { synchronized (MySingleton.class) { if (instance == null) { instance = new MySingleton(); } } } return instance; } } Nevertheless the Java experts still discourage its use, claiming that there would be no signifcant performance advantage over simply synchronizing the whole getInstance() method, as volatile variable accesses are similar to (half) a synchronization. For example see: http://www-106.ibm.com/developerworks/library/j-jtp03304/?ca=dnt-513 [Brian Goetz] But is this really true? IMHO the volatile read in the common code path should be much more efficient than a monitor enter can be in any reasonable JVM implementation. All it has usually to do is to cross a read barrier before the read of the variable 'instance'. This affects only one processor and will cost very few cycles if any. A monitor enter in contrast would require a bus lock during a read-modify-write operation. This would stall every processor in the system. So my feeling is, that a monitor enter should be much more expensive than a volatile read. The linked site above gives the following advice: "Instead of double-checked locking, use the Initialize-on-demand Holder Class idiom, which provides lazy initialization, is thread-safe, and is faster and less confusing than double-checked locking." I don't agree. First, the Initialize-on-demand Holder Class idiom doesn't garantee that the Singleton is not constructed until its first use. JVMs have great freedom here. Second, if it does indeed lazy initialization, it can't be any faster than DCL, because it too has to cross at least one read barrier internally. Am i overlooking something here? == 2 of 3 == Date: Thurs, Dec 16 2004 3:38 pm From: "xarax" "Gerald Thaler" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello > > The double checked locking idiom (thread safe singelton pattern) now works > correct under the current memory model: > > public class MySingleton { > > private static volatile MySingleton instance; > > public static MySingleton getInstance() { > if (instance == null) { > synchronized (MySingleton.class) { > if (instance == null) { > instance = new MySingleton(); > } > } > } > return instance; > } > } > > Nevertheless the Java experts still discourage its use, claiming that there > would be no signifcant performance advantage over simply synchronizing the > whole getInstance() method, as volatile variable accesses are similar to > (half) a synchronization. > > For example see: > http://www-106.ibm.com/developerworks/library/j-jtp03304/?ca=dnt-513 [Brian > Goetz] > > But is this really true? IMHO the volatile read in the common code path > should be much more efficient than a monitor enter can be in any reasonable > JVM implementation. All it has usually to do is to cross a read barrier > before the read of the variable 'instance'. This affects only one processor > and will cost very few cycles if any. A monitor enter in contrast would > require a bus lock during a read-modify-write operation. This would stall > every processor in the system. So my feeling is, that a monitor enter should > be much more expensive than a volatile read. > > The linked site above gives the following advice: > > "Instead of double-checked locking, use the Initialize-on-demand Holder > Class idiom, which provides lazy initialization, is thread-safe, and is > faster and less confusing than double-checked locking." > > I don't agree. First, the Initialize-on-demand Holder Class idiom doesn't > garantee that the Singleton is not constructed until its first use. JVMs > have great freedom here. Second, if it does indeed lazy initialization, it > can't be any faster than DCL, because it too has to cross at least one read > barrier internally. > > Am i overlooking something here? The main "problem" with DCL is that some JVM implementations are allowed to assign the value of "instance" before the constructor has finished. That is, the line: instance = new MySingleton(); Creates a new object, assigns the reference for that object to "instance", then calls the constructor. This makes the reference visible to other threads before the object is fully constructed. This behavior is described (vaguely) under "prescient stores" in the JVM/JLS specs. However, declaring the field "instance" as a volatile would seem to prevent that kind of behavior. A volatile field must be fetched/stored in exactly the same sequence as specified in the original source code (the compiler is not allowed to perform code movement). Another way to avoid the "prescient store" thing is to assign the reference to a local variable, then enter/exit a synchronized block after the constructor call, then assign the field. public class MySingleton { private static volatile MySingleton instance; public static MySingleton getInstance() { if(instance == null) { synchronized (MySingleton.class) { if(instance == null) { MySingleton foo; foo = new MySingleton(); /* ensure constructor is finished */ synchronized(foo) { instance = foo; } } } } return instance; } } The assignment of "foo" can legally occur "early" before the constructor is called. (Some compilers may place the constructor in-line immediately after the assignment.) However, entering the subsequent monitor block requires that the constructor is completely finished. Inside the monitor block it is safe to then assign the "instance" field. This is also a point of contention among the "experts", because monitor "entry" only flushes fetches and monitor "exit" only flushes stores. A reasonable JVM implementation will flush both fetches and stores upon entry and exit of a monitor block. A variation of this solution uses ThreadLocal storage, which I can't recall at the moment. HTH == 3 of 3 == Date: Thurs, Dec 16 2004 8:10 am From: "Gerald Thaler" > The main "problem" with DCL is that some JVM implementations are > allowed to assign the value of "instance" before the constructor > has finished. > > That is, the line: > > instance = new MySingleton(); > > Creates a new object, assigns the reference for that object > to "instance", then calls the constructor. This makes the > reference visible to other threads before the object is fully > constructed. This behavior is described (vaguely) under > "prescient stores" in the JVM/JLS specs. > However, declaring the field "instance" as a volatile would seem to > prevent that kind of behavior. A volatile field must be fetched/stored > in exactly the same sequence as specified in the original source > code (the compiler is not allowed to perform code movement). The old memory model is broken anyway. By the current memory model (JSR 133) the volatile establishes a correct happens-before relationship. So DCL works as expected. > Another way to avoid the "prescient store" thing is to assign > the reference to a local variable, then enter/exit a synchronized > block after the constructor call, then assign the field. > > public class MySingleton { > > private static volatile MySingleton instance; > > public static MySingleton getInstance() > { > if(instance == null) > { > synchronized (MySingleton.class) > { > if(instance == null) > { > MySingleton foo; > > foo = new MySingleton(); > /* ensure constructor is finished */ > synchronized(foo) > { > instance = foo; > } > } > } > } > return instance; > } > } > > The assignment of "foo" can legally occur "early" before > the constructor is called. (Some compilers may place > the constructor in-line immediately after the assignment.) > > However, entering the subsequent monitor block requires that > the constructor is completely finished. Inside the monitor > block it is safe to then assign the "instance" field. This > is also a point of contention among the "experts", because > monitor "entry" only flushes fetches and monitor "exit" only > flushes stores. A reasonable JVM implementation will flush > both fetches and stores upon entry and exit of a monitor > block. No, you're wrong here. Any JVM is legally allowed to move instructions from outside into a synchronized block, and most will do so. So the local variable and the synchronized(foo) doesn't help at all. The JVM is even allowed to fully optimize the synchronized(foo) away if it can proof that no other thread will ever synchronize on foo/instance. For synchronized(foo) to enforce memory ordering constraints between two threads in any way, _both_ threads must synchronize on foo. This isn't the case here. But as the instance variable is volatile anyway, theres no problem here. > A variation of this solution uses ThreadLocal storage, which > I can't recall at the moment. Yes. But even this imho cannot be faster than the DCL. ============================================================================== TOPIC: Communication between applets in seperate browswer windows? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4095d0c98d1e8cdf ============================================================================== == 1 of 7 == Date: Thurs, Dec 16 2004 6:52 am From: "Richard Smol" Hi there, I have this web-application where is one main applet, that opens several browser windows and then has to be notified whenever something changes in those windows (like, when they close down or reload after submitting a value). Now, I was thinking for using an invisible applets that sends lifetime-changes to the main applet... but very much to my dismay inter-applet communication doesn't work between seperate browser windows.. at least not under Internet Explorer 6. Does anyone have any idea how something like this could be implemented? My personal choice would be to let the applets communicate through sockets on a server, but that solution is not feasible here because of various reasons. Thanks in advance! RS == 2 of 7 == Date: Thurs, Dec 16 2004 7:03 am From: "Richard Smol" Hi there, I have this web-application where is one main applet, that opens several browser windows and then has to be notified whenever something changes in those windows (like, when they close down or reload after submitting a value). Now, I was thinking for using an invisible applets that sends lifetime-changes to the main applet... but very much to my dismay inter-applet communication doesn't work between seperate browser windows.. at least not under Internet Explorer 6. Does anyone have any idea how something like this could be implemented? My personal choice would be to let the applets communicate through sockets on a server, but that solution is not feasible here because of various reasons. Thanks in advance! RS == 3 of 7 == Date: Thurs, Dec 16 2004 10:04 am From: "Anton Spaans" "Richard Smol" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi there, > > I have this web-application where is one main applet, that opens > several browser windows and then has to be notified whenever something > changes in those windows (like, when they close down or reload after > submitting a value). > > Now, I was thinking for using an invisible applets that sends > lifetime-changes to the main applet... but very much to my dismay > inter-applet communication doesn't work between seperate browser > windows.. at least not under Internet Explorer 6. > > Does anyone have any idea how something like this could be implemented? > My personal choice would be to let the applets communicate through > sockets on a server, but that solution is not feasible here because of > various reasons. > > Thanks in advance! > > RS > I don't know whether this is a java topic, but here it is anyway :) This is what i would try in Javascript - if Java code in applets don't allow you to get the 'Browser'-object (i don't know if it would work, though): Say one applet is in a browser window, that can be referenced in javascript by the variable 'window'. Then, open from this window a second window "var otherWin = window.open(...)". Now, through the variables 'window' and 'otherWin' and 'otherWin.opener' (all 'window' objects in javascript), you can reach either applet. Use (event-)listeners, implemented in javascript to communicate from applet to applet. -- Anton. == 4 of 7 == Date: Thurs, Dec 16 2004 3:09 pm From: Richard Smol Anton Spaans wrote: > "Richard Smol" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>Hi there, >> >>I have this web-application where is one main applet, that opens >>several browser windows and then has to be notified whenever something >>changes in those windows (like, when they close down or reload after >>submitting a value). >> >>Now, I was thinking for using an invisible applets that sends >>lifetime-changes to the main applet... but very much to my dismay >>inter-applet communication doesn't work between seperate browser >>windows.. at least not under Internet Explorer 6. >> >>Does anyone have any idea how something like this could be implemented? >>My personal choice would be to let the applets communicate through >>sockets on a server, but that solution is not feasible here because of >>various reasons. >> >>Thanks in advance! >> >>RS >> > > > I don't know whether this is a java topic, but here it is anyway :) > > This is what i would try in Javascript - if Java code in applets don't allow > you to get the 'Browser'-object (i don't know if it would work, though): > > Say one applet is in a browser window, that can be referenced in javascript > by the variable 'window'. > Then, open from this window a second window "var otherWin = > window.open(...)". Now, through the variables 'window' and 'otherWin' and > 'otherWin.opener' (all 'window' objects in javascript), you can reach either > applet. Use (event-)listeners, implemented in javascript to communicate from > applet to applet. Thanks. I have tried this, but it doesn't work since I can't call functions on Java applets from JavaScript in IE. Also, the windows are being opened from inside the Java applet, not through JavaScript. RS == 5 of 7 == Date: Thurs, Dec 16 2004 3:15 pm From: Andrew Thompson On 16 Dec 2004 06:52:34 -0800, Richard Smol wrote: > I have this web-application .. Does what? > ..where.. Where? URL? >.. is one main applet, Why an applet? Is there something you are doing that cannot be done in HTML? >..that opens several browser windows .. Either reduce your web-app to a single browser window, or triple the budget for maintenance. 'new windows' (aka pop-ups) are hated by users, and going the way of the dinosaurs. BTW - two important questions. Is this a 'business critical' web-app, or merely 'added extras'. Is it to be deployed in a controlled environment such as an intranet, or will it be subjected to the wilds of the internet? >..and then has to be notified whenever something > changes in those windows (like, when they close down or reload after > submitting a value). > > Now, I was thinking for using an invisible applets that sends > lifetime-changes to the main applet... but very much to my dismay > inter-applet communication doesn't work between seperate browser > windows.. at least not under Internet Explorer 6. How are you doing it[1]? What Java version is your IE using[2]? [1] <http://www.physci.org/codes/sscce.jsp> [2] <http://www.physci.org/pc/property.jsp?prop=java.version> > Does anyone have any idea how something like this could be implemented? > My personal choice would be to let the applets communicate through > sockets on a server, but that solution is not feasible here because of > various reasons. ..because ..your sockets have holes in the toes? No? Well perhaps you had better fill those details in as well. Sockets would be one good way to allow the applets to communicate, though I suspect you are doing something wrong when you attempt to connect to the other applets. -- Andrew Thompson http://www.PhySci.org/codes/ Web & IT Help http://www.PhySci.org/ Open-source software suite http://www.1point1C.org/ Science & Technology http://www.LensEscapes.com/ Images that escape the mundane == 6 of 7 == Date: Thurs, Dec 16 2004 3:23 pm From: Andrew Thompson On 16 Dec 2004 07:03:19 -0800, Richard Smol wrote: > Hi there, "Ah, McGoogle! You've done it again.." ;-) -- Andrew Thompson http://www.PhySci.org/codes/ Web & IT Help http://www.PhySci.org/ Open-source software suite http://www.1point1C.org/ Science & Technology http://www.LensEscapes.com/ Images that escape the mundane == 7 of 7 == Date: Thurs, Dec 16 2004 3:30 pm From: Richard Smol Andrew Thompson wrote: > On 16 Dec 2004 06:52:34 -0800, Richard Smol wrote: > > >>I have this web-application .. > > > Does what? It contains a chart, which has to be filled in through Cool:Gen generated forms. >>..where.. > > Where? URL? Intranet >>.. is one main applet, > > Why an applet? Is there something you are doing that cannot > be done in HTML? It's a very complicated, highly interactive chart. Besides, the decision to use it has been made long before I entered the scene. > >>..that opens several browser windows .. > > Either reduce your web-app to a single browser window, Not possible, since all forms have been generated by Cool:Gen. That's just how the beastie works. > or triple > the budget for maintenance. 'new windows' (aka pop-ups) are hated > by users, and going the way of the dinosaurs. Well, it mimicks the way the old application works. And again, it's not my decision, bla bla bla :) > BTW - two important questions. Is this a 'business critical' > web-app, or merely 'added extras'. Is it to be deployed in a > controlled environment such as an intranet, or will it be > subjected to the wilds of the internet? It's business critial alright. It will be confined within the bounds of a highly secretive intranet :) >>..and then has to be notified whenever something >>changes in those windows (like, when they close down or reload after >>submitting a value). >> >>Now, I was thinking for using an invisible applets that sends >>lifetime-changes to the main applet... but very much to my dismay >>inter-applet communication doesn't work between seperate browser >>windows.. at least not under Internet Explorer 6. > > > How are you doing it[1]? What Java version is your IE using[2]? > [1] <http://www.physci.org/codes/sscce.jsp> > [2] <http://www.physci.org/pc/property.jsp?prop=java.version> 1.4.2_06 >>Does anyone have any idea how something like this could be implemented? >>My personal choice would be to let the applets communicate through >>sockets on a server, but that solution is not feasible here because of >>various reasons. > > > ..because ..your sockets have holes in the toes? No? > Well perhaps you had better fill those details in as well. *Looks sheepishly* uh... like... tcp/ip sockets? > Sockets would be one good way to allow the applets to communicate, > though I suspect you are doing something wrong when you attempt > to connect to the other applets. Even worse: I did find a way to do it. HAHA! Now I can finally take over the world! Or just get this application started :) Thanks for your input... RS ============================================================================== TOPIC: Setting Java Virtual Memory http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/991635c2a770e75c ============================================================================== == 1 of 1 == Date: Thurs, Dec 16 2004 8:12 am From: Chris Smith <[EMAIL PROTECTED]> wrote: > You are probably instantiating too many objects. Review your code. > > A common cause of this is using the '+=' construct to concatenate > strings. Every time this is used, a StringBuffer is instantiated. Nope, the implicit StringBuffer instances used to implement the += operator on Strings will never cause an OutOfMemoryError. A full garbage collection is guaranteed to occur prior to OutOfMemoryError being thrown, so only the memory that's really required will contribute toward this problem. The implicit object from += will be garbage collected before the error is thrown. -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation ============================================================================== TOPIC: Calling Axis WebService out of .net Client http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/eaf2df6380fd7c0 ============================================================================== == 1 of 1 == Date: Thurs, Dec 16 2004 4:28 pm From: "Christian Wilhelm" Hi! I'm trying to call a Java WebService out of a .net Client. There are two Methods, one Method requires one Parameter of type Parameter, the other Method requires one Parameter of type Parameter[]. I can call the first Method without Problems, the Parameter can be deserialized by the WebService. But if I want to call the second Method and give it an Array of Parameters, then the following exception is thrown by the WebService: javax.xml.rpc.JAXRPCException: org.xml.sax.SAXException: No deserializer defined for array type {http://beans.middleware.cat.company.de}Parameter I have appended the WSDL of the concerning WebService. It is called using rpc-Style, see <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc" /> Both Methods can be called out of a Java Client. So my assumption is a Problem concerning interoperability between .net and Java. Does anyone have experience with Interoperability between the two Systems? Best Regards, Christian === This is the WSDL-File of the Service === <?xml version="1.0" encoding="utf-8"?> <wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://beans.middleware.cat.company.de" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://beans.middleware.cat.compay.de" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> <wsdl:types> <s:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://beans.middleware.cat.company.de"> <s:import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> <s:complexType name="ArrayOf_xsd_string"> <s:complexContent mixed="false"> <s:restriction base="soapenc:Array"> <s:attribute wsdl:arrayType="s:string[]" ref="soapenc:arrayType" /> </s:restriction> </s:complexContent> </s:complexType> <s:complexType name="CustmapData"> <s:sequence> <s:element name="ID" nillable="true" type="s:int" /> <s:element name="createFrom" nillable="true" type="s:int" /> <s:element name="createStamp" nillable="true" type="s:dateTime" /> <s:element name="primaryKey" nillable="true" type="s:int" /> <s:element name="refId" nillable="true" type="s:string" /> <s:element name="refType" nillable="true" type="s:string" /> <s:element name="sectionId" nillable="true" type="s:int" /> </s:sequence> </s:complexType> <s:complexType name="TicketData"> <s:sequence> <s:element name="ID" nillable="true" type="s:int" /> <s:element name="createAt" nillable="true" type="s:dateTime" /> <s:element name="createFrom" nillable="true" type="s:int" /> <s:element name="custmapId" nillable="true" type="s:int" /> <s:element name="escalationlevel" nillable="true" type="s:int" /> <s:element name="lastaccessAt" nillable="true" type="s:dateTime" /> <s:element name="lastaccessFrom" nillable="true" type="s:int" /> <s:element name="ownernow" nillable="true" type="s:int" /> <s:element name="ownerteam" nillable="true" type="s:int" /> <s:element name="primaryKey" nillable="true" type="s:int" /> <s:element name="remark" nillable="true" type="s:string" /> <s:element name="status" nillable="true" type="s:string" /> </s:sequence> </s:complexType> <s:complexType name="ArrayOfTicketData"> <s:complexContent mixed="false"> <s:restriction base="soapenc:Array"> <s:attribute wsdl:arrayType="tns:TicketData[]" ref="soapenc:arrayType" /> </s:restriction> </s:complexContent> </s:complexType> <s:complexType name="CustmapTransferObject"> <s:complexContent mixed="false"> <s:extension base="tns:CustmapData"> <s:sequence> <s:element name="tickets" nillable="true" type="tns:ArrayOfTicketData" /> </s:sequence> </s:extension> </s:complexContent> </s:complexType> <s:complexType name="Parameter"> <s:sequence> <s:element name="name" nillable="true" type="s:string" /> <s:element name="parameterValue" nillable="true" type="s:anyType" /> </s:sequence> </s:complexType> <s:complexType name="ArrayOf_xsd_anyType"> <s:complexContent mixed="false"> <s:restriction base="soapenc:Array"> <s:attribute wsdl:arrayType="s:anyType[]" ref="soapenc:arrayType" /> </s:restriction> </s:complexContent> </s:complexType> <s:complexType name="ArrayOfParameter"> <s:complexContent mixed="false"> <s:restriction base="soapenc:Array"> <s:attribute wsdl:arrayType="tns:Parameter[]" ref="soapenc:arrayType" /> </s:restriction> </s:complexContent> </s:complexType> <s:complexType name="ParameterArray"> <s:sequence> <s:element name="parameterArray" nillable="true" type="tns:ArrayOfParameter" /> </s:sequence> </s:complexType> </s:schema> </wsdl:types> <wsdl:message name="getExampleHashResponse"> <wsdl:part name="getExampleHashReturn" type="tns:Parameter" /> </wsdl:message> <wsdl:message name="ainvokeThirdPartyRequest"> <wsdl:part name="targetUrl" type="s:string" /> <wsdl:part name="functionName" type="s:string" /> <wsdl:part name="parameter" type="s:anyType" /> </wsdl:message> <wsdl:message name="testSoapClientRequest" /> <wsdl:message name="getExampleArrayRequest" /> <wsdl:message name="getCustmapByIdResponse"> <wsdl:part name="getCustmapByIdReturn" type="tns:CustmapTransferObject" /> </wsdl:message> <wsdl:message name="getExampleHashRequest" /> <wsdl:message name="getCustmapByIdRequest"> <wsdl:part name="custmapID" type="s:int" /> </wsdl:message> <wsdl:message name="getTicketsForCustmapRequest"> <wsdl:part name="custmapID" type="s:int" /> </wsdl:message> <wsdl:message name="testSoapClientResponse"> <wsdl:part name="testSoapClientReturn" type="s:anyType" /> </wsdl:message> <wsdl:message name="testStringArrayRequest"> <wsdl:part name="strArray" type="tns:ArrayOf_xsd_string" /> </wsdl:message> <wsdl:message name="testStringArrayResponse"> <wsdl:part name="testStringArrayReturn" type="s:string" /> </wsdl:message> <wsdl:message name="getExampleArrayResponse"> <wsdl:part name="getExampleArrayReturn" type="tns:ArrayOf_xsd_anyType" /> </wsdl:message> <wsdl:message name="invokeThirdPartyRequest"> <wsdl:part name="targetUrl" type="s:string" /> <wsdl:part name="functionName" type="s:string" /> <wsdl:part name="systemName" type="s:string" /> <wsdl:part name="parameter" type="s:anyType" /> </wsdl:message> <wsdl:message name="ainvokeThirdPartyResponse"> <wsdl:part name="ainvokeThirdPartyReturn" type="s:anyType" /> </wsdl:message> <wsdl:message name="invokeThirdPartyResponse"> <wsdl:part name="invokeThirdPartyReturn" type="s:anyType" /> </wsdl:message> <wsdl:message name="getTicketsForCustmapResponse"> <wsdl:part name="getTicketsForCustmapReturn" type="tns:ArrayOfTicketData" /> </wsdl:message> <wsdl:portType name="RemoteService"> <wsdl:operation name="testSoapClient"> <wsdl:input name="testSoapClientRequest" message="tns:testSoapClientRequest" /> <wsdl:output name="testSoapClientResponse" message="tns:testSoapClientResponse" /> </wsdl:operation> <wsdl:operation name="testStringArray" parameterOrder="strArray"> <wsdl:input name="testStringArrayRequest" message="tns:testStringArrayRequest" /> <wsdl:output name="testStringArrayResponse" message="tns:testStringArrayResponse" /> </wsdl:operation> <wsdl:operation name="ainvokeThirdParty" parameterOrder="targetUrl functionName parameter"> <wsdl:input name="ainvokeThirdPartyRequest" message="tns:ainvokeThirdPartyRequest" /> <wsdl:output name="ainvokeThirdPartyResponse" message="tns:ainvokeThirdPartyResponse" /> </wsdl:operation> <wsdl:operation name="invokeThirdParty" parameterOrder="targetUrl functionName systemName parameter"> <wsdl:input name="invokeThirdPartyRequest" message="tns:invokeThirdPartyRequest" /> <wsdl:output name="invokeThirdPartyResponse" message="tns:invokeThirdPartyResponse" /> </wsdl:operation> <wsdl:operation name="getCustmapById" parameterOrder="custmapID"> <wsdl:input name="getCustmapByIdRequest" message="tns:getCustmapByIdRequest" /> <wsdl:output name="getCustmapByIdResponse" message="tns:getCustmapByIdResponse" /> </wsdl:operation> <wsdl:operation name="getTicketsForCustmap" parameterOrder="custmapID"> <wsdl:input name="getTicketsForCustmapRequest" message="tns:getTicketsForCustmapRequest" /> <wsdl:output name="getTicketsForCustmapResponse" message="tns:getTicketsForCustmapResponse" /> </wsdl:operation> <wsdl:operation name="getExampleHash"> <wsdl:input name="getExampleHashRequest" message="tns:getExampleHashRequest" /> <wsdl:output name="getExampleHashResponse" message="tns:getExampleHashResponse" /> </wsdl:operation> <wsdl:operation name="getExampleArray"> <wsdl:input name="getExampleArrayRequest" message="tns:getExampleArrayRequest" /> <wsdl:output name="getExampleArrayResponse" message="tns:getExampleArrayResponse" /> </wsdl:operation> </wsdl:portType> <wsdl:binding name="RemoteServicePortSoapBinding" type="tns:RemoteService"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc" /> <wsdl:operation name="testSoapClient"> <soap:operation soapAction="" /> <wsdl:input name="testSoapClientRequest"> <soap:body use="encoded" namespace="http://beans.middleware.cat.company.de" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> </wsdl:input> <wsdl:output name="testSoapClientResponse"> <soap:body use="encoded" namespace="http://beans.middleware.cat.company.de" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="testStringArray"> <soap:operation soapAction="" /> <wsdl:input name="testStringArrayRequest"> <soap:body use="encoded" namespace="http://beans.middleware.cat.company.de" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> </wsdl:input> <wsdl:output name="testStringArrayResponse"> <soap:body use="encoded" namespace="http://beans.middleware.cat.company.de" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="ainvokeThirdParty"> <soap:operation soapAction="" /> <wsdl:input name="ainvokeThirdPartyRequest"> <soap:body use="encoded" namespace="http://beans.middleware.cat.company.de" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> </wsdl:input> <wsdl:output name="ainvokeThirdPartyResponse"> <soap:body use="encoded" namespace="http://beans.middleware.cat.company.de" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="invokeThirdParty"> <soap:operation soapAction="" /> <wsdl:input name="invokeThirdPartyRequest"> <soap:body use="encoded" namespace="http://beans.middleware.cat.company.de" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> </wsdl:input> <wsdl:output name="invokeThirdPartyResponse"> <soap:body use="encoded" namespace="http://beans.middleware.cat.company.de" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="getCustmapById"> <soap:operation soapAction="" /> <wsdl:input name="getCustmapByIdRequest"> <soap:body use="encoded" namespace="http://beans.middleware.cat.company.de" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> </wsdl:input> <wsdl:output name="getCustmapByIdResponse"> <soap:body use="encoded" namespace="http://beans.middleware.cat.company.de" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="getTicketsForCustmap"> <soap:operation soapAction="" /> <wsdl:input name="getTicketsForCustmapRequest"> <soap:body use="encoded" namespace="http://beans.middleware.cat.company.de" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> </wsdl:input> <wsdl:output name="getTicketsForCustmapResponse"> <soap:body use="encoded" namespace="http://beans.middleware.cat.company.de" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="getExampleHash"> <soap:operation soapAction="" /> <wsdl:input name="getExampleHashRequest"> <soap:body use="encoded" namespace="http://beans.middleware.cat.company.de" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> </wsdl:input> <wsdl:output name="getExampleHashResponse"> <soap:body use="encoded" namespace="http://beans.middleware.cat.company.de" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="getExampleArray"> <soap:operation soapAction="" /> <wsdl:input name="getExampleArrayRequest"> <soap:body use="encoded" namespace="http://beans.middleware.cat.company.de" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> </wsdl:input> <wsdl:output name="getExampleArrayResponse"> <soap:body use="encoded" namespace="http://beans.middleware.cat.company.de" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="RemoteService"> <wsdl:port name="RemoteServicePort" binding="tns:RemoteServicePortSoapBinding"> <soap:address location="http://xx-xx-xxx:8080//services/RemoteService" /> </wsdl:port> </wsdl:service> </wsdl:definitions> ============================================================================== TOPIC: Threadsafe Timers? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/84b90615248a59bc ============================================================================== == 1 of 2 == Date: Thurs, Dec 16 2004 7:38 am From: [EMAIL PROTECTED] I have recently begun the joys of ensuring that all of my GUI/Swing code is thread safe by adding invokeLater() and invokeAndWait() methods everywhere. As far as I can tell, all Swing classes are assumed to NOT be thread safe. Does this include javax.swing.Timer? Specifically, I use Timers all over the place for regularly scheduled tasks and when I turn them on or off, or restart() them, do these also need to be enclosed in invokeLater() and invokeAndWait() methods? Is it safe to assume that the event handlers for Timers execute on the event dispatching thread so that anything within these tasks is safe without the extra protection? In case it matters my target JVM is the 1.3.1_07 JRE from Sun. Thanks for any help! -Will == 2 of 2 == Date: Thurs, Dec 16 2004 4:57 pm From: Thomas Weidenfeller [EMAIL PROTECTED] wrote: > Is it safe to > assume that the event handlers for Timers execute on the event > dispatching thread so that anything within these tasks is safe without > the extra protection? Well, tell me, what is your interpretation of the following quote from the Timer API documentation? Although all Timers perform their waiting using a single, shared thread (created by the first Timer object that executes), the action event handlers for Timers execute on another thread -- the event-dispatching thread. This means that the action handlers for Timers can safely perform operations on Swing components. However, it also means that the handlers must execute quickly to keep the GUI responsive. /Thomas -- ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq ============================================================================== TOPIC: SCJP 5.0 Beta http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ccda6850cafec98b ============================================================================== == 1 of 1 == Date: Thurs, Dec 16 2004 7:52 am From: [EMAIL PROTECTED] (Darren) I received a notification this morning regarding the Beta for this exam, which will be available from January 13 through to February 13, 2005. Here are some notes: 1. Beta Cost: $49 US 2. Exam Number: 311-055 3. Passing the exam provides you with full Sun certification status, and you will receive a "certification kit". 4. Candidates will have four (4) hours to complete 138 questions. The time allotted should give you time to respond to all questions and provide your valuable comments while taking the exam. 5. Unlike other SUN Microsystems certification exams, this exam does NOT require a voucher. To register for the SUN Microsystems "Sun Certified Programmer for the Java 2 Platform, Standard Edition 5.0" Beta exam, you may register online at www.2test.com <http://www.2test.com/> , and follow the prompts. ============================================================================== TOPIC: Connection Pooling - c3p0 - Tomcat. http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8bdefe9f4a95f2fb ============================================================================== == 1 of 2 == Date: Fri, Dec 17 2004 12:09 am From: Rico As the docs say, c3p0 was designed to be very simple to use, and it is. Fromwhat I understand, just a matter of having the c3p0.jar in the effective classpath; adding the following code and getting connections from the DataSource: import com.mchange.v2.c3p0.*; ... ComboPooledDataSource cpds = new ComboPooledDataSource(); cpds.setDriverClass( "org.postgresql.Driver" ); //loads the jdbc driver cpds.setJdbcUrl( "jdbc:postgresql://localhost/testdb" ); cpds.setUser("dbuser"); cpds.setPassword("dbpassword"); So I'm thinking for our web-application I can just add the above code to my classes in WEB-INF/classes. Is that enough? Coz there's this part: "You can easily configure Apache's Tomcat web application server to use c3p0 pooled DataSources. Below is a sample config to get you started. It's a fragment of Tomcat's conf/server.xml file, which should be modified to suit and placed inside a <Context> element." Do I need to do this? What would it gain us? Thanks. Rico. == 2 of 2 == Date: Thurs, Dec 16 2004 9:07 am From: Chris Smith Rico <[EMAIL PROTECTED]> wrote: > From what I understand, just a matter of having the c3p0.jar in the > effective classpath; adding the following code and getting connections > from the DataSource: > > import com.mchange.v2.c3p0.*; > ... > ComboPooledDataSource cpds = new ComboPooledDataSource(); > cpds.setDriverClass( "org.postgresql.Driver" ); //loads the jdbc driver > cpds.setJdbcUrl( "jdbc:postgresql://localhost/testdb" ); > cpds.setUser("dbuser"); > cpds.setPassword("dbpassword"); That would work, but it's not ideal. > Coz there's this part: > "You can easily configure Apache's Tomcat web application server to use > c3p0 pooled DataSources. Below is a sample config to get you started. > It's a fragment of Tomcat's conf/server.xml file, which should be > modified to suit and placed inside a <Context> element." That is ideal. The idea behind a data source is that your code doesn't care where the connections are coming from. If you add the above code to your project, then you have to recompile your code to connect a database other than PostgreSQL on localhost; not the best idea in the world. By placing the configuration in server.xml, you can change the database configuration by editing a config file. You'll still aquire the data source by the same JNDI name, and your code will be identical when you connect to a database somewhere else. -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation ============================================================================== You received this message because you are subscribed to the Google Groups "comp.lang.java.programmer" group. To post to this group, send email to [EMAIL PROTECTED] or visit http://groups-beta.google.com/group/comp.lang.java.programmer To unsubscribe from this group, send email to [EMAIL PROTECTED] To change the way you get mail from this group, visit: http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe To report abuse, send email explaining the problem to [EMAIL PROTECTED] ============================================================================== Google Groups: http://groups-beta.google.com
