Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Remote interface reference is null.

 
chuck keuper
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • 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?
 
Nitin Shivaram
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • 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
  • 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());

}
}
 
Dan Johnsson
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Dan,
this is generated code and it is slimmed down. Do you understand the code?
 
Amit Jaipaul
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • 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.
 
Do you pee on your compost? Does this tiny ad?
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!