Prime number generator code, problems

hi, im having problems making a program to generate the prime numbers from 1 to 100. any help appreciated. here is the code i did so far.
public class primeNumbers {
public static void main(String args[]) {
     for(x=1;x<101;x++)
          prime=1;
          if (prime/prime==1) prime++;
          else System.out.println(" ");
          System.out.println(" prime is " + prime);
}

{color:red}CROSS POSTED{color}
[http://forum.java.sun.com/thread.jspa?threadID=5299159]
Cross posting is rude.
db

Similar Messages

  • Generated Code Problem?

    So now, when I try to create an instance of my bean
    Context art3ic = new InitialContext(env);
    PersonHome pHome = (PersonHome) art3ic.lookup("Person");
    Person pRemote = pHome.create(); <---- Exception
    I get an exception saying I'm trying to find a primary key inside a create call. This is not the case:
    public String ejbCreate() {
    return null;
    So I'm guessing the generated code has placed a getPrimaryKey call there?
    Any comments or advice?
    Exception in thread "main" java.lang.IllegalStateException: Can not call getPrimaryKey() inside ejbCreate(...) methods, the entity does not have an identity yet, see the EJB 2.0 specification chapter 10.5.4
         at com.evermind.server.rmi.RMIConnection.EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER(RMIConnection.java:1558)
         at com.evermind.server.rmi.RMIConnection.invokeMethod(RMIConnection.java:1511)
         at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:55)
         at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:22)
         at __Proxy1.create(Unknown Source)
         at com.art3.UnitTesting.PersonTest.<init>(PersonTest.java:37)
         at com.art3.UnitTesting.PersonTest.main(PersonTest.java:52)

    Yup, it's a bug. I read the generated code. So is there a bug/problem/issue report on this within Oracle? If so what's the status? When are we slated to see a fix? Quite a few people have run into this (turns out this subject was already under discussion - silly me not to search first).

  • Prime number generator

    Hello everyone,
    I try to create prime number and so I create a RSAPrivateCrtKey with the aim to get the p prime via the getP() method. So I wrote
    static RSAPrivateCrtKey prime =  = (RSAPrivateCrtKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_CRT_PRIVATE, KeyBuilder.LENGTH_RSA_512, false);
    // I don't know how to initialize the RSAPrivateCrtKey
    prime.getP(tab, (short)0);Somebody know how to initialize the key? and so, I can retrieve the prime.
    Thanks,
    Charles

    you may want to use genKeyPair method of KeyPair class...

  • Who can help me write this Java code show the prime number ???? PLEASEEEEEE

    Write java code print prime number like this
    Sample Screen Print:
    Initial matrix with N = 37
    2 3 4 5 6 7 8 9 10
    11 12 13 14 15 16 17 18 19 20
    21 22 23 24 25 26 27 28 29 30
    31 32 33 34 35 36 37
    Intermediate results (after 1st iteration)
    2 3 5 7 9
    11 13 15 17 19
    21 23 25 27 29
    31 33 35 37
    Intermediate results (after 2nd iteration)
    2 3 5 7
    11 13 17 19
    23 25 29
    31 35 37
    Intermediate results (after 7th iteration)
    2 3 5 7
    11 13 17 19
    23 29
    31 37
    Final results
    2 3 5 7 11 13 17 19 23 29
    31 37
    How to write this code ?
    Please Help me!
    Thank you so muchhh ?????

    h2. {color:#ff0000}Multiplepost{color}
    Replies here: http://forum.java.sun.com/thread.jspa?threadID=5241012&tstart=0
    There is a useful answer the original thread. Answer it, or ignore it as you like, but don't create multiple threads.

  • Prime number problem.

    I'm trying to create a simple program that tells me if the number entered is a prime number or not. I'm kind of stuck... I think it the problem is more with the math than the actual program itself. This is what I got:
    import java.util.*;
        public class Ch5Prg7
          static Scanner console = new Scanner(System.in);
           public static void main (String[]args)
              int num;
              System.out.println("Enter a positive integer.");
              num = console.nextInt();
              if (num == 1){System.out.println("That number is not prime.");}
              if (num == 2){System.out.println("That number is prime.");}
              if (num > 2){
              // not sure what to do here
       }Yeah, I know. It's not much. I just don't really know where to begin. Any help with the math or anything in general would be greatly appreciated. :)

    i believe the most efficient algorithm is to check every number less than or equal to the number in question, starting at 2. that is, for the number 9, try numbers up to 3 starting at 2. this could be implemented as following:
    boolean isPrime = false;
    if( num > 1 ) {                   //if this block is skipped, isPrime == false
       int root = Math.sqrt( num );   //store result to avoid calling every time through loop (every iteration)
       for( int divisor = 2; divisor <= root; divisor++ ) {
          if( num % divisor == 0 ) {
             isPrime = false;                 //number is NOT prime
             break;                          //no need to continue loop
    if( isPrime ) {
       System.out.println("That number is prime.");
    else {
       System.out.println("That number is not prime.");
    }Another algorithm you could use, although it may be slower due to the allocation of the array would be:
    boolean isPrime = false;
    if( num > 1 ) {                       //if this block is skipped, isPrime == false
       int root = (int)Math.sqrt( num );   //store result to avoid calling every time through loop (every iteration)
       bool[] possibleFactors = new int[ root + 1 ];
       //all array elements are initialized to false by the Java VM
       //false indicates untested value, true indicates tested value
       for( int divisor = 2; divisor <= root; divisor++ ) {
          if( possibleFactors[ divisor ] == false ) {
             if( num % divisor == 0 ) {
                isPrime = false;                   //number is NOT prime
                break;                            //no need to continue loop
             else {
                //set all multiples of divisor to true (indicating they were tested) since
                //none of the multiples will divide evenly if one of there factors didn't
                for( int i = divisor; i <= root; i += divisor ) {
                   possibleFactors[ i ] = true;
    if( isPrime ) {
       System.out.println("That number is prime.");
    else {
       System.out.println("That number is not prime.");
    }

  • Problem of Microsoft authentication apps to generate code.

     Hi,
    Morning to all.
    Please Can someone tells me why and how to use the Microsoft Authentication apps to generate codes to my phone and PC. Thank you all.

    I've got an presumption for the URLCallback problem.
    The client trying to connect to the server was compiled with java version 6 and the server runs with java version 5.
    Can this be the error?!?

  • Array size limitations... and prime number programs.

    What are they? I am an ameteur programmer who wrote an extremely efficient prime finding program, if i do say so myself. The program doesnt find high primes, just prime numbers from 1-1,000,000,000 so far. Thats one version, the next version i use is faster, but because it uses an ArrayList, it can only do the primes 1-10,000,000. I am trying to work the programs up to primes with 50 or more digits, but ArrayList runs out of space, Integer is too small, I dont quite know how to switch all my code to be compatable with BigIntegers, and I cannot find a limit to arrays. I guess that I could find big primes if a) Integer was bigger, b)I tried, but what i wanted to do, because the second program is way more effecient, is to use an array to store primes instead of an ArrayList. The only problem? Arrays cannot be appended, so I need to know the limit in size for an array... So far, from my tests, I have found the limit to be somewhere around, 15,380,277. The only problem with this is that every time i compile, i can use a different number. So I would like it if a) somone could tell me the limit to an array's size, b) ideas for programs that can find primes with 50 or more digits, c) Down below is the code, could someone tell me how to convert it to BigIntegers?
      private void primeFinder1root(int beg, int end){
        int tmp = 0;
        int counter = 0;
        int counter2 = 2;
        boolean flag;
        for(int n = 3; n < end; n+=2){
          if(n%5!=0){
            flag = true;
            for(int d = 3; d <= Math.sqrt(n) && flag; d+=2){
              counter++;
              if(n%d == 0)
                flag = false;
            if(flag){
              System.out.println(n);
              counter2++;
              tmp = n;
              if(counter2%100000 == 0)
                System.out.println(n);
        System.out.println();
        System.out.println("The program looped " + counter + " times. There were " + counter2 + " primes found. "
                             + tmp + " was the last prime found.");
      }That is the first progam that does not use an ArrayList, but is still extremely effecient, it only looped 1,744,118,556 times to find the primes 1-100,000,000 which seems like a lot, but it truely isn't. I realize that by using counters and printing, I am slowing the program down immensly, but i am fine with that.
      public void primeFinder(){
        boolean flag;
        int tmp = 0;
        int tmp2 = 0;
        int counter = 0;
        primes.add(2);
        for(int n = 3; n < end; n+=2){
          if(n%5!=0){
            flag = true;
            for(int i = 0; i < primes.size()/2 && ((Integer)primes.get(i)).intValue() <= Math.sqrt(n) && flag; i++){
              tmp = ((Integer)primes.get(i)).intValue();
              if(n%tmp == 0)
                flag = false;
              counter ++;
            if(flag && n!=1){
              System.out.println(n);
              primes.add(n);
              tmp2 = n;
              if(primes.size() % 100000 == 0)
                System.out.println(n);
        primes.add(0, 1);
        System.out.println(counter + " " + primes.size() + " " + tmp2);
      }This is the code that stores all the primes it finds in an ArrayList, and then compares all numbers to the ArrayList of primes. This is extremely more effecient than the first, looping only 278,097, 308 times to find the primes 1-10,000,000 (the other looped 868,772,491 times). I used 10,000,000 as my example because this program cannot go to 100,000,000 because there are 5,761,455 primes and the ArrayList can only hold ~4,000,000 objects. Because of this ~4,000,000 object limitation on the ArrayList I have set my sites on the Array. This is the reason why I want to know the limitations of an Array if you could please tell me. If you could also, I would like help making my code compatable with BigIntegers as well.
    Well, sorry for the very long post, but thank you if you answer it and took the time to read it.
    Dumber_Child

    I too was in the quest to develop the most efficient prime number code few years ago when I was a student.
    Here is a more fine tuned version for your code
       public static long findPrimes(int max, ArrayList out){
          long count=0;
          FastList primes = new FastList((int)Math.sqrt(max));
          primes.add(2);
          for (int i=3; i<=max; i+=2)
             int al_size = primes.size();
             double sqrt = Math.sqrt(i);
             boolean prime_flag =true;
             boolean loop_flag = prime_flag;
             for (int j=0; j<al_size && loop_flag; j++)
                int val = primes.get(j);
                if (i%val == 0)
                   loop_flag = prime_flag = false;
                else if (val > sqrt)
                   loop_flag = false;
                count++;
             if (prime_flag)
                primes.add(i);
          primes.addToArrayList(out);
          return count;
    Following a data structure to store the prime numbers while processing
    Since this holds first number of primes in an array instead of in an ArrayList
    the get will work much faster and for those elements the casting is not required
       static class FastList
          ArrayList list = new ArrayList();
          int cache[];
          int pointer = 0;
          int fastAreaSize;
          public FastList(int fastAreaSize){
             cache = new int[fastAreaSize];
             this.fastAreaSize = fastAreaSize;
          public void add(int i){
             if (pointer < fastAreaSize)
                cache[pointer] = i;
             list.add(new Integer(i));
             pointer++;
          public int size(){
             return pointer;
          public int get(int i){
             if (i<fastAreaSize)
                return cache;
    else
    return((Integer)list.get(i)).intValue();
    public void addToArrayList(ArrayList al){
    for (int i=0; i<pointer; i++)
    if (i<fastAreaSize)
    al.add(new Integer(cache[i]));
    else
    al.add(list.get(i));
    When running in my pc
    above code detected primes within range 0-10000000 in 281809517 iterations within 6.718secs
    while your original code did the same in 278097308 iterations within 13.687 secs.
    By the way i removed the check for '5' thats why my code does more iterations.
    Notice that I have relocated code like Math.sqrt and ((Integer).....).intValue() to reduce the re calculating the same thing. That saved a lot of time.

  • Has anyone created a lottery number generator within Labview & if so can I have a copy please?

    I would like to study the program of a lottery number generator for Labview if anyone has created or knows where I can get this.

    Wow, my vi is close to yours, but I have a different problem: I set mine up to generate a door prize-winning "powerball," but my issue is how can I get the array to show each number in a different cell in the array, rather than in every cell at the same time. I think I need an array constant somewhere, but with a while loop in the for loop, I can't seem to come up with the desired operation.
    Here's a copy of my vi and a pic of the "spaghetti"
    Also, I'm running on my version 9 student edition.
    Thanks for any help.
    Attachments:
    My Powerball.vi ‏53 KB
    Lotto code.JPG ‏117 KB

  • Random number generating too big?

    Hello
    This applet is basically a number guessing game. It uses a random gen for a number the user is supposed to guess.
    I'm wondering if my number generator is causing too large a number for what I need. Because it always says my number I input is too small. I want a number between 1 and 1000.
    thank you!
    import java.applet.*;
    import java.awt.*;
    import javax.swing.*;     // JApplet , JLabel, JTextField, JButton
    import java.awt.event.*;
    public class GuessAgain extends JApplet implements ActionListener{
    int theNum;
    int yourGuess;
    int retNum;
    // declare refs to GUI components
    JLabel YourguessLabel, numIsLabel;
    JTextField YourguessField, numIsField;
    JButton againButton;
    // setup GUI components
    public void init(){  
    // obtain content pane give control to layout manager
    Container container = getContentPane();
    // new object of class FlowLayout
    container.setLayout( new FlowLayout() );
    // "Your guess" label
    YourguessLabel = new JLabel( "Guess a number between 1 and 1000:" );
    container.add( YourguessLabel );
    // field
    YourguessField = new JTextField( 10 );
    YourguessField.setEditable( true );
    container.add( YourguessField );
    YourguessField.addActionListener( this ); // register this applet as YourguessField's actionlistener
    // "Try again" button
    againButton = new JButton( "If wrong try again" );
    againButton.addActionListener( this );
    container.add( againButton );
    // "Number is" label
    numIsLabel = new JLabel( "Number is:" );
    // field
    container.add( numIsLabel );
    numIsField = new JTextField( 10 );
    numIsField.setEditable( true );
    container.add( numIsField );
    numIsField.addActionListener( this );
    retNum = makeNum();     
    }// end init
    public void actionPerformed( ActionEvent event ){
         int yourGuess;
         yourGuess = Integer.parseInt( YourguessField.getText() );
         theNum = makeNum();
         displayMessage();
    }//end actionperformed
    public int makeNum()
         int theNum = 1 + ( int ) ( Math.random() * 1000 ); // number generator
         return theNum;
    }// end makeNum
    public void displayMessage()
         if( yourGuess == theNum )
              showStatus( "You got it!!" );
    else{
              if( yourGuess > theNum )
              showStatus( "You are too high." );
              else
         showStatus( "You are too low." );
    }// end else
    }// end method display message
    }// end class

    A troubleshooting technique is putting System.out.println statements to validate the programmer's opinion on how the code is supposed to work. If you add a System.out.println(yourGuess+" "+theNum); line as the first line in the displayMessage() method, it would validate your hypothesis that theNum is too large.
    A hint to the problem - when you declare a variable inside a method with the same name as an instance variable, the compiler uses the method variable, not the instance variable.

  • Prime Number Loop Help

    I have used some code and written a program that asks the user for a number and it checks to see if it is prime or not. The program works fine, but I need it to loop and ask for another number or to exit. Here is my code and what my teacher has suggested to do, but I dont understand how to do this.
    This program checks to see if a number is prime or not. I got a lot of help on the Java Sun Forums.
    import java.io.*;
    public class Prime
    public static void main(String[] args)
    System.out.print("Enter a number: ");
    String input = readInput();
    int number = Integer.parseInt(input);
    int divisor = 2;
    int numberbytwo = number / 2;
    // Sets the factor to false uses loop to test
    boolean primen =false;
    while( divisor <= numberbytwo )
    if (number % divisor == 0)
    primen = true;
    break;
    divisor = divisor + 1;
    if( primen )
    System.out.println( number + " is NOT a prime number");
    else
    System.out.println( number + " is a prime number");
    Input method
    private static String readInput()
    try
    BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in));
    return keyboard.readLine();
    catch (IOException e) {}
    return "";
    What you have done is absolutely right...If you want to keep the user in the loop after the first check, you can do it and it is quite easy. Move the prompting for a number etc..to another function just the readInput() method...call it maybe askUser() or something.....
    and then in your below logic:
    if( primen )
    System.out.println( number + " is NOT a prime number");
    // ASK THE USER IF HE/SHE wants to continue. If yes call the askUser() method....
    else
    System.out.println( number + " is a prime number");

    It is, Jim. But not as we know it...Enlighten me 'o learned one, how should it be then??? Well, my comment suggested that the language wasn't standard,
    not that it should be.
    That's not a quibble: for what it's worth, I think fully spelt out words are
    probably a good thing in an international forum with many members for
    whom English is not their first language. And that care and
    attention to language is important both for describing problems and
    their solutions, and for coming up with something acceptable to the
    compiler. But more important than either of these, is the need to
    communicate, and to help.
    You were doing both of these. And I wasn't. So I shouldn't have
    stomped on your thread. For that I am sorry.
    (But destin started it! And it's "Enlighten me, oh learned one; how, then,
    should it be?")

  • Error while generating code in brf+ function

    Hi all,
    i am getting error while generating code in function in bRF+
    am using weight fields ..if i dont use quantity fields am able to generate code .
    please help.
    Thanks.

    Can you provide more details? What exactly is the error?
    I think we have provided a note for the issue. With the details it should be possible to identify the note number.

  • Auto generated code in makefile

    For our product we have a TCL script that reads a series of text files and generates C++ classes for easy access to database records. Our code has been in use for make years and works very well. We have always used a solaris command prompt dmake to compile, which first generates the C++ files then complies them. It uses a series of enviroment variables which a user must set before compilation.
    I recently tried to create a Sun Studio Express based on NetBeans 6.5.rc1 project from a make file. This has worked for every other makefile except for this one. The others do not have any auto generated code.
    To run sun studio I in a command prompt source in the environments then run netbeans. Then I choose to build the product but I get an error. I then try to copy the command it is running into telnet window and it works fine. Does anyone have an idea on why in the sun studio I get and error while the telnet window works fine.

    I think the problem is that the SunStudio IDE runs the build command in a wrong directory.
    Can you verify that the working directory is correct?
    (it is in project properties: Build > Make)
    Also you can find this directory in the message in the output, when you try to build the project.
    That's the message, that you copied to the terminal window.
    Thanks,
    Nik

  • How to use generated code from "Import Web Services" with Cairngorm Framework

    I recently downloaded Flex Builder 3 beta 2 and tried out the
    wizard that lets you import web services. The code that is
    auto-generated makes if fairly straight forward to consume web
    services using the object types defined in the WSDL. No longer does
    the developer need to decode the XML payload! The only problem I am
    having is how does you integrate the auto- generated code with the
    Cairngorm framework? This seems like a huge question for anyone who
    might want to leverage Cairngorm and the auto-generated proxy code
    in the same project (like me).
    Here are the problems that I see so far.
    1) How do you configure the generated service class to work
    with the Cairngorm service locator? The service constructor only
    accepts a “LCDS destination string” which implies that
    you must use Lifecycle data services. Unfortunately, the project I
    am trying to retrofit currently uses a WebService and does not use
    data services. All I really need to do is change the endpoint URL
    (ie from local to a development server). This issue is noted in the
    bug https://bugs.adobe.com/jira/browse/FB-8456. What I think is
    needed is a way to set the endpointURI in the Services.mxml file.
    2) Even if I come up with a hack around #1, I do not receive
    a callback to my IResponder even though I register it immediately
    after the method call. I can register and listener function within
    my business delegate and receive the callback, but my Command
    object, which implements IResponder, does not receive the call back
    even though it is registered. From what I read in the ASDocs it
    should but it doesn’t for me!
    These are the issues I have observed in 3 hours of messing
    with this. I hope this makes sense. I would love to integrate
    auto-generated web service proxies into Cairngorm but I don’t
    see a straight forward way without re-architecting Cairngorm. Has
    any one else run across this issue? If so, do you have any insights
    on how to proceed? Any help is appreciated.

    Since I posted this question, I have abandoned the notion of
    auto-generated web services and embraced the good old FDS concept
    where the RemoteObject meta-tag does all the conversion work for
    me. We are now using the Granite DS package and it is working well
    for us. I would love to consume web services, but it just isn't
    worth the hassle when all you have to do with Granite (and FDS) is
    cast your return objects to the proper object type.
    BTW, since this posting, I have investigated competing Flex
    app frameworks. After my research, I checked out the PureMVC
    framework. Wow!! Cairngorm always left me with an uneasy feeling
    and I guess I am not alone. Apparently, Cliff Hall felt the same
    way. That is why he started the project. I like his approach alot
    more than Cairngorm especially since it includes notifications
    which allow me to broadcast my own app level events independent
    from the AS Event framework. Check out PureMVC. For what it is
    worth, it has my humble endorsement. Cliff was even gracious enough
    to acknowledge the other Adobe Consulting guys for their work. Good
    for you Cliff, I respect that. Check out a better way at
    http://www.puremvc.org/

  • NoSuchMethodError in findMethodInfo(__methodSig) in ejbc generated code

    Hi All,
    Happy new year!
    Does anyone know when weblogic.ejbc calls "findMethodInfo(__methodSig)" in its
    generated "*HomeImpl.java" classes?
    This is causing my code to end in a NoSuchMethodError exception.
    The generated code for the included beanManaged.AccountHome does not include this
    call, while the code generated for my code does.
    Can anyone tell me why?
    Anyone from the Weblogic people?
    Thanks,
    Boogie

    boogie wrote:
    Rob Woollen <[email protected]> wrote:
    boogie wrote:
    Thanks for the reply, Rob.
    So the "findMethodInfo()" is caused by the presence of multiple interfacesat
    compile time.It's probably caused because ejbc generates code for version 1 of your
    interface
    but you then deploy a jar that loads version 2 of your interface.
    <boogie>
    i'm using the same interface. however, at compile time, the interface is both
    on the classpath (since i've just compiled it) and in the pre-ejbc jar file (which
    i'm passing to weblogic.ejbc).If it's in the classpath and in the ejb.jar, then ejbc finds the version in the classpath and
    generates code against it.
    from what you've said, i gather this is why ejbc
    puts in a "findMethodInfo()" call in the --HomeImpl.java files that it generates.
    </boogie>
    <boogie>
    SCENARIO 1: I use my build script.
    condition: the home interface is found and compiled, the EJB classes placed in
    a temporary jar file, then passed to EJBC (with -keepgenerated flag)
    output: the generated MyBeanHomeImpl.java calls "findMethodInfo()" and i get NoSuchMethodError
    exception at runtime
    If the version in the classpath and the version in the jar file were exactly the same, then ejbc
    would run fine. It fails when they are different. ejbc is generating code for a method that
    appears in the version that it is loading.
    -- Rob
    >
    SCENARIO 2: I manually build.
    condition: i jar the files manually, pass the jar to weblogic.ejbc (with -keepgenerated)
    without specifying a classpath; the current classpath doesn't include the compiled
    home interface;
    output: the generated MyBeanHomeImpl.java doesn't call "findMethodInfo()", code
    runs as expected
    SO, i need to build with scenario 1 AND still make it run at runtime. i don't
    have multiple copies of the EJB classes/interfaces at deployed or in the classpath
    runtime, but i keep getting the NoSuchMethodError exception because of the "findMethodInfo()"
    call that weblogic.ejbc insists on making. what can I do to solve this problem?
    thanks!
    really appreciate the help!
    </boogie>
    -- Rob
    Rob Woollen <[email protected]> wrote:
    There's some sort of mis-match between the interfaces that ejbc is
    finding
    (and
    generating code for) and the interfaces being deployed.
    I would check your classpath and remove all occurrences of the homeinterface
    class. It should only be in the jar file. Then re-run weblogic.ejbc
    -- Rob
    Boogie wrote:
    Hi All,
    Happy new year!
    Does anyone know when weblogic.ejbc calls "findMethodInfo(__methodSig)"in its
    generated "*HomeImpl.java" classes?
    This is causing my code to end in a NoSuchMethodError exception.
    The generated code for the included beanManaged.AccountHome does
    not
    include this
    call, while the code generated for my code does.
    Can anyone tell me why?
    Anyone from the Weblogic people?
    Thanks,
    Boogie

  • Error In CMP Generated Code

    I have a CMP 2.0 local entity bean, and when I try to create one from a session bean, I get this:
    java.lang.IllegalStateException: Can not call getPrimaryKey() inside ejbCreate(...) methods, the entity does not have an identity yet, see the EJB 2.0 specification chapter 10.5.4
         at com.evermind.server.ejb.EJBUtils.throwGetPrimaryKeyInEJBCreateException(EJBUtils.java:963)
         at WebLine_EntityBeanWrapper2.getPrimaryKey(WebLine_EntityBeanWrapper2.java:2595)
         at WebLineHome_EntityHomeWrapper16.create(WebLineHome_EntityHomeWrapper16.java:497)In other words, the generated code for the home's create method is calling getPrimaryKey on the generated code for the entity, and this is failing because even the container can't call getPrimaryKey at that time. It doesn't seem to matter what's in my ejbCreate method, unless it throws an exception (which prevents this problem, of course). Looks like a problem with the generated code to me.

    Thanks for that tip. Looking at the generated code, I see:
              boolean imIt = false;
              try
                while(!imIt)
                  if(com.evermind.server.ApplicationServer.DEBUG) debug("In while(!imIt)\n");
                  WebLine_EntityBeanWrapper2 other;
                  other = (WebLine_EntityBeanWrapper2)getWrapperInstance(response.getPrimaryKey(), 90000l, false);That last line is where the error happens (line 520 in the stack trace above). It seems like getPrimaryKey is being called intentionally, to see if the entity is already in the cache or something? Anyway, the generated code for the instance call is:
      public Object getPrimaryKey()
        if(this.primaryKey == null) com.evermind.server.ejb.EJBUtils.throwGetPrimaryKeyInEJBCreateException();
        return this.primaryKey;
      }So that seems reasonable, I suppose. The question is, what is causing the instance to have no PK when the home thinks the PK should be there? I've tried a lot of variants of my code, with no improvement, but I could still be doing something wrong. Also, it only seems to be happening with one bean...

Maybe you are looking for

  • How do I create a graph in numbers?

    So here is what I have created: http://i1135.photobucket.com/albums/m638/moore778899/Screenshot2011-01-06at21522 8.png All are drop down lists. You will see that it LOOKS correct in terms of Q1. But when I change one of the responses to male and sele

  • When i am posting the Outbound delivery,here getting Runtime error

    Hello          When i am posting the Outbound delivery,here getting Runtime error This is error analysis report Error analysis     Short text of error message:     No RFC destination is defined for SAP Global Trade Services     Long text of error mes

  • Is there pkg command like 'rpm --upgrade'

    Hi I am using the pkgadd to install the application pkg. I want to know if there is pkg command like 'rpm --upgrade' to upgrade a pkg from verion 1.0 (already installed) to 2.0 (new version) directly? ('pkg-get -U' looks just performing a pkgrm and p

  • Is there a charge to remove a line from my plan?

    I have several lines on my current wireless plan.  Will there be a charge to remove any of those lines and if so, how much is the fee?

  • Lenovo ThinPad S1 Yoga want to make it faster.

    Hello everyone, I just came into the Lenovo community the other day when i bought my LEnovo Thnkpad s1 yoga. i got the i5 version with up to 2.90 mhz. i know this is not a gaming computer but i would like to do some games on it, i was wondering if yo