Re: MySQL + JDBC
Running the binary dist of Tomcat? tomcat.exe / tomcatw.exe PK Todd Grigsby wrote: Patrick J Kobly wrote: Todd Grigsby wrote: Other native apps. The Java apps are being migrated from a 32-bit environment (WinXP and Java 32-bit + Struts 1.1), and they worked there. I don't want to point to any one thing, since every part of the equation is a newer version of what was there before, but at this point the only things that can't use the connections are the web apps. But the web apps are the only things that use Java. You don't have standalone Java apps or Java webapps built on a different framework than Struts... The issue is almost certainly a 32-bit JRE trying to access a 64-bit ODBC driver. I'll buy that, but I'm confused -- I installed 64-bit Java, and when I open a command prompt and do "java -version", it identifies itself as: Java(TM) SE Runtime Environment (build 1.6.0_16-b01) Java HotSpot(TM) 64-Bit Server VM (build 14.2-b01, mixed mode) But I'll see if I have anything on my system that is getting loaded that's 32-bit. Thanks! TG - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Unique Id creation
java.util.UUID.randomUUID() ? http://java.sun.com/j2se/1.5.0/docs/api/java/util/UUID.htm PK jayakumar ala wrote: I am trying to upload multiple files in my application , So i am looking for different approach to create unique Id for all the uploaded files. Any suggestions are appreciated. On Tue, Dec 15, 2009 at 1:54 PM, Gabriel Belingueres wrote: I use File.createTempFile: http://java.sun.com/j2se/1.5.0/docs/api/java/io/File.html#createTempFile(java.lang.String,%20java.lang.String,%20java.io.File) Then I relate the uploaded filename with the saved temp file name in a database table. Gabriel 2009/12/15 Todd Grigsby : > jayakumar ala wrote: Hi All, I am using struts2 in my web application. Which is the best way to create unique Id for each file upload i do in my application...? Thanks Ala I've always used the original filename with a time stamp, down to the millisecond formatted with leading zeros and without separators, appended to the end. If a create fails, I wait a few milliseconds and regenerate the filename. The nice part about the time stamp is that you have the date and time the file was uploaded in the name itself. TG - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: MySQL + JDBC
Todd Grigsby wrote: Other native apps. The Java apps are being migrated from a 32-bit environment (WinXP and Java 32-bit + Struts 1.1), and they worked there. I don't want to point to any one thing, since every part of the equation is a newer version of what was there before, but at this point the only things that can't use the connections are the web apps. But the web apps are the only things that use Java. You don't have standalone Java apps or Java webapps built on a different framework than Struts... The issue is almost certainly a 32-bit JRE trying to access a 64-bit ODBC driver. Have you tried an all 64-bit setup with ODBC? Nope. Have never had a need for ODBC. Though I can sorta see its advantages in a mixed-language environment. TG PK - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: MySQL + JDBC
Do you have other Java apps working, or just other native apps? PK Todd Grigsby wrote: It's all 64-bit, installed correctly enough to work from other apps. I will try the Sun forums. TG - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: "specified DSN contains an architecture mismatch"
Todd Grigsby wrote: I'm trying to get an all 64-bit environment going, but if I have to step down to 32 bit, then that's what I have to do to get going. As for addressing the right crowd, I think you may be right. Except for you, it's been a frustrating exercise. I'm already going through the MySQL forums, but there don't seem to be a lot of posts there from people working with Java+Struts on Win7 64-bit. Broaden your horizons a bit from Java+Struts with MySQL on Win7 64-bit... This is an error message from the ODBC system. It is _not_ coming from Struts. It is _not_ coming from MySQL. It was present on 64-bit versions of Windows prior to Win 7. - The MSDN forums have some info on installing 32-bit ODBC drivers under a 64-bit platform. - The Tomcat guys probably have info on running Tomcat in a 64-bit JRE. Your solution will likely lie in one of those two places. PK Thanks for the suggestions. I'll keep digging. TG Patrick J Kobly wrote: Perhaps try using a 64-bit JVM or installing the 32-bit ODBC driver... The first couple of Google hits when searching for the error message provided seem to suggest hints for installing the 32-bit ODBC driver under 64-bit Windows. You are likely to get more traction on this question asking it of a) Tomcat folks b) Microsoft folks c) Java folks d) MySQL folks Rather than Struts folks. PK Todd Grigsby wrote: Configuration: Windows 7 64 bit Tomcat 6 Struts 2 MySQL 5.1.36 for Win64 MySQL ODBC 5.1 Driver 5.01.06.00 I've created a valid ODBC alias that I can see from other Windows native applications with no problem. When I attempt the following: import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.sql.DataSource; import java.sql.Connection; ... Context context = new InitialContext(); DataSource ds = (DataSource)context.lookup("java:/comp/env/jdbc/odbc/tgecorp"); Connection conn = datasource.getConnection(); ... The last line throws an exception with the following message: "The specified DSN contains an architecture mismatch between the Driver and Application." I reinstalled the driver, redefined the System DSN's in the ODBC administrator, and I still get the same message. Anybody have any idea how to fix this? Todd - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: "specified DSN contains an architecture mismatch"
Perhaps try using a 64-bit JVM or installing the 32-bit ODBC driver... The first couple of Google hits when searching for the error message provided seem to suggest hints for installing the 32-bit ODBC driver under 64-bit Windows. You are likely to get more traction on this question asking it of a) Tomcat folks b) Microsoft folks c) Java folks d) MySQL folks Rather than Struts folks. PK Todd Grigsby wrote: Configuration: Windows 7 64 bit Tomcat 6 Struts 2 MySQL 5.1.36 for Win64 MySQL ODBC 5.1 Driver 5.01.06.00 I've created a valid ODBC alias that I can see from other Windows native applications with no problem. When I attempt the following: import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.sql.DataSource; import java.sql.Connection; ... Context context = new InitialContext(); DataSource ds = (DataSource)context.lookup("java:/comp/env/jdbc/odbc/tgecorp"); Connection conn = datasource.getConnection(); ... The last line throws an exception with the following message: "The specified DSN contains an architecture mismatch between the Driver and Application." I reinstalled the driver, redefined the System DSN's in the ODBC administrator, and I still get the same message. Anybody have any idea how to fix this? Todd - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Jasper Report Plugin
Title: [Fwd: test] System property java.awt.headless needs to be set to true. (-Djava.awt.headless=true in the startup for whichever container you're using) PK Felipe Rodrigues wrote: Hi Guys, I'm having a problem when trying to use JasperReport plugin in a linux machine. I'm getting root cause java.lang.InternalError: Can't connect to X11 window server using 'localhost:0.0' as the value of the DISPLAY variable. sun.awt.X11GraphicsEnvironment.initDisplay(Native Method) sun.awt.X11GraphicsEnvironment.access$100(X11GraphicsEnvironment.java:52) sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:155) java.security.AccessController.doPrivileged(Native Method) sun.awt.X11GraphicsEnvironment.(X11GraphicsEnvironment.java:131) java.lang.Class.forName0(Native Method) java.lang.Class.forName(Class.java:169) java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:68) net.sf.jasperreports.engine.util.JRGraphEnvInitializer.initializeGraphEnv(JRGraphEnvInitializer.java:58) net.sf.jasperreports.engine.fill.JRBaseFiller.(JRBaseFiller.java:363) net.sf.jasperreports.engine.fill.JRVerticalFiller.(JRVerticalFiller.java:77) net.sf.jasperreports.engine.fill.JRVerticalFiller.(JRVerticalFiller.java:59) net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:147) net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:83) net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:601) org.apache.struts2.views.jasperreports.JasperReportsResult.doExecute(JasperReportsResult.java:240) org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:178) Does anybody knows this problem or even have a clue to follow? Cheers, Felipe -- Patrick Kobly, CISSP T: 403-274-9033 C: 403-463-6141 F: 866-786-9459 56 388 Sandarac Dr NW Calgary, Alberta T3K 4E3 http://www.kobly.com begin:vcard fn:Patrick Kobly n:Kobly;Patrick adr:;;56 388 Sandarac Dr NW;Calgary;AB;T3K 4E3;Canada email;internet:[EMAIL PROTECTED] tel;work:(403) 218 - 8376 tel;fax:(866) 786 - 9459 tel;home:(403) 274 - 9033 tel;cell:(403) 669 - 4631 url:http://www.kobly.com version:2.1 end:vcard signature.asc Description: OpenPGP digital signature
Caught OgnlException while setting property 'imageServletUrl'
G'day, I appear to have resolved this issue that I kept running into with the Jasper Reports plugin... If I have an action defined as: WEB-INF/foo.jasper ${contentType} dataSource /servlets/image?image= Using the Jasper Reports plugin that ships with S2 current, I get: 16:02:13,220 WARN [OgnlUtil] Caught OgnlException while setting property 'imageServletUrl' on type 'org.apache.struts2.views.jasperreports.JasperReportsResult'. java.lang.IllegalAccessException: Class ognl.OgnlRuntime can not access a member of class org.apache.struts2.views.jasperreports.JasperReportsResult with modifiers "protected" at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65) at java.lang.reflect.Field.doSecurityCheck(Field.java:960) at java.lang.reflect.Field.getFieldAccessor(Field.java:896) at java.lang.reflect.Field.set(Field.java:657) at ognl.OgnlRuntime.setFieldValue(OgnlRuntime.java:1140) ... And the imageServletUrl param does not take effect. The issue appears to be that all of the setters in JasperReportsResult return a JasperReportsResult. The JavaBeans spec identifies that the setter for a simple property must return void. As a result, BeanInfo.getPropertyDescriptors won't see these setters as write methods for properties. With the other props in this class, that's not a problem - since they don't have getters, we don't get any propertyDescriptors for the properties, and proceed to look for methods individually (OgnlRuntime.java:1296). For imageServletUrl, however, there _is_ a valid getter. BeanInfo sees this as a read-only prop and returns a property descriptor for it, showing exactly that. Back in OGNL code, we see that we got a PropertyDescriptor, and don't bother asking for all methods. getSetMethod says "I don't have a set method," so OGNL eventually tries to just poke the field, resulting in the above error because the field is protected. Solution: modify the setters in JasperReportsResult to return void. This has been confirmed to fix the above problem. PK - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem with Struts 2 setup -The requested resource (/struts2-blank-2.0.6/) is not available
Download a more recent JVM for Tomcat to use. Looks like struts needs 1.5+... PK Jack Yu wrote: Ok, I found the error from the log == 2007-05-07 12:51:55 StandardContext[/manager]HTMLManager: start: Starting web application at '/struts2-blank-2.0.6' 2007-05-07 12:51:56 StandardContext[/struts2-blank-2.0.6]Exception starting filter struts2 java.lang.UnsupportedClassVersionError: org/apache/struts2/dispatcher/FilterDispatcher (Unsupported major.minor version 49.0) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] sending multiple 'bank account' objects to view page
MarcusFenix wrote: All the time, I was thinking about that "staticly instatiate" means - instatiate the object without using a "new" operator. And I was wrong :/// could U tell me what`s "static instatiate"? I`m search in google, but i don`t find answer... This`s connotated with getInstanceOf method? Please, give me an example. Regards, C. Java does not do static instantiation of objects like C++ / C# [?]. Java does support static instantiation of primitives (obviously). Perhaps you were confused when Paul said "First I'd say ditch the static references..." What he meant here was, you had a static member (private static int currentAmount = 0;) and two static methods (public static void setCurrentAmount(int _currentAmount) and public static int getCurrentAmount()). This is clearly not what you want. A static member is shared by all instances of the class. A static method cannot manipulate instance variables. Now, seeing what you did with your recent code, you did correctly remove "static" from the member variable and methods. As Dave Newton pointed out, the error given by the container is almost definitely because you are trying to call a method on a variable that is not instantiated. Either in the constructor of Settings, or in the declaration of the ac1,ac2,ac3 member variables, you need st like: ac1=new Account(); ac2=new Account(); ... before you call ac1.setCurrentAmount. I would suggest that you take a look at some of the Java primers / intro OO courses available. PK - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 2 Jasper Reports Plugin
You probably want st like: The problem is that the servlet request is set by an interceptor (servlet-config) that is in the default stack defined in struts-default. The jasperreports-default package does not define any interceptor stacks, and does not extend any other packages. PK ChristopherAngel wrote: Apparently using HttpServletRequest request = ServletActionContext.getRequest(); So why is the setServletRequest method not called? ChristopherAngel wrote: I have the following package defined in my struts.xml file: method="generateReport"> reports/report.jasper dataSource the generateReport method is called as expected except despite ReportAction implementing ServletRequestAware the setServletRequest method is never called. How can I get access to the HttpServletRequest object from within the generateReport method? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Common header and footer html
G'day, This is probably the suck, but: template.jsp: <[EMAIL PROTECTED] prefix="s" uri="/struts-tags" %> <[EMAIL PROTECTED] import='com.opensymphony.xwork2.ActionContext' %> Some header stuf <%! String actionname=(String)ActionContext.getContext().get(ActionContext.ACTION_NAME); %> "/> Footer stuff With a default action that looks like: template.jsp Now, you've gotta do a bit more in the template JSP to deal with actions like foo_input... But that's kinda the idea... PK Ståle Undheim wrote: Currently, all my jsp pages are structured like this: * identical html header and tag ... * page specific content * identical trail of and Instead of copying this for every file, I would like to have 1 common outer wrapper file, that includes a jsp based on the action or something. I have been looking at the tiles plugin, but I couldn't make out enough from the documentation to see how I could use it. My ideal solution would be something like having a layout.jsp that looks like this: <% include jsp based on ActionName or an annotation, or that I can set with an interceptor of sorts. %> - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Parsed contentType in Stream result type, JR plugin
G'day, Don't know if this has been mentioned before, but 'twould be useful to be able to get StreamResult to take the contentType param as an index into the value stack (I have an action that determines content type based on user input). Worked around this by extending StreamResult and overriding doExecute(), but perhaps this is a more common occurrence. Also, it would be useful if the JR plugin were to check if the param datasource is an instance of JRDataSource and if so, use it directly, rather than instantiating a ValueStackDataSource on it. I'm working with a bunch of Reports built to XML data sources, and clearly, the ValueStackDataSource doesn't play nicely with the XPath expressions in the JRFields. Worked around this by building all the JR stuff directly into the action class. PK - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]