• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Remote interface reference is null.

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have created a method for an entity bean with home/remote interfaces. I have also created a test client that calls the method.

client.generateTagList();

The method was created within the "Methods that use Remote interface methods to access data through the bean" which calls the

TagListRemote.generateTagList();

I am getting this error:

Error in generateTagList(): Remote interface reference is null. It must be created by calling one of the Home interface methods first.

I assumed that the generated code was correct.

Can someone straighen me out?
 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Chuck,

Are you calling the 'create' method on the home object? Pls post the code to understand the problem better.
 
chuck keuper
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is the rest of the code from the entity test client main.

ContentsTagListTestClient4 client = new ContentsTagListTestClient4();
try {
int tagListId = 1;

client.generateTagList(); ... etc ...

public void generateTagList()
{
if (contentsTagListRemote == null)
{
System.out.println("Error in generateTagList(): " + ERROR_NULL_REMOTE);
return ;
}

long startTime = 0;
if (logging)
{
log("Calling generateTagList()");
startTime = System.currentTimeMillis();
}
try
{
contentsTagListRemote.generateTagList(); ... etc ...

Here is the code from the TagListBean.
public void genTagList()
{
String QUERY = "SELECT tl.tagDefTypId FROM TagListSchema tl WHERE tl.masterDocId = 1 AND tl.startPos >= 143816 AND tl.endPos <= 143840";
String DRIVER = "oracle.jdbc.driver.OracleDriver";
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
String url = "jdbc racle:thin:@10.103.0.69:1421 EVEL";
String userName = "userName";
String password = "password";

try {
Class.forName(DRIVER);
connection = DriverManager.getConnection("jdbc racle:thin:@10.103.0.69:1421 EVEL", userName, password);
preparedStatement = connection.prepareStatement(QUERY);
preparedStatement.executeQuery();
resultSet = preparedStatement.getResultSet();

while (resultSet.next()) {
System.out.println("resultSet = " + resultSet.getString("tagDefTypId"));
}

//close statement and connection
if (preparedStatement != null) preparedStatement.close();
if (connection != null) connection.close();
} catch (Exception ex) {
ex.printStackTrace();
System.out.println("Exception = " + ex.getMessage());

}
}
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by chuck keuper:
Here is the rest of the code from the entity test client main.
/.../



Have you written this code yourself, or have you had it generated for you?

If the former: please slim the code to a minimal version with the same problem.

If the latter: do you understand the code you had generated for you? If so, please slim the code to a minimal version. If not: try to write the code yourself at least once.

/Dan
 
chuck keuper
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dan,
this is generated code and it is slimmed down. Do you understand the code?
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Chuck,

I think you/generator have not called the create() on the Home stub. I am unable to see <home stub>.create() anywhere in the code. Please check if there is some method in your client code where you might be getting home thro' some service locator.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic