Search Results

Search found 13191 results on 528 pages for 'unhandled exception'.

Page 64/528 | < Previous Page | 60 61 62 63 64 65 66 67 68 69 70 71  | Next Page >

  • C# async callback on disposed form

    - by Rodney Burton
    Quick question: One of my forms in my winform app (c#) makes an async call to a WCF service to get some data. If the form happens to close before the callback happens, it crashes with an error about accessing a disposed object. What's the correct way to check/handle this situation? The error happens on the Invoke call to the method to update my form, but I can't drill down to the inner exception because it says the code has been optimized. The Code: public void RequestUserPhoto(int userID) { WCF.Service.BeginGetUserPhoto(userID, new AsyncCallback(GetUserPhotoCB), userID); } public void GetUserPhotoCB(IAsyncResult result) { var photo = WCF.Service.EndGetUserPhoto(result); int userID = (int)result.AsyncState; UpdateUserPhoto(userID, photo); } public delegate void UpdateUserPhotoDelegate(int userID, Binary photo); public void UpdateUserPhoto(int userID, Binary photo) { if (InvokeRequired) { var d = new UpdateUserPhotoDelegate(UpdateUserPhoto); Invoke(d, new object[] { userID, photo }); } else { if (photo != null) { var ms = new MemoryStream(photo.ToArray()); var bmp = new System.Drawing.Bitmap(ms); if (userID == theForm.AuthUserID) { pbMyPhoto.BackgroundImage = bmp; } else { pbPhoto.BackgroundImage = bmp; } } } }

    Read the article

  • oracle hibernate + maven dependenciesm dbcp.basicdatasource exception

    - by Joe
    I'm trying to create a web application using maven, tomcat and hibernate. Now I'm getting a cannot find class for org.appache.commons.dbcp.basicdatasource for bean with name datasource... exception. Without the hibernate aspects it works fine, but if I add <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop> <prop key="hibernate.hbm2ddl.auto">create</prop> <prop key="hibernate.show_sql">true</prop> </props> </property> <property name="mappingResources"> <list> </list> </property> </bean> to my applicationContext then I get the error. What I did was: -add org.hibernate to my pom -put ojdbc16.jar in my tomcat bin folder -add the above snippet to my applicationContext.xml I use a bat file to compile my project (using maven), copy it to my tomcat webapp folder and to start the server. Any input on what I'm doing wrong is welcome.

    Read the article

  • Scanner error that I can't figure out: NoSuchElementException

    - by iaacp
    It's crashing on the third line inside the do-while loop, and doesn't wait for my input: input = kb.nextInt(); Stack trace: Exception in thread "main" java.util.NoSuchElementException at java.util.Scanner.throwFor(Unknown Source) at java.util.Scanner.next(Unknown Source) at java.util.Scanner.nextInt(Unknown Source) at java.util.Scanner.nextInt(Unknown Source) at main.MainDriver.main(MainDriver.java:50) Relevant code: do { displayFullMenu(); System.out.print("Selection: "); input = kb.nextInt(); switch (input) { //Create new survey case 1: currentSurvey = new Survey(); break; //Display current survey case 2: currentSurvey.display(); break; //Save current survey case 3: saveSurvey(currentSurvey); break; //Load a survey case 4: currentSurvey = loadSurvey(); break; //Modify a survey case 5: currentSurvey.modify(); break; /*******************Test Functions*******************/ //Create new test case 6: currentSurvey = new Test(); break; //Display current test case 7: currentSurvey.display(); break; //Save current test case 8: saveSurvey(currentSurvey); break; //Load a test case 9: currentSurvey = loadTest(); break; //Modify a test case 10: currentSurvey.modify(); default: System.out.println("Invalid choice. Please make a valid choice: "); input = kb.nextInt(); System.out.println(); } } while (input != 99); kb.close(); It crashes after I choose option 9. It saves the file correctly, then goes back to the top of the loop, and crashes at the previously mentioned line. I want it to ask for more input. What gives?

    Read the article

  • Is it safe to silently catch ClassCastException when searching for a specific value?

    - by finnw
    Suppose I am implementing a sorted collection (simple example - a Set based on a sorted array.) Consider this (incomplete) implementation: import java.util.*; public class SortedArraySet<E> extends AbstractSet<E> { @SuppressWarnings("unchecked") public SortedArraySet(Collection<E> source, Comparator<E> comparator) { this.comparator = (Comparator<Object>) comparator; this.array = source.toArray(); Collections.sort(Arrays.asList(array), this.comparator); } @Override public boolean contains(Object key) { return Collections.binarySearch(Arrays.asList(array), key, comparator) >= 0; } private final Object[] array; private final Comparator<Object> comparator; } Now let's create a set of integers Set<Integer> s = new SortedArraySet<Integer>(Arrays.asList(1, 2, 3), null); And test whether it contains some specific values: System.out.println(s.contains(2)); System.out.println(s.contains(42)); System.out.println(s.contains("42")); The third line above will throw a ClassCastException. Not what I want. I would prefer it to return false (as HashSet does.) I can get this behaviour by catching the exception and returning false: @Override public boolean contains(Object key) { try { return Collections.binarySearch(Arrays.asList(array), key, comparator) >= 0; } catch (ClassCastException e) { return false; } } Assuming the source collection is correctly typed, what could go wrong if I do this?

    Read the article

  • Loading .dll/.exe from file into temporary AppDomain throws Exception

    Hi Gang, I am trying to make a Visual Studio AddIn that removes unused references from the projects in the current solution (I know this can be done, Resharper does it, but my client doesn't want to pay for 300 licences). Anyhoo, I use DTE to loop through the projects, compile their assemblies, then reflect over those assemblies to get their referenced assemblies and cross-examine the .csproj file. Problem: since the .dll/.exe I loaded up with Reflection doesn't unload until the app domian unloads, it is now locked and the projects can't be built again because VS tries to re-create the files (all standard stuff). I have tried creating temporary files, then reflecting over them...no worky, still have locked original files (I totally don’t understand that BTW). Now I am now going down the path of creating a temporary AppDomain to load the files into and then destroy. I am having problems loading the files though: The way I understand AddDomain.Load is that I should create and send a byte array of the assembly to it. I do that: FileStream fs = new FileStream(assemblyFile, FileMode.Open); byte[] assemblyFileBuffer = new byte[(int)fs.Length]; fs.Read(assemblyFileBuffer, 0, assemblyFileBuffer.Length); fs.Close(); AppDomainSetup domainSetup = new AppDomainSetup(); domainSetup.ApplicationBase = assemblyFileInfo.Directory.FullName; AppDomain tempAppDomain = AppDomain.CreateDomain("TempAppDomain", null, domainSetup); Assembly projectAssembly = tempAppDomain.Load(assemblyFileBuffer); The last line throws an exception: "Could not load file or assembly 'WindowsFormsApplication1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.":"WindowsFormsApplication3, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"}" Any help or thoughts would be greatly appreciated. My head is lopsided from beating it against the wall... Thanks, Dan

    Read the article

  • Orbited exception Data must not be unicode.

    - by Sid
    I am working with orbited and once I switch on orbited in production mode it throws the following error on my screen -- <exception caught here> --- File "/usr/lib/python2.6/dist-packages/twisted/web/server.py", line 150, in process self.render(resrc) File "/usr/lib/python2.6/dist-packages/twisted/web/server.py", line 157, in render body = resrc.render(self) File "/usr/local/lib/python2.6/dist-packages/orbited-0.7.10-py2.6.egg/orbited/transports/base.py", line 21, in render self.conn.transportOpened(self) File "/usr/local/lib/python2.6/dist-packages/orbited-0.7.10-py2.6.egg/orbited/cometsession.py", line 322, in transportOpened self.cometTransport.flush() File "/usr/local/lib/python2.6/dist-packages/orbited-0.7.10-py2.6.egg/orbited/transports/base.py", line 45, in flush self.write(self.packets) File "/usr/local/lib/python2.6/dist-packages/orbited-0.7.10-py2.6.egg/orbited/transports/htmlfile.py", line 42, in write self.request.write(payload); File "/usr/lib/python2.6/dist-packages/twisted/web/http.py", line 862, in write self.transport.write(data) File "/usr/lib/python2.6/dist-packages/twisted/internet/tcp.py", line 420, in write abstract.FileDescriptor.write(self, bytes) File "/usr/lib/python2.6/dist-packages/twisted/internet/abstract.py", line 170, in write raise TypeError("Data must not be unicode") exceptions.TypeError: Data must not be unicode I have absolutely no clue as to what could be the problem. Could anyone point me in the right direction.

    Read the article

  • Updating entity fields in app engine development server

    - by Joey
    I recently tried updating a field in one of my entities on the app engine local dev server via the sdk console. It appeared to have updated just fine (a simple float). However, when I followed up with a query on the entity, I received an exception: "Items in the mSomeList list must all be Key instances". mSomeList is just another list field I have in that entity, not the one I modified. Is there any reason manually changing a field would adversely throw something off such that the server gets confused? Is this a known bug? I wrote an http handler to alter the field through server code and it works fine if I take that approach. Update: (adding details) I am using the python google app engine server. Basically if I go into the Google App Engine Launcher and press the SDK Console button, then go into one of my entities and edit a field that is a float (i.e. change it from 0 to 3.5, for instance), I get the "Items in the mMyList list must all be Key instance" suddenly when I query the entity like this: query = DataModels.RegionData.gql("WHERE mRegion = :1", region) entry = query.get() the RegionData entity is what has the mMyList member. As mentioned previously, if I do not manually change the field but rather do so through server code, i.e. query = DataModels.RegionData.gql("WHERE mRegion = :1", region) entry = query.get() entry.mMyFloat = 3.5 entry.put() Then it works.

    Read the article

  • .NET MissingMethodException occuring on one of thousands of end-user machines -- any insight?

    - by Yoooder
    This issue has me baffled, it's affecting a single user (to my knowledge) and hasn't been reproduced by us... The user is receiving a MissingMethodException, our trace file indicates it's occuring after we create a new instance of a component, when we're calling an Initialize/Setup method in preparation to have it do work (InitializeWorkerByArgument in the example) The Method specified by the error is an interface method, which a base class implements and classes derived from the base class can override as-needed The user has the latest release of our application All the provided code is shipped within a single assembly Here's a very distilled version of the component: class Widget : UserControl { public void DoSomething(string argument) { InitializeWorkerByArgument(argument); this.Worker.DoWork(); } private void InitializeWorkerByArgument(string argument) { switch (argument) { case "SomeArgument": this.Worker = new SomeWidgetWorker(); break; } // The issue I'm tracking down would have occured during "new SomeWidgetWorker()" // and would have resulted in a missing method exception stating that // method "DoWork" could not be found. this.Worker.DoWorkComplete += new EventHandler(Worker_DoWorkComplete); } private IWidgetWorker Worker { get; set; } void Worker_DoWorkComplete(object sender, EventArgs e) { MessageBox.Show("All done"); } } interface IWidgetWorker { void DoWork(); event EventHandler DoWorkComplete; } abstract class BaseWorker : IWidgetWorker { virtual public void DoWork() { System.Threading.Thread.Sleep(1000); RaiseDoWorkComplete(this, null); } internal void RaiseDoWorkComplete(object sender, EventArgs e) { if (DoWorkComplete != null) { DoWorkComplete(this, null); } } public event EventHandler DoWorkComplete; } class SomeWidgetWorker : BaseWorker { public override void DoWork() { System.Threading.Thread.Sleep(2000); RaiseDoWorkComplete(this, null); } }

    Read the article

  • Circular Reference exception with JSON Serialisation with MVC3 and EF4 CTP5w

    - by nakchak
    Hi I'm having problems with a circular reference when i try and serialise an object returned via EF4 CTP5. Im using the code first approach and simple poco's for my model. I have added [ScriptIgnore] attributes to any properties that provide a back references to an object and annoyingly every seems to work fine if i manually instantiate the poco's, i.e. they serialise to JSON fine, and the scriptignore attribute is acknowledged. However when i try and serialise an object returned from the DAL i get the circular reference exception "A circular reference was detected while serializing an object of type 'System.Data.Entity.DynamicProxies.xxxx'" I have tried several ways of retreiving the data but they all get stuck with this error: public JsonResult GetTimeSlot(int id) { TimeSlotDao tsDao = new TimeSlotDao(); TimeSlot ts = tsDao.GetById(id); return Json(ts); } The method below works slightly better as rather than the timeslot dynamic proxied object causing the circular refference its the appointment object. public JsonResult GetTimeSlot(int id) { TimeSlotDao tsDao = new TimeSlotDao(); var ts = from t in tsDao.GetQueryable() where t.Id == id select new {t.Id, t.StartTime, t.Available, t.Appointment}; return Json(ts); } Any ideas or solutions to this problem? Update I would prefer to use the out of the box serialiser if possible although Json.Net via nuget is ok as an alternative i would hope its possible to use it as I intended as well...

    Read the article

  • Java: ResultSet exception - before start of result set

    - by Rosarch
    I'm having trouble getting data from a ResultSet object. Here is my code: String sql = "SELECT type FROM node WHERE nid = ?"; PreparedStatement prep = conn.prepareStatement(sql); int meetNID = Integer.parseInt(node.get(BoutField.field_meet_nid)); prep.setInt(1, meetNID); ResultSet result = prep.executeQuery(); result.beforeFirst(); String foundType = result.getString(1); if (! foundType.equals("meet")) { throw new IllegalArgumentException(String.format("Node %d must be of type 'meet', but was %s", meetNID, foundType)); } The error trace: Exception in thread "main" java.sql.SQLException: Before start of result set at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1072) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:986) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:981) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926) at com.mysql.jdbc.ResultSetImpl.checkRowPos(ResultSetImpl.java:841) at com.mysql.jdbc.ResultSetImpl.getStringInternal(ResultSetImpl.java:5656) at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5576) at nth.cumf3.nodeImport.Validator.validate(Validator.java:43) at nth.cumf3.nodeImport.Main.main(Main.java:38) What am I doing wrong here?

    Read the article

  • Exception when retrieving record using Nhibernate

    - by Muhammad Akhtar
    I am new to NHibernate and have just started right now. I have very simple table contain Id(Int primary key and auto incremented), Name(varchar(100)), Description(varchar(100)) Here is my XML <class name="DevelopmentStep" table="DevelopmentSteps" lazy="true"> <id name="Id" type="Int32" column="Id"> </id> <property name="Name" column="Name" type="String" length="100" not-null="false"/> <property name="Description" column="Description" type="String" length="100" not-null="false"/> here is how I want to get all the record public List<DevelopmentStep> getDevelopmentSteps() { List<DevelopmentStep> developmentStep; developmentStep = Repository.FindAll<DevelopmentStep>(new OrderBy("Name", Order.Asc)); return developmentStep; } But I am getting exception The element 'id' in namespace 'urn:nhibernate-mapping-2.2' has incomplete content. List of possible elements expected: 'urn:nhibernate-mapping-2.2:meta urn:nhibernate-mapping- 2.2:column urn:nhibernate-mapping-2.2:generator'. Please Advise me --- Thanks

    Read the article

  • C# XNA: What can cause SpriteBatch.End() to throw a NRE?

    - by Rosarch
    I don't understand what I'm doing wrong here: public void Draw(GameTime gameTime) // in ScreenManager { SpriteBatch.Begin(SpriteBlendMode.AlphaBlend); for (int i = 0; i < Screens.Count; i++) { if (Screens[i].State == Screen.ScreenState.HIDDEN) continue; Screens[i].Draw(gameTime); } SpriteBatch.End(); // null ref exception } SpriteBatch itself is not null. Some more context: public class MasterEngine : Microsoft.Xna.Framework.Game { public MasterEngine() { graphicsDeviceManager = new GraphicsDeviceManager(this); Components.Add(new GamerServicesComponent(this)); // ... spriteBatch = new SpriteBatch(graphicsDeviceManager.GraphicsDevice); screenManager = new ScreenManager(assets, gameEngine, graphicsDeviceManager.GraphicsDevice, spriteBatch); } //... protected override void Draw(GameTime gameTime) { screenManager.Draw(gameTime); // calls the problematic method base.Draw(gameTime); } } Am I failing to initialize something properly? UPDATE: As an experiment, I tried this to the constructor of MasterEngine: spriteBatch = new SpriteBatch(graphicsDeviceManager.GraphicsDevice); spriteBatch.Begin(); spriteBatch.DrawString(assets.GetAsset<SpriteFont>("calibri"), "ftw", new Vector2(), Color.White); spriteBatch.End(); This does not cause a NRE. hmm.... UPDATE 2: This does cause an NRE: protected override void Draw(GameTime gameTime) { spriteBatch.Begin(); spriteBatch.End(); // boned here //screenManager.Draw(gameTime); base.Draw(gameTime); }

    Read the article

  • Are C++ exceptions sufficient to implement thread-local storage?

    - by Potatoswatter
    I was commenting on an answer that thread-local storage is nice and recalled another informative discussion about exceptions where I supposed The only special thing about the execution environment within the throw block is that the exception object is referenced by rethrow. Putting two and two together, wouldn't executing an entire thread inside a function-catch-block of its main function imbue it with thread-local storage? It seems to work fine: #include <iostream> #include <pthread.h> using namespace std; struct thlocal { string name; thlocal( string const &n ) : name(n) {} }; thlocal &get_thread() { try { throw; } catch( thlocal &local ) { return local; } } void print_thread() { cerr << get_thread().name << endl; } void *kid( void *local_v ) try { thlocal &local = * static_cast< thlocal * >( local_v ); throw local; } catch( thlocal & ) { print_thread(); return NULL; } int main() try { thlocal local( "main" ); throw local; } catch( thlocal & ) { print_thread(); pthread_t th; thlocal kid_local( "kid" ); pthread_create( &th, NULL, &kid, &kid_local ); pthread_join( th, NULL ); print_thread(); return 0; } Is this novel or well-characterized? Was my initial premise correct? What kind of overhead does get_thread incur in, say, GCC and VC++? It would require throwing only exceptions derived from struct thlocal, but altogether this doesn't feel like an unproductive insomnia-ridden Sunday morning…

    Read the article

  • Hibernate Exception Fixed By Alt+Tab

    - by Lee Theobald
    Hi all, I've got a very curious problem in Hibernate that I would like some opinions on. In my code if I do the following: Go to page A Click a link on page A to be taken to page B Click on data item on page B Exception thrown I get an error telling me: failed to lazily initialize a collection of role: XYZ, no session or session was closed Fair enough. But when I do the same thing but add an alt+tab in the middle, everything is fine. E.g. Go to page A Click a link on page A to be taken to page B Hit ALt+Tab to switch to another application Hit ALt+Tab to switch back to the web browser Click on data item on page B Everything is fine. I'm a little confused as to how switching focus from my application makes it act as I want it to. Does anyone have any light to shine on the subject? I don't think it's a locking issue as even if I do the second set of steps quicker than the first, still no error. It's a Seam application using Hibernate 3.3.2.GA & 3.4.0.GA.

    Read the article

  • When is a try catch not a try catch?

    - by Dearmash
    I have a fun issue where during application shutdown, try / catch blocks are being seemingly ignored in the stack. I don't have a working test project (yet due to deadline, otherwise I'd totally try to repro this), but consider the following code snippet. public static string RunAndPossiblyThrow(int index, bool doThrow) { try { return Run(index); } catch(ApplicationException e) { if(doThrow) throw; } return ""; } public static string Run(int index) { if(_store.Contains(index)) return _store[index]; throw new ApplicationException("index not found"); } public static string RunAndIgnoreThrow(int index) { try { return Run(index); } catch(ApplicationException e) { } return ""; } During runtime this pattern works famously. We get legacy support for code that relies on exceptions for program control (bad) and we get to move forward and slowly remove exceptions used for program control. However, when shutting down our UI, we see an exception thrown from "Run" even though "doThrow" is false for ALL current uses of "RunAndPossiblyThrow". I've even gone so far as to verify this by modifying code to look like "RunAndIgnoreThrow" and I'll still get a crash post UI shutdown. Mr. Eric Lippert, I read your blog daily, I'd sure love to hear it's some known bug and I'm not going crazy. EDIT This is multi-threaded, and I've verified all objects are not modified while being accessed

    Read the article

  • i have this code but when i run it i get an exception:

    - by nisnis84
    i have this code but when i run it i get an exception: java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:8081 connect,resolve) this is the code, the server running good but the client dont work <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" width="615" height="360" codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_4-windows-i586.cab#Version=1,4,0,mn"> <PARAM name="code" value="client/LlamaChat.class"> <PARAM name="archive" value="LlamaChat.jar"> <PARAM name="type" value="application/x-java-applet;version=1.4"> <PARAM name="scriptable" value="true"> <PARAM name="username" value="[replace with username]"> <PARAM name="port" value="[replace with port]"> <COMMENT> <EMBED type="application/x-java-applet;version=1.4" width="615" height="360" code="client/LlamaChat.class" archive="LlamaChat.jar" pluginspage="http://java.sun.com/j2se/1.4.1/download.html" username="nis" port="8081" <NOEMBED> No Java 1.4 plugin </NOEMBED></EMBED> </COMMENT> </OBJECT>

    Read the article

  • Haskell: Dealing With Types And Exceptions

    - by Douglas Brunner
    I'd like to know the "Haskell way" to catch and handle exceptions. As shown below, I understand the basic syntax, but I'm not sure how to deal with the type system in this situation. The below code attempts to return the value of the requested environment variable. Obviously if that variable isn't there I want to catch the exception and return Nothing. getEnvVar x = do { var <- getEnv x; Just var; } `catch` \ex -> do { Nothing } Here is the error: Couldn't match expected type `IO a' against inferred type `Maybe String' In the expression: Just var In the first argument of `catch', namely `do { var <- getEnv x; Just var }' In the expression: do { var <- getEnv x; Just var } `catch` \ ex -> do { Nothing } I could return string values: getRequestURI x = do { requestURI <- getEnv x; return requestURI; } `catch` \ex -> do { return "" } however, this doesn't feel like the Haskell way. What is the Haskell way?

    Read the article

  • Null Pointer Exception in my BroadcastReceiver class

    - by user1760007
    I want to search a db and toast a specific column on the startup of the phone. The app keeps crashing and getting an exception even though I feel as the code is correct. @Override public void onReceive(Context ctx, Intent intent) { Log.d("omg", "1"); DBAdapter do = new DBAdapter(ctx); Log.d("omg", "2"); Cursor cursor = do.fetchAllItems(); Log.d("omg", "3"); if (cursor.moveToFirst()) { Log.d("omg", "4"); do { Log.d("omg", "5"); String title = cursor.getString(cursor.getColumnIndex("item")); Log.d("omg", "6"); // i = cursor.getInt(cursor.getColumnIndex("id")); Toast.makeText(ctx, title, Toast.LENGTH_LONG).show(); } while (cursor.moveToNext()); } cursor.close(); } The frustrating part is that I don't see any of my "omg" logs show up in logcat. I only see when my application crashes. I get three lines of errors in logcat. 10-19 12:31:11.656: E/AndroidRuntime(1471): java.lang.RuntimeException: Unable to start receiver com.test.toaster.MyReciever: java.lang.NullPointerException 10-19 12:31:11.656: E/AndroidRuntime(1471): at com.test.toaster.DBAdapter.fetchAllItems(DBAdapter.java:96) 10-19 12:31:11.656: E/AndroidRuntime(1471): at com.test.toaster.MyReciever.onReceive(MyReciever.java:26) For anyone interested, here is my DBAdapter fetchAllItems code: public Cursor fetchAllItems() { return mDb.query(DATABASE_TABLE, new String[] { KEY_ITEM, KEY_PRIORITY, KEY_ROWID }, null, null, null, null, null); }

    Read the article

  • @ManyToMany Duplicate Entry Exception

    - by zp26
    I have mapped a bidirectional many-to-many exception between the entities Course and Trainee in the following manner: Course { ... private Collection<Trainee> students; ... @ManyToMany(targetEntity = lesson.domain.Trainee.class, cascade = {CascadeType.All}, fetch = {FetchType.EAGER}) @Jointable(name="COURSE_TRAINEE", joincolumns = @JoinColumn(name="COURSE_ID"), inverseJoinColumns = @JoinColumn(name = "TRAINEE_ID")) @CollectionOfElements public Collection<Trainee> getStudents() { return students; } ... } Trainee { ... private Collection<Course> authCourses; ... @ManyToMany(cascade = {CascadeType.All}, fetch = {FetchType.EAGER}, mappedBy = "students", targetEntity = lesson.domain.Course.class) @CollectionOfElements public Collection<Course> getAuthCourses() { return authCourses; } ... } Instead of creating a table where the Primary Key is made of the two foreign keys (imported from the table of the related two entities), the system generates the table "COURSE_TRAINEE" with the following schema: I am working on MySQL 5.1 and my App. Server is JBoss 5.1. Does anyone guess why?

    Read the article

  • Blackberry: Getting uncaught exception java.lang.securityexception

    - by Maxim Xion
    here is my code to open an image file from SDcard in Blackberry import javax.microedition.midlet.*; import javax.microedition.lcdui.*; import java.io.*; public class DisplayAnImage extends MIDlet { private Display mDisplay; private Form mForm; private Image pngBackground; public void startApp() { try{ pngBackground = Image.createImage("file:///Media Card/test_image.png"); ImageItem img = new ImageItem("bg",pngBackground, ImageItem.LAYOUT_EXPAND,"background",ImageItem.PLAIN); mForm = new Form("MIDlet Developer Guide: Display an image."); mForm.append(img); mDisplay = Display.getDisplay(this); mDisplay.setCurrent(mForm); } catch(IOException e) { mForm.append(e.getMessage()); } } public void pauseApp() { } public void destroyApp(boolean flag) { } } While I am running this app with giving all permission to app it shows me "uncaught exception java.lang.securityexception". Please somebody help me on this. Thanks in advance.. :-)

    Read the article

  • ASP.NET Image Upload Parameter Not Valid. Exception

    - by pennylane
    Hi Guys, Im just trying to save a file to disk using a posted stream from jquery uploadify I'm also getting Parameter not valid. On adding to the error message so i can tell where it blew up in production im seeing it blow up on: var postedBitmap = new Bitmap(postedFileStream) any help would be most appreciated public string SaveImageFile(Stream postedFileStream, string fileDirectory, string fileName, int imageWidth, int imageHeight) { string result = ""; string fullFilePath = Path.Combine(fileDirectory, fileName); string exhelp = ""; if (!File.Exists(fullFilePath)) { try { using (var postedBitmap = new Bitmap(postedFileStream)) { exhelp += "got past bmp creation" + fullFilePath; using (var imageToSave = ImageHandler.ResizeImage(postedBitmap, imageWidth, imageHeight)) { exhelp += "got past resize"; if (!Directory.Exists(fileDirectory)) { Directory.CreateDirectory(fileDirectory); } result = "Success"; postedBitmap.Dispose(); imageToSave.Save(fullFilePath, GetImageFormatForFile(fileName)); } exhelp += "got past save"; } } catch (Exception ex) { result = "Save Image File Failed " + ex.Message + ex.StackTrace; Global.SendExceptionEmail("Save Image File Failed " + exhelp, ex); } } return result; }

    Read the article

  • Could not load SWT library on Windows 32-bit

    - by Firzen
    I am almost done with one Java project that I have been developing on Linux. Now I need to build and test it on Windows. So I have installed Eclipse on Windows XP 32-bit, and imported my project. All dependencies of project are in jar files in lib folder, and on Linux everything works well, but on Windows XP I get following error: Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: no swt-pi-gtk-4234 in java.library.path no swt-pi-gtk in java.library.path Can't load library: C:\Documents and Settings\firzen\.swt\lib\win32\x86\swt-pi-gtk-4234.dll Can't load library: C:\Documents and Settings\firzen\.swt\lib\win32\x86\swt-pi-gtk.dll at org.eclipse.swt.internal.Library.loadLibrary(Library.java:331) at org.eclipse.swt.internal.Library.loadLibrary(Library.java:240) at org.eclipse.swt.internal.gtk.OS.<clinit>(OS.java:22) at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:63) at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:54) at org.eclipse.swt.widgets.Display.<clinit>(Display.java:133) at gui.Frontend.<init>(Frontend.java:51) at Fighter.main(Fighter.java:18) I have searched for these DLLs, but I have failed to find them. Where can I download these DLL files? Thanks in advance.

    Read the article

  • workaround for ORA-03113: end-of-file on communication channel

    - by Jefferstone
    The call to TEST_FUNCTION below fails with "ORA-03113: end-of-file on communication channel". A workaround is presented in TEST_FUNCTION2. I boiled down the code as my actual function is far more complex. Tested on Oracle 11G. Anyone have any idea why the first function fails? CREATE OR REPLACE TYPE "EMPLOYEE" AS OBJECT ( employee_id NUMBER(38), hire_date DATE ); CREATE OR REPLACE TYPE "EMPLOYEE_TABLE" AS TABLE OF EMPLOYEE; CREATE OR REPLACE FUNCTION TEST_FUNCTION RETURN EMPLOYEE_TABLE IS table1 EMPLOYEE_TABLE; table2 EMPLOYEE_TABLE; return_table EMPLOYEE_TABLE; BEGIN SELECT CAST(MULTISET ( SELECT user_id, created FROM all_users WHERE LOWER(username) < 'm' ) AS EMPLOYEE_TABLE) INTO table1 FROM dual; SELECT CAST(MULTISET ( SELECT user_id, created FROM all_users WHERE LOWER(username) >= 'm' ) AS EMPLOYEE_TABLE) INTO table2 FROM dual; SELECT CAST(MULTISET ( SELECT employee_id, hire_date FROM TABLE(table1) UNION SELECT employee_id, hire_date FROM TABLE(table2) ) AS EMPLOYEE_TABLE) INTO return_table FROM dual; RETURN return_table; END TEST_FUNCTION; CREATE OR REPLACE FUNCTION TEST_FUNCTION2 RETURN EMPLOYEE_TABLE IS table1 EMPLOYEE_TABLE; table2 EMPLOYEE_TABLE; return_table EMPLOYEE_TABLE; BEGIN SELECT CAST(MULTISET ( SELECT user_id, created FROM all_users WHERE LOWER(username) < 'm' ) AS EMPLOYEE_TABLE) INTO table1 FROM dual; SELECT CAST(MULTISET ( SELECT user_id, created FROM all_users WHERE LOWER(username) >= 'm' ) AS EMPLOYEE_TABLE) INTO table2 FROM dual; WITH combined AS ( SELECT employee_id, hire_date FROM TABLE(table1) UNION SELECT employee_id, hire_date FROM TABLE(table2) ) SELECT CAST(MULTISET ( SELECT * FROM combined ) AS EMPLOYEE_TABLE) INTO return_table FROM dual; RETURN return_table; END TEST_FUNCTION2; SELECT * FROM TABLE (TEST_FUNCTION()); -- Throws exception ORA-03113. SELECT * FROM TABLE (TEST_FUNCTION2()); -- Works

    Read the article

  • Exception when click DataGridview tab c#, .Net 4.0

    - by Nguyen Nam
    My winform app have two tab and multi thread, one is main tab and other is log tab. I only use log tab to show logs in a datagridview control. Exception is random occurred when click to log tab (Not click to row or colunm), i have try but can not find anyway to fix it. This is the error log: Message : Object reference not set to an instance of an object. Source : System.Windows.Forms TargetSite : System.Windows.Forms.DataGridViewElementStates GetRowState(Int32) StackTrace : at System.Windows.Forms.DataGridViewRowCollection.GetRowState(Int32 rowIndex) at System.Windows.Forms.DataGridView.ComputeHeightOfFittingTrailingScrollingRows(Int32 totalVisibleFrozenHeight) at System.Windows.Forms.DataGridView.GetOutOfBoundCorrectedHitTestInfo(HitTestInfo& hti, Int32& mouseX, Int32& mouseY, Int32& xOffset, Int32& yOffset) at System.Windows.Forms.DataGridView.OnMouseMove(MouseEventArgs e) at System.Windows.Forms.Control.WmMouseMove(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.DataGridView.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) Message : Object reference not set to an instance of an object. Source : System.Windows.Forms TargetSite : Void ClearInternal(Boolean) StackTrace : at System.Windows.Forms.DataGridViewRowCollection.ClearInternal(Boolean recreateNewRow) at System.Windows.Forms.DataGridView.OnClearingColumns() at System.Windows.Forms.DataGridViewColumnCollection.Clear() at System.Windows.Forms.DataGridView.Dispose(Boolean disposing) at System.ComponentModel.Component.Dispose() at System.Windows.Forms.Control.Dispose(Boolean disposing) at System.ComponentModel.Component.Dispose() at System.Windows.Forms.Control.Dispose(Boolean disposing) at System.Windows.Forms.TabControl.Dispose(Boolean disposing) at System.ComponentModel.Component.Dispose() at System.Windows.Forms.Control.Dispose(Boolean disposing) at System.Windows.Forms.Form.Dispose(Boolean disposing) Update status code: private void updateMessage(int index, string message) { try { this.dgForums.Rows[index].Cells["ColStatus"].Value = message; System.Windows.Forms.Application.DoEvents(); } catch { } }

    Read the article

  • VB.net avoiding cross thread exception with extension method

    - by user574632
    Hello I am trying to implement a solution for updating form controls without using a delegate. I am attempting to use the 1st solution on this page: http://www.dreamincode.net/forums/blog/143/entry-2337-handling-the-dreaded-cross-thread-exception/ Imports System.ComponentModel Imports System.Runtime.CompilerServices Public Module MyInvoke <Extension()> _ Public Sub CustomInvoke(Of T As ISynchronizeInvoke)(ByVal control As T, ByVal toPerform As Action(Of T)) If control.InvokeRequired Then control.Invoke(toPerform, New Object() {control}) toPerform(control) End If End Sub End Module The site gives this as example of how to use: Label1.CustomInvoke(l => l.Text = "Hello World!") But i get 'l' is not declared error. As you can see im very new to VB or any OOP. I can get the second solution on that page to work (using delegates) but i have quite a few things to do in this thread and it seems like i would need to write a new delegate sub for each thing, which seems wasteful. What i need to do is select the 1st item from a combobox, update a textbox.text with the selected item, and pass the selected item to a function. Then wait for x seconds and start again, selecting the second item. I can get it to work in a single threaded application, but i need the interface to remain responsive. Any help greatly appreciated. EDIT: OK so changing the syntax worked for the example. However if i change it from Label1.CustomInvoke(Sub(l) l.text = "hello world!") (which worked just fine) to: Dim indexnumber As Integer = 0 ComboBox1.CustomInvoke(Sub(l) l.SelectedIndex = indexnumber) I get a cross threading error as though i didnt even use this method: Cross-thread operation not valid: Control 'ComboBox1' accessed from a thread other than the thread it was created on. So now im back to where i started? Any further help very much appreciated.

    Read the article

< Previous Page | 60 61 62 63 64 65 66 67 68 69 70 71  | Next Page >