comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * JBoss & BMP Entity Bean with DB - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fc3ae602d0e52d09 * Singleton or static class? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c6605e437a9085c2 * How do I start up JBoss using ant? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e20ea52fd1c63536 * Setting DOCTYPE to a DOM- document - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7f0a2e7258baad09 * myeclipse webservices axis - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4c1ba84ad117dd77 * Calling the native Linux mutt module from Java... - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/52d060d3a36936c5 * Thread programming in J2EE - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/22b32fb847cd1773 * JSP JavaBeans problem in scope="session" attribute - 3 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2e1bcbc17605207 * Problem getting MDB work with JBoss 4.0 - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/682f01f07e9e687c * cloning with generics - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/721598b62b19173b * JSTL tags in output - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5784c409befba099 * Classes in jar can't load - why? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/dc2f55bd4b5e0165 * how to post UTF-8 values to a servlet - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8720339cb557e8ea * An efficient computation idea. Please comment - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5d714c128b46864f * Good JSP 2.0 Book? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/23bfc11924c6feb3 * Static class - one per JVM or one per app? - 3 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ca34807378a1843d * Initialize managed bean with header information? - 2 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/93dafdedaebfbd60 ============================================================================== TOPIC: JBoss & BMP Entity Bean with DB http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fc3ae602d0e52d09 ============================================================================== == 1 of 1 == Date: Mon, Dec 13 2004 8:12 pm From: "Thomas Hoheneder" I want just to tell you that I have solved my problem with the help of the Internet and a friend of mine. The main mistake I had is that I had no datasource in my code. So to establish a db connection I have now --------------------------------------------------------- initialContext = new InitialContext(); this.jdbcFactory = (DataSource) initialContext.lookup("java:PostgresDS"); connection = jdbcFactory.getConnection(); --------------------------------------------------------- where jdbcFactory is of type javax.sql.DataSource. My DB parameters I have no longer in my ejb-jar.xml but in a JBoss own xml file named postgres-ds.xml which I have copied into my application deploy directory. The file's content is: --------------------------------------------------------- <datasources> <local-tx-datasource> <jndi-name>PostgresDS</jndi-name> <connection-url>jdbc:postgresql://127.0.0.1:5432/registration</connection-ur l> <driver-class>org.postgresql.Driver</driver-class> <user-name>postgres</user-name> <password>xyz</password> </local-tx-datasource> </datasources> --------------------------------------------------------- Here is also my db driver class defined as you can see (which was my main problem before). Now it works. Nice greetings from Thomas -----------== Posted via Newsfeed.Com - Uncensored Usenet News ==---------- http://www.newsfeed.com The #1 Newsgroup Service in the World! -----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =----- ============================================================================== TOPIC: Singleton or static class? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c6605e437a9085c2 ============================================================================== == 1 of 1 == Date: Mon, Dec 20 2004 4:26 pm From: Chris Berg On Sun, 19 Dec 2004 23:19:18 +0100, Stefan Schulz <[EMAIL PROTECTED]> wrote: >On Sun, 19 Dec 2004 22:59:06 +0100 >Chris Berg <[EMAIL PROTECTED]> wrote: > >> Hmm.. Have you ever tried it? What WILL eventually happen? Stack >> overflow? VM nervous breakdown? Nuclear meltdown? I would suppose the >> VM should be able to either survive such a situation, or at least exit >> with a meaningful message. Or would that be OS dependent? > >The result is actually well-defined. But it is completely contrary to >any expectation: The static final fields actually start off as null, but >then get reassinged. I actually spend two days tracking down that bug, >and henceforth saw the rationale behind the singleton patter. :) Aha! I think you have a very good point here. As you mentioned earlier, the circular reference can very well be much less obvious than your example shows. And it is logical that the variable at first is null, then later becomes assigned, hence no system-error-message. I'm convinced! Chris ============================================================================== TOPIC: How do I start up JBoss using ant? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e20ea52fd1c63536 ============================================================================== == 1 of 1 == Date: Mon, Dec 20 2004 7:28 am From: [EMAIL PROTECTED] within an ant script running within Eclipse 3.0.1(which has ant 1.6.2 built in), I'm trying to start up an instance of JBoss on my local machine. However, I'm having some problems with it. here's the call: <exec command="run.bat" dir="${jboss.root.dir}\bin\" spawn="true" /> here's the error: BUILD FAILED: C:\eclipse3.0.1\eclipse\IsrsQueryWebServiceWorkSpace\IsrsQueryWebService\build.xml:88: Execute failed: java.io.IOException: CreateProcess: run.bat error=2 I was wondering if anyone might have a clue about why it's getting this error, and I was also wondering if any custom ant tasks for JBoss startup/shutdown existed...I've googled but haven't found any yet. thanks Mike Kohout ============================================================================== TOPIC: Setting DOCTYPE to a DOM- document http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7f0a2e7258baad09 ============================================================================== == 1 of 2 == Date: Mon, Dec 20 2004 4:30 pm From: Michael Preminger Hello! I am trying to create an XHTML-document using the org.w3c.dom and javax.xml.transform package, but cannot find any elegant way of putting a <DOCTYPE declaration into the output document. I create a Document object with the newDocument() method of a javax.xml.parsers.DocumentBuilder object, and writing it out using an identity transform, (as in sun's tutorial http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JAXPXSLT4.html) The turorial has a recommendation for processing DOCTYPE, using the following code: ... if (document.getDoctype() != null){ String systemValue = (new File(document.getDoctype().getSystemId())).getName(); transformer.setOutputProperty( OutputKeys.DOCTYPE_SYSTEM, systemValue ); } But this does not seem to have the effect I expect, and is probably not intended for my expressed need. Is there a standard way of setting a <DOCTYPE ...> declaration to a DOM - document created in this way, or do I have to create my XHTML some other way? Thanks Michael == 2 of 2 == Date: Mon, Dec 20 2004 11:56 am From: "John C. Bollinger" Michael Preminger wrote: > I am trying to create an XHTML-document using the org.w3c.dom and > javax.xml.transform package, but cannot find > any elegant way of putting a <DOCTYPE declaration into the output document. > > I create a Document object with the newDocument() method of a > javax.xml.parsers.DocumentBuilder object, and writing it out using an > identity transform, (as in sun's tutorial > http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JAXPXSLT4.html) You cannot set a DocumentType on an existing Document, but you should be able to create a Document that has the desired type in the first place. Get a DOMImplementation object from your DocumentBuilder -- it has the methods you need. > The turorial has a recommendation for processing DOCTYPE, using the > following code: > ... > if (document.getDoctype() != null){ > String systemValue = (new > File(document.getDoctype().getSystemId())).getName(); > transformer.setOutputProperty( > OutputKeys.DOCTYPE_SYSTEM, systemValue > ); > } Not immediately relevant. That's for _processing_ the DocumentType for a Document when it has one; it is not useful in assigning a DocumentType to a Document instance that doesn't already have one. You may find it needful after you get a Document containing DocumentType node, but you may find that you don't need it at all. > But this does not seem to have the effect I expect, and is probably not > intended for my expressed need. > > > Is there a standard way of setting a > <DOCTYPE ...> declaration to a DOM - document created in this way, or do > I have to create my XHTML some other way? See above. John Bollinger [EMAIL PROTECTED] ============================================================================== TOPIC: myeclipse webservices axis http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4c1ba84ad117dd77 ============================================================================== == 1 of 1 == Date: Mon, Dec 20 2004 12:50 pm From: "andreikov" Hello, I' m working in MyEclipse and I have the project web service's source, i can't open this project, because i don't know how install the axis and wsdd, Who can help me, please? Thanks Leo. PD: i have the folders: beans, misc, servlet -- Leonardo Arriagada Martinez Santiago de Chile ============================================================================== TOPIC: Calling the native Linux mutt module from Java... http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/52d060d3a36936c5 ============================================================================== == 1 of 2 == Date: Mon, Dec 20 2004 4:19 pm From: bugbear Gordon Beaton wrote: > > > Read from the child process' stdout and stderr streams, the program > probably tells you why it fails. You should do that anyway, since > failing to do so could cause it to hang. Quite. This is actually rather error prone; I had quite a struggle to achieve a reliable in *all* circumstances exec in my app. here's a slightly OT, but very helpful thread: http://forum.java.sun.com/thread.jspa?threadID=214646&tstart=285 BugBear == 2 of 2 == Date: Mon, Dec 20 2004 7:29 pm From: K2 Gordon Beaton wrote: > > Read from the child process' stdout and stderr streams, the program > probably tells you why it fails. You should do that anyway, since > failing to do so could cause it to hang. > > Other than that, post the relevant code and the exact command line > that fails. Thanks Gordon, that was helpful, however it brought up another issue. I'm providing the demo code here that includes the comments on setting it up and the problem that I've run into... -------------- <MuttProblem.java> -------------------------------- import java.io.*; public class MuttProblem { /** * Entry point to execute the MuttProblem process. * * For the sake of this demo will need to create the text file * /tmp/results.txt prior to running. This will be the message * text that will be included in the body of the resulting email. * * @param args Passed from the calling process. For purposes of * this example it requires a valid email address to post * the resulting email to. */ public static void main(String[] args) { if(args.length == 0) throw new RuntimeException("You must provide the target" + " email address as the first arguement\n" + "for purposes of this example"); try{ // if location of mutt is different then the location // stated here adjust accordingly... String []testArgs = { "/usr/bin/mutt", "-s \"Unit Tests results\"", "-i/tmp/results.txt", "-c" + args[0]}; // I've also attempted simply passing in the testCommand //String here. Same result. Process muttProcess = Runtime.getRuntime().exec(testArgs); /* If this is uncommented and the exec should succeed, the call to waitFor() hangs. While this helped me debug some of the problems I had in working out the arguement format issues I had, it doesn't do me much good in production enviroment. Any ideas on why it hangs? Is this caused by the mutt process or ? muttProcess.waitFor(); System.out.println("Exit value = " + muttProcess.exitValue()); if( muttProcess.exitValue() != 0 ){ BufferedReader brr = new BufferedReader(new InputStreamReader ( (muttProcess.getErrorStream()))); String line; while(null != (line = brr.readLine())) { System.out.println(line); } } */ } catch (Exception ex) { ex.printStackTrace(System.out); } } } -------------- </MuttProblem.java> ------------------------------- thanks again for any information. -- If replying directly, please edit out the cleverly decorated bits from my email address. ============================================================================== TOPIC: Thread programming in J2EE http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/22b32fb847cd1773 ============================================================================== == 1 of 1 == Date: Mon, Dec 20 2004 4:46 pm From: "Jon Smith" What is the best way of creating threads in J2EE, I am trying to migrate a standalone component into a web app. It creates a number of threads to do work in the background. I understand J2EE does not support user thread management. I do not want to go to all the effort creating EJBs, is WorkManager the way to go, I cannot find many examples of this. Can someone please point me in the right direction Cheers Jon ============================================================================== TOPIC: JSP JavaBeans problem in scope="session" attribute http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2e1bcbc17605207 ============================================================================== == 1 of 3 == Date: Mon, Dec 20 2004 9:17 am From: [EMAIL PROTECTED] I use scope="session" in <jsp:useBean id="user" class="com.proj1.model.User" scope="session"/>, and I expect the bean name user doesn't need to redeclare in other pages, because the bean is available throughout the session. User Id = 1234 is shown in test1.jsp, but when the user click the submit button, then it has error Parsing of JSP File '/test/test2.jsp' failed: /test/test2.jsp(1): "user" is not a defined bean variable on this page probably occurred due to an error in /test/test2.jsp line 1: <H1>User ID = <jsp:getProperty name="user" property="userId"/></H1> test1.jsp ========= <jsp:useBean id="user" class="com.proj1.model.User" scope="session"/> <jsp:setProperty name="user" property="userId" value="1234"/> <H1>User ID = <jsp:getProperty name="user" property="userId"/></H1> <html> <head> </head> <body> <form action="test2.jsp" method="POST"> <input type="submit" value="submit here"> </form> </body> </html> test2.jsp ========= <H1>User ID = <jsp:getProperty name="user" property="userId"/></H1> any ideas? please advise. thanks!! == 2 of 3 == Date: Mon, Dec 20 2004 10:06 am From: "Robert kebernet Cooper" [EMAIL PROTECTED] wrote: I expect the bean name user doesn't need to redeclare in other > pages, > because the bean is available throughout the session. You still need to have the bean tag in your other pages though. The "session" means that a new bean won't be created on another page, rather the bean you created on the first page will be maintained. == 3 of 3 == Date: Mon, Dec 20 2004 12:12 pm From: [EMAIL PROTECTED] > You still need to have the bean tag in your other pages though. The > "session" means that a new bean won't be created on another page, > rather the bean you created on the first page will be maintained. What do you mean by need the bean tag? Do I need to declare the following in page2.jsp also? <jsp:useBean id="user" class="com.proj1.model.User" scope="session"/> ============================================================================== TOPIC: Problem getting MDB work with JBoss 4.0 http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/682f01f07e9e687c ============================================================================== == 1 of 1 == Date: Mon, Dec 20 2004 6:37 pm From: "Thomas Hoheneder" Hello, I have a problem getting a message-driven EJB work with JBoss 4.0. My scenario consists of three files: - de\th\ejb\MyMDB.class - META-INF\ejb-jar.xml - META-INF\jboss.xml which I have deployed as a package named mymdb.jar. When starting up JBoss I always get the error javax.naming.NameNotFoundException: DefaultJMSProvider not bound and I have no idea where in the code or in the configuration the DefaultJMSProvider is set. My full code including the error message can be seen at http://www.thomas-hoheneder.de/temp/java/mdb.txt I don't know what to do but I assume the JNDI string at my code line QueueConnectionFactory qcf = (QueueConnectionFactory) initContext.lookup("java:comp/env/jms/QCF"); might be false. I have tried both "java:comp/env/jms/QCF" and "ConnectionFactory" JNDI lookup strings, but both lead to the error mentioned above. Any suggestions to get my applcation work? Any help to this would be much appreciated. Thanks in advance. Nice greetings from Thomas -----------== Posted via Newsfeed.Com - Uncensored Usenet News ==---------- http://www.newsfeed.com The #1 Newsgroup Service in the World! -----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =----- ============================================================================== TOPIC: cloning with generics http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/721598b62b19173b ============================================================================== == 1 of 2 == Date: Mon, Dec 20 2004 9:39 am From: [EMAIL PROTECTED] (scott moss) I need to clone a generic ArrayList. But clone(), of coure, returns an object and has not, as far as I can tell been "generified". Consequently, I need to cast in the old way -- albeit to a generic ArrayList. The relevant bits of code are: {ArrayList<ArrayList<BindingVariable>> bindings; [snip] for (ArrayList<BindingVariable> bindingList : newBindings) { ArrayList<BindingVariable> currList = (ArrayList<BindingVariable>) bindings.get(bIndex).clone(); ..... This gives me the compiler warning about an unchecked cast. Without the cast I get an incompatible types error since the uncast clone need not be an ArrayList<BindingVariable> The code runs but I would prefer a compile time error to a runtime error when messing about with the code at some later time. This isn't a high priority, but I suspect that there are a lot of us coming to terms with generics and a solution might be of some general interest. Certainly, I'd welcome advice on this. Thanks Scott == 2 of 2 == Date: Mon, Dec 20 2004 6:47 pm From: Tilman Bohn In message <[EMAIL PROTECTED]>, scott moss wrote on 20 Dec 2004 09:39:51 -0800: [...] > This isn't a high priority, but I suspect that there are a lot of us > coming to terms with generics and a solution might be of some general > interest. Which is why it was most recently answered last week. ;-) -- Cheers, Tilman `Boy, life takes a long time to live...' -- Steven Wright ============================================================================== TOPIC: JSTL tags in output http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5784c409befba099 ============================================================================== == 1 of 1 == Date: Mon, Dec 20 2004 10:19 am From: "Robert kebernet Cooper" [EMAIL PROTECTED] wrote: > Hi, > > What are some of the more common reasons for JSTL tags appearing in the > final generated HTML? Where should I start to look? > > Thank you, > Kate Did you import the tagset at the top of your JSP? ============================================================================== TOPIC: Classes in jar can't load - why? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/dc2f55bd4b5e0165 ============================================================================== == 1 of 1 == Date: Mon, Dec 20 2004 7:42 pm From: "Andy" > Tell 'em it is because the only thing you gained from it was the > ability to cut in to usenet conversations two days late to whine > about the advice provided by others. That should clear it up. Well, once again we see why nobody wants to study computer science. My mother told me to study to be a doctor ... man, do I regret my computer science studies. 5 years of know it all-jerks and no girls ... ============================================================================== TOPIC: how to post UTF-8 values to a servlet http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8720339cb557e8ea ============================================================================== == 1 of 1 == Date: Mon, Dec 20 2004 6:42 pm From: "Andy Fish" Hi, I have a form with some text boxes, and I'm trying to post the data to a servlet in utf-8 format (which I would have thought would be the default but it appears not?) the HTML file containing the form itself is definitely encoded in UTF-8, and the form tag looks like this: <form action="http://localhost:8080/foo/servlet" method="post" id="form1" charset="UTF-8" name="form1"> <INPUT type="text" name="foo"> </form> In the servlet I'm just calling request.getParameter("foo"); If I type in an English pound sign £ (this is the English currency symbol, not #), I get £ (which is A circumflex followed by the pound sign). I've been playing with various variations for 1/2 a day now and it's starting to get me rather frustrated. Can anyone point me in the right direction. TIA Andy ============================================================================== TOPIC: An efficient computation idea. Please comment http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5d714c128b46864f ============================================================================== == 1 of 1 == Date: Mon, Dec 20 2004 7:18 pm From: Mark Thornton Aaron Fude wrote: > For the record, the computational efficiency you are suggesting speeds up > the code by a factor of 100. All I'm saying, why not speed it up by a factor > of 2 or 3 on top of that. You would be better off spending the time ensuring that the calculation is numerically stable. As I indicated, a better understanding of numerical analysis may well allow a far larger improvement in speed. Mark Thornton ============================================================================== TOPIC: Good JSP 2.0 Book? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/23bfc11924c6feb3 ============================================================================== == 1 of 1 == Date: Mon, Dec 20 2004 11:52 am From: [EMAIL PROTECTED] I am a fairly experienced programmer. I've predominantly written web apps using Microsoft technologies and am looking to learn Java Server Pages 2.0. Can anyone recommend a good book? Looking for a book which assumes that the reader has a web development background - don't need a tutorial on how/why pages need to be generated dynamically. Need a "how to build web apps using JSP" type of book.. thanks, Bijoy ============================================================================== TOPIC: Static class - one per JVM or one per app? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ca34807378a1843d ============================================================================== == 1 of 3 == Date: Mon, Dec 20 2004 11:52 am From: [EMAIL PROTECTED] I have a class called MyClass that contains a static variable (myVar). I have two J2EE apps running on WebSphere under the same JVM, MyFirstApp and MySecondApp. From MyFirstApp i set the value of myVar by doing MyClass.setMyVar(3). ....what will be the value of MyClass.getMyVar() when run from MySecondApp? ie - will the static var have scope across the whole JVM or just the web app? Thanks David Bevan http://www.davidbevan.co.uk == 2 of 3 == Date: Mon, Dec 20 2004 12:00 pm From: "cnpeyton" How do you have MyClass packaged? Is it in both EAR files? It will be different in the 2 applications if packaged that way. The key isn't the applications but the classloaders. If you had it in a utility jar that was in the was/lib/ext directory, then it would be the same for all applications. You can have a static resource and it can be different in every classloader. Chris == 3 of 3 == Date: Mon, Dec 20 2004 12:09 pm From: [EMAIL PROTECTED] MyClass is in a jar file and an identical copy of that jar is in the lib folder of each EAR file (each web app is in a separate ear file) ...would it make any difference if MyClass was in a single jar file referenced in the classpath of both apps? How do I know if both apps are using the same classloader or not? Thanks David Bevan http://www.davidbevan.co.uk ============================================================================== TOPIC: Initialize managed bean with header information? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/93dafdedaebfbd60 ============================================================================== == 1 of 2 == Date: Mon, Dec 20 2004 12:10 pm From: [EMAIL PROTECTED] I see I failed to mention that this question is being asked in the context of using the JSF framework. == 2 of 2 == Date: Mon, Dec 20 2004 12:11 pm From: [EMAIL PROTECTED] Clarification: I see I failed to mention that this question is being asked in the context of using the JSF framework. Any advice would be appreciated. ============================================================================== 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
