Search Results

Search found 601 results on 25 pages for 'commons beanutils'.

Page 17/25 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • Spring/Hibernate: InvocationTargetException when deleting entity

    - by niklassaers
    I'm sorry if this question is a bit vague, but I'm quite confused. I've got a controller that calls a service to delete an entity and then create an entity in its place. In the service, I've got my DAO, and my entity, and I want to delete my entity, so I call DAO.delete(entity); Then, seemingly out of nowhere, I get an InvocationTargetException. The parameters here are: method: public org.springframework.web.servlet.ModelAndView tld.myproject.view.web.controller.MyController.replaceEntity(org.springframework.web.multipart.MultipartFile,javax.servlet.http.HttpServletRequest) target: tld.myproject.view.web.controller.MyController@185918e args: [org.springframework.web.multipart.commons.CommonsMultipartFile@14812a6, org.springframework.web.multipart.support.DefaultMultipartHttpServletRequest@c08a64] ex: java.lang.reflect.InvocationTargetException private Object doInvokeMethod(Method method, Object target, Object[] args) throws Exception { ReflectionUtils.makeAccessible(method); try { return method.invoke(target, args); } catch (InvocationTargetException ex) { ReflectionUtils.rethrowException(ex.getTargetException()); } throw new IllegalStateException("Should never get here"); } Does anyone have a suggestion to what's going on? Anything I can use in my debugging? Cheers Nik

    Read the article

  • Hibernate error: cannot resolve table

    - by Roman
    I'm trying to make work the example from hibernate reference. I've got simple table Pupil with id, name and age fields. I've created correct (as I think) java-class for it according to all java-beans rules. I've created configuration file - hibernate.cfg.xml, just like in the example from reference. I've created hibernate mapping for one class Pupil, and here is the error occured. <hibernate-mapping> <class name="Pupil" table="pupils"> ... </class> </hibernate-mapping> table="pupils" is red in my IDE and I see message "cannot resolve table pupils". I've also founded very strange note in reference which says that most users fail with the same problem trying to run the example. Ah.. I'm very angry with this example.. IMHO if authors know that there is such problem they should add some information about it. But, how should I fix it? I don't want to deal with Ant here and with other instruments used in example. I'm using MySql 5.0, but I think it doesn't matter. UPD: source code Pupil.java - my persistent class package domain; public class Pupil { private Integer id; private String name; private Integer age; protected Pupil () { } public Pupil (String name, int age) { this.age = age; this.name = name; } public Integer getId () { return id; } public void setId (Integer id) { this.id = id; } public String getName () { return name; } public void setName (String name) { this.name = name; } public Integer getAge () { return age; } public void setAge (Integer age) { this.age = age; } public String toString () { return "Pupil [ name = " + name + ", age = " + age + " ]"; } } Pupil.hbm.xml is mapping for this class <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="domain" > <class name="Pupil" table="pupils"> <id name="id"> <generator class="native" /> </id> <property name="name" not-null="true"/> <property name="age"/> </class> </hibernate-mapping> hibernate.cfg.xml - configuration for hibernate <hibernate-configuration> <session-factory> <!-- Database connection settings --> <property name="connection.driver_class">com.mysql.jdbc.Driver</property> <property name="connection.url">jdbc:mysql://localhost/hbm_test</property> <property name="connection.username">root</property> <property name="connection.password">root</property> <property name="connection.pool_size">1</property> <property name="dialect">org.hibernate.dialect.MySQL5Dialect</property> <property name="current_session_context_class">thread</property> <property name="show_sql">true</property> <mapping resource="domain/Pupil.hbm.xml"/> </session-factory> </hibernate-configuration> HibernateUtils.java package utils; import org.hibernate.SessionFactory; import org.hibernate.HibernateException; import org.hibernate.cfg.Configuration; public class HibernateUtils { private static final SessionFactory sessionFactory; static { try { sessionFactory = new Configuration ().configure ().buildSessionFactory (); } catch (HibernateException he) { System.err.println (he); throw new ExceptionInInitializerError (he); } } public static SessionFactory getSessionFactory () { return sessionFactory; } } Runner.java - class for testing hibernate import org.hibernate.Session; import java.util.*; import utils.HibernateUtils; import domain.Pupil; public class Runner { public static void main (String[] args) { Session s = HibernateUtils.getSessionFactory ().getCurrentSession (); s.beginTransaction (); List pups = s.createQuery ("from Pupil").list (); for (Object obj : pups) { System.out.println (obj); } s.getTransaction ().commit (); HibernateUtils.getSessionFactory ().close (); } } My libs: antlr-2.7.6.jar, asm.jar, asm-attrs.jar, cglib-2.1.3.jar, commons-collections-2.1.1.jar, commons-logging-1.0.4.jar, dom4j-1.6.1.jar, hibernate3.jar, jta.jar, log4j-1.2.11.jar, mysql-connector-java-5.1.7-bin.jar Compile error: cannot resolve table pupils

    Read the article

  • How can I disable Hibernate-cache logs?

    - by Mulone
    Hi guys, My Grails app log is being flooded with thousands of messages like: 2010-05-21 18:54:08,261 [30462143@qtp-19943008-38] DEBUG hibernate.EhCache - key: ga_event value: 5220206380077056 This is my log4j config: // log4j configuration log4j = { // Example of changing the log pattern for the default console // appender: // appenders { console name:'stdout',layout:pattern(conversionPattern: '%c{2} %m%n') rollingFile name:'applog', file: logDirectory+"/${appName}_main.log", maxFileSize:'10MB' //'null' name:'stacktrace' file name: 'stacktrace', file: logDirectory+"/${appName}_stacktrace.log", layout: pattern(conversionPattern: '%c{2} %m%n') } error 'org.codehaus.groovy.grails.web.servlet', // controllers 'org.codehaus.groovy.grails.web.pages', // GSP 'org.codehaus.groovy.grails.web.sitemesh', // layouts 'org.codehaus.groovy.grails.web.mapping.filter', // URL mapping 'org.codehaus.groovy.grails.web.mapping', // URL mapping 'org.codehaus.groovy.grails.commons', // core / classloading 'org.codehaus.groovy.grails.plugins', // plugins 'org.codehaus.groovy.grails.orm.hibernate', // hibernate integration 'org.springframework', 'org.hibernate', stacktrace: "stacktrace" warn 'org.mortbay.log' root { debug 'stdout', 'applog' additivity = true } } Any idea on how to disable that log? Cheers

    Read the article

  • Tomcat: recommandations for logging

    - by WizardOfOdds
    I've read several questions here concerning Tomcat and logging but I still really don't understand the "bigger picture", hence my question: How and where are my Webapps supposed to do their logging? By default on my setup Tomcat 6.0.20 logs go in the following file/appender: ./apache-tomcat-6.0.20/logs/catalina.out Am I suppose to have my webapps also log to this file/appender? Let say my case is trivially simple and I've got just one servlet: import ... // What do I import here in order to be able to log? public class SOServlet extends HttpServlet { public void doGet( final HttpServletRequest request, final HttpServletResponse response ) throws IOException, ServletException { ... // I want to log here, what do I write? What are the gotchas knowing that there are more than one webapp running on the same Tomcat? (apparently from reading the various questions there are many gotchas). What about the .war, do I need to put log4j/sl4f/commons-logging/whatever in my .war?

    Read the article

  • Comparing two java objects on fly (data type not known)

    - by Narendra
    Hi All, I need to compare different data objects. Can any one tell me how can i do this. I don't know what are the data types i will get priorly. If i need to use any util from apache commons then please give reference to it. At present I am using .equals() for comparing equality of objects .It is working fine when I am comparing quality for two strings. If i am comparing java.sql.date data type then it is showing unequal even though both contains same values. Can any one suggest me on this regard. Thanks, Narendra

    Read the article

  • How to ensure that no non-ascii unicode characters are entered ?

    - by Jacques René Mesrine
    Given a java.lang.String instance, I want to verify that it doesn't contain any unicode characters that are not ASCII alphanumerics. e.g. The string should be limited to [A-Za-z0-9.]. What I'm doing now is something very inefficient: import org.apache.commons.lang.CharUtils; String s = ...; char[] ch = s.toCharArray(); for( int i=0; i<ch.length; i++) { if( ! CharUtils.isAsciiAlphanumeric( ch[ i ] ) throw new InvalidInput( ch[i] + " is invalid" ); } Is there a better way to solve this ?

    Read the article

  • How to load a configuration file at startup within tomcat

    - by Alex
    I want to be able to load my configuration for the webapp at startup of tomcat (apache commons configuration library) is this a possible way: public class MyAppCfg implements javax.servlet.ServletContextListener { private ServletContext context = null; @Override public void contextInitialized(ServletContextEvent event) { try{ this.context = event.getServletContext(); XMLConfiguration config = new XMLConfiguration("cfg.xml"); config.setReloadingStrategy(new FileChangedReloadingStrategy()); this.context.setAttribute("mycfg", config); } catch (Exception e) { e.printStackTrace(); } } @Override public void contextDestroyed(ServletContextEvent arg0) { this.context = null; } } web.xml <listener> <listener-class>mypackage.MyAppCfg</listener-class> </listener> and later acces them in the webapp via this.cfg = (XMLConfiguration) servletRequest.getAttribute("mycfg");

    Read the article

  • How to manage Libraries/jar files in eclipse?

    - by pvsnp
    I might be missing something but how do you manage Java projects in eclipse that need a lot of Jar files. I know maven manages libraries well if there are new updates but maybe I'm missing something, is there a way that eclipse can update new jar files (it would be especially useful for projects using apache-commons, say). I don't want to sound like asking for a feature request, but I'm looking at if there are ways to keep libraries jar files that a Java project uses to keep them updated automatically the way maven does. With more languages coming with this type of features, finding the right Jar files probably should be easier than this.

    Read the article

  • css opacity not working in IE7

    - by Alsciende
    I have this test page : http://jsfiddle.net/VWnm9/7/. The image is correctly faded on all my computers running IE6, 7 or 8, except for one computer that runs IE7 and doesn't fade the flower, even in noext mode. The page is : <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"> <head> <style type="text/css"> body { background: blue; } img { filter: alpha(opacity=10); opacity: 0.1; } </style> </head> <body> <img src="http://upload.wikimedia.org/wikipedia/commons/c/c3/Extracted_pink_rose.png" /> </body> </html> Does anybody have an idea why?

    Read the article

  • Configuration for log4j to log ERROR level to a DB table

    - by firnnauriel
    Using the default config of a fresh Grails project, how do i change it so that ONLY error level messages will go to 'Message' table? // log4j configuration log4j = { // Example of changing the log pattern for the default console // appender: // //appenders { // console name:'stdout', layout:pattern(conversionPattern: '%c{2} %m%n') //} error 'org.codehaus.groovy.grails.web.servlet', // controllers 'org.codehaus.groovy.grails.web.pages', // GSP 'org.codehaus.groovy.grails.web.sitemesh', // layouts 'org.codehaus.groovy.grails.web.mapping.filter', // URL mapping 'org.codehaus.groovy.grails.web.mapping', // URL mapping 'org.codehaus.groovy.grails.commons', // core / classloading 'org.codehaus.groovy.grails.plugins', // plugins 'org.codehaus.groovy.grails.orm.hibernate', // hibernate integration 'org.springframework', 'org.hibernate', 'net.sf.ehcache.hibernate' warn 'org.mortbay.log' } Thanks for any leads on this.

    Read the article

  • Why can't untrusted code change the log level under Java Logging?

    - by cdmckay
    I'm have a Java app that also runs as an applet. The app also happens to use a library called BasicPlayer to play .ogg files. BasicPlayer has a built-in logger that uses Apache Logging Commons to create a logger for BasicPlayer.class using the built-in Java logger. The only way that I know about to turn off the BasicPlayer logging is to run this code: Logger.getLogger(BasicPlayer.class.getName()).setLevel(Level.OFF); This works fine when running as a regular app. However, when running as an applet, this code will throw a SecurityException because for some reason applets can't change the log level of non-anonymous loggers (see here for a sorta-explanation). Why would they do this? Who cares if an applet changes the log level?

    Read the article

  • ResultSet and aggregation

    - by kachanov
    Ok, I admit my situation is special There is a data system that supports SQL-92 and JDBC interface However the SQL requets are pretty expensive, and in my application I need to retreive the same data multiple times and aggregate it ("group by") on different fields to show different dimensions of the same data. For example on one screen I have three tables that show the same set or records but aggregated by City (1st grid), by Population (2nd grid), by number of babies (3rd grid) This amounts to 3 SQL queries (which is very slow), UNLESS anyone of you can suggest any idea any library from apache commons or from google code, so that I can select all records into ResultSet and get 3 arrays of data group by different fields from this single ResultSet. Am I'm missing some obvious and unexpected solution to this problem?

    Read the article

  • diff implementation in Java

    - by Frór
    Hi, I'm looking for a diff implementation in Java. I've seen that Python has its own SequenceMatcher (with difflib), which is exactly what I need... in Java. Is there any portage? Or is there any other class/library that performs the same in Java? If not, where can I find the source code of that difflib (if free as in speech) to make my own implementation of SequenceMatcher in Java ? Unfortunately, Apache Commons Lang doesn't help me much. Thanks!

    Read the article

  • Joining remote paths in Java

    - by Mickael Marrache
    I'm using the FTP library provided by Apache (commons-net). I want to check if a file exists on the FTP server so I use the listFiles method of FTPClient: ftpClient.listFiles(remoteFileDir + "\\" + fileName); The current directory is the FTP server root directory. So, the value of remoteFileDir is a path relative to this root directory. My question concerns the merge between the remote directory path and the file name. What is the right way to do it? For a local file, I would do: File file = new File(remoteFileDir,fileName); but here it doesn't work since when I call file.getAbsolutePath(), I get an absolute path for the file in the local current directory which is not what I want. Also, I guess the merging has been done according to my local environment. PS: I looked at How are paths determined on a remote machines? but it doesn't help me. Thanks

    Read the article

  • Does Qt support virtual pure slots ?

    - by ereOn
    Hi, My GUI project in Qt has a lot of "configuration pages" classes which all inherit directly from QWidget. Recently, I realized that all these classes share 2 commons slots (loadSettings() and saveSettings()). Regarding this, I have two questions: Does it make sense to write a intermediate base abstract class (lets name it BaseConfigurationPage) with these two slots as virtual pure methods ? (Every possible configuration page will always have these two methods, so I would say "yes") Before I do the heavy change in my code (if I have to) : does Qt support virtual pure slots ? Is there anything I should be aware of ? Here is a code example describing everything: class BaseConfigurationPage : public QWidget { // Some constructor and other methods, irrelevant here. public slots: virtual void loadSettings() = 0; virtual void saveSettings() = 0; }; class GeneralConfigurationPage : public BaseConfigurationPage { // Some constructor and other methods, irrelevant here. public slots: void loadSettings(); void saveSettings(); };

    Read the article

  • Java file delete on NFS drive

    - by RenegadeAndy
    Hey guys. I am trying to delete a file on a NFS drive. I have had other problems manipulating files on remote drives such as moving a file - however i got around it by not using the conventional method i.e renameFile but instead properly using input and output streams. However using the File.delete() returns false , and I have heard suggestions on using the apache commons io FileUtils class - however it just throws an IO exception. Does anybody have any suggestions on a way to delete a file on a network mounted drive using java? Thanks

    Read the article

  • Accommodating null values in a list?

    - by h259bws
    Hi, I'm new to Java and Groovy and am running into trouble with the following Groovy script. I created this whittled down version of a larger script to facilitate debugging. The script is iterating through a list trying to calc a running total of the values of all objects in the list. Some or all of these objects' values may be null. Script import org.apache.commons.lang.math.NumberUtils class Field { def name def value } def fields = [ new Field(name:'Annuities %', value:75), new Field(name:'Other %', value:null), ] //def totalFunding = fields.inject(0) {int total, Field myField - // total + NumberUtils.toInt(myField.value,0) as Integer def totalFunding = fields.inject(0) {int total, Field myField - total + myField?.value as Integer } It gets this error: Exception thrown: java.lang.NullPointerException java.lang.NullPointerException at Script3$_run_closure1.doCall(Script3:15) at Script3.run(Script3:14) What is the correct way to accomodate null values? Thanks, Betsy

    Read the article

  • Using code from this site

    - by user553798
    Hi, The legal section of this site mentions that all code by the contributors is licensed under the Creative Commons Attribution Share Alike License. Does this mean that I have to attribute the submitter even if the code in question is a few lines amongst hundreds or thousands of lines of code? What if I use code from a book or SDK? For eg; If I use the sample code from Google's Android SDK documentation, does that mean I need to attribute Google every time I write an app, after all it would be impossible to write an app without consulting the SDK docs, atleast initially... I am totally confused :S

    Read the article

  • execute external command / application from java

    - by IttayD
    I'm looking for a package to support reliably executing external processes from Java. My criteria: Abstract over OS. So if I want to run 'foo', it will look for 'foo.bat', 'foo.exe' under windows and 'foo' under other OSs (or, have a way of passing a map of os-command) Being able to execute Java classes by simply giving the class name and arguments (so the package locates the java command, copies jvm flags and then executes) Process stdout and stderr properly Watchdog / Monitoring capabilities I've looked at commons-exec but it looks like it answers only 3 & 4. Ant has support for execution but looks like an overkill to use it for this purpose only.

    Read the article

  • best method for background uploader in Android

    - by Dr.Dredel
    Problem: I want to write a process that will allow a user to take photos with the device and for those photos to then be uploaded to some listener in the cloud. The user should not have to do anything to initiate the upload, a background listener would just watch the folder and as long as it finds files in it it would upload them and delete them. Two problems: 1) how to keep the program running in the background even after the user is no longer taking pictures (and if they reboot the device for it to wake up and finish the uploads, if any remain) 2) assuming the connection is spotty (as it always is) how to verify that a given image has completed its upload, and if not, to resubmit it. I don't need any code examples, I just would like opinions on the best strategy to get this implemented. I was going to use Apache commons and just do an upload to a PHP, but am not sure what sort of error checking exists to take into account a connection drop mid file. TIA.

    Read the article

  • How to detect if a form input element of type file is empty

    - by Ankur
    I have some code which reads a file through a form field of type file <input type="file" ... /> I want to give the user another option of providing a url to a file rather than having to upload it as many are already online. How can I detect when this field is empty on the server side. I am using Apache Commons FileUpload FileItemStream item = iter.next(); name = item.getFieldName(); stream = item.openStream(); if(!item.isFormField()){ if(item.toString()!=""){ .... I need to detect when item is empty. The above code doesn't work, nor does using: if(item.equals(null)){ ....

    Read the article

  • Javascript : where are high level data structures?

    - by user355056
    Hi! I'm writing a client program for a game in Javascript but I'm new in Javascript world. Core Javascript lack of high level data structures. I've found code snippets on internet but I'm looking for a reference library (like commons-collection or google-collection in java world). I found this post: http://stackoverflow.com/questions/2523436/javascript-implementation-of-a-set-data-structure which refers to jshashtable and closure. Are they reference implementations? Do you know something else? Thanks

    Read the article

  • Hashing and salting values

    - by Avanst
    I am developing a small web app that internally authenticates users. Once the user is authenticated my web app then passes some information such as userID and Person's name to a third party web application. The third party developer is suggesting that we hash and salt the values. Forgive my ignorance, but what exactly does that mean? I am writing the app in Java. So what I am planning on doing is hashing the userID, Person's name, and some Math.random() value as the salt with Apache Commons Digest Utils SHA512 and passing that hashed string along with the userID and person's name. Is that the standard practice? I should be passing the third party the salt as well correct?

    Read the article

  • Java - jar with librairies included

    - by kozher
    I am currently trying to make a Jar with all my librairies included. What I have done. I have created folders like this : - main folder - class (which contain all my classes) - ressources (containing all my librairies : mongo, jedis...) - MANIFEST.MF My main class is named process. My manifest is like this : Main-Class: processEAN Class-Path: ressources\commons-pool-1.5.6.jar ressources\jedis-2.0.0.jar resources\mongo-2.6.3.jar class - I have generated the JAR with this command : jar cvmf MANIFEST.MF processEAN.jar class/*.class ressources/*.jar My problem : When executing the JAR I have still the message "Exception in thread "main" java.lang.NoClassDefFoundError: processEAN" Any ideas ? Thanks

    Read the article

  • How to send HTML as GET-Request parameter?

    - by Mork0075
    I would like to send a html string with a GET request like this with Apaches HttpClient: http://sample.com/?html=<html><head>... This doesnt work at the moment, i think its an encoding problem. Do you have any ideas how to do that? method.setQueryString(new NameValuePair[] {new NameValuePair("report", "<html>....")}); client.executeMethod(method) This fails with org.apache.commons.httpclient.NoHttpResponseException: The server localhost failed to respond. If i replace "<html>" by "test.." it works fine. EDIT It seams to be a problem of URL length after encoding, the server doesnt except such long URls. Sending it as POST solves the problem.

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >