EJB 3.1 lookup returns null remote object - ejb-3.1

I am using EJB3 deployed on WAS 8.
I am accessing this EJB from my WEB server using Context.lookup.
This look up works fine and the entire application works fine for the first time after WAS is restarted.
However when I run the application for the second time, the look up does happen, but a NULL value is returned.
I dont get any exception or error or any logs on WAS.
Again if I restart the WAS, the application works well.
Can anyone please guide what the issue can be?

Remote references are connection-less proxies. If the application is redeployed/undeployed or there is network failure, the proxies are invalidated.
You can use ServiceLocator pattern for caching the references of the remote objects. You can remove & again re-create them with JNDI lookup when they become invalid.

Related

Regression on SQL Server Connection from Standard Logic App

I have been developing Standard Logic Apps with SQL Server successfully for some time, but suddenly can no longer connect. I'm using Azure AD Integrated as my Authentication Type, which I know is OK as I use the same credentials in SSMS. If I try to create a new credential, it is apparently successful but on save the Logic App says "The API connection reference XXX is missing or not valid". Something has changed, but I don't know what ... help!
per above, this was submitted to M/S and has been resolved as follows: the root cause is if a Logic App Parameter name includes an embedded space the problem with SQL connections is triggered. This is a pernicious problem, as the error message is quite unrelated to the root cause. Further, since embedded spaces are supported in Logic Apps e.g. in Step Names, it is easy to assume the same applies across the board.

NullPointerException with JDBC and App Engine

I have been struggling with a problem in Google App Engine, using Java, for several days.
Many times (about 50% of the time) when I try to request the connection to a Cloud Sql instance, the connection returns a null value, resulting in several NullPointerException messages when trying to invoke Cloud Sql queries (when invoking .prepareCall(stored_proc)).
I have the latest App Engine Java SDK, in a project service, shared with other services built in Python which consume this Java backend.
Could it be possible that after certain time the instance/s could crash (I am just testing at this point, so I am using default scalation)?
This is the code that returns null:
Class.forName("com.mysql.jdbc.GoogleDriver");
url = "jdbc:google:mysql://project:instance/database?user=root";
log.info(url);
return DriverManager.getConnection(url);
This is part of my configuration file:
<application>app</application>
<module>mod</module>
<version>1</version>
<threadsafe>true</threadsafe>
<use-google-connector-j>true</use-google-connector-j>
I tried several suggestions from other posts, but with no success at all.
Any suggestion will be welcome, thanks in advance.
I was facing the same problem while using Google Cloud SQL and App engine.
I solved the problem by managing the connection pool my self. I realised that when you request a new connection for each request and close it on completion of the thread. The other requests would get back a null resulting to NullPointException.
I decided to do the following and it work for me for like 2 years now.
Open a connection and keep it to a static class that has a number of connections;
Every time i want to find a connection to the database, i would first check if the is an available connection for me to use.
Incase a Query killed the connection, thus means i needed to request another extra connection just to for the sack of connection drops.
I will add this as an answer, since it is not exactly what Chrispinus mentioned, although he gave me a good idea for teh solution.
I went deeper in the code and found that some of the methods were not closing the database connection. I had assumed all of them were doing that, but looking at each method, I found I was wrong.
So, although it sounds obvious, check connections are being closed (or managed, as Chrispinus says) properly.

EPiServer: A site with siteId is already registered

My EPiServer application is throwing following error:
A site with siteId is already registered. Call the Reset method firs.
There were no code changes before the exception occurred and there is duplicate of this instance which is running without any problems.
My first try was the most obvious, to change the site id in web.config to something else. This did not help. However changing the configuration restarted application and after refreshing the page it shown another exception:
This slave site failed when validating master license information
After another refresh, third exception appeared:
ClassFactory not initialized
Following refreshes bring back original exception about duplicated site id.
I have no idea what could happen. Searching in google did not bring any results. Every restart of the application (through iisreset or by configuration change) causes the site to throw all those three exceptions, always in the same order: license, class factory, and until next restart duplicated site id.
I will be very grateful for any help that could lead me to the solution.
EDIT: I am using EPiServer 5
EDIT 2: I am now pretty sure that "A site with siteid ..." exception is not relevant here. It is just a consequence of previous fail.
This is what is happening basing on exceptions (it does not seem very logical, but well):
IIS is started
Application reaches static initializer and tries to validate the master license. It fails, exception is thrown and the site is not yet registered (in the database there is no entry made in tblSiteConfig)
The page is refreshed
Application reaches static initializer and successfully validates the license, the site is then registered, the code goes further and fails on plugin initialization method (class factory not initialized)
The page is refreshed
Application reaches static initializer and again successfully validates the license, the site fails because it was already registered
Step 6 is happening until next IIS restart
According to messages, is looks like you are using EPiServer Multisite feature.
First thing to check are /sites/site sections of episerver.config - they should contain different siteId attribute.
Next, in episerver.framework.config file, clear siteHostMapping section, so it should be completely empty:
<siteHostMapping />
Then, start sites one by one.
Possible cause to issue is exception during site startup - so you can still experience similar or the same issue if these errors won't be fixed. Be sure to turn on logging and examine logs.
After you've changed the siteId you need to clear some tables in the database. I don't have a EPi5-database at hand but I recall it's at least tblSite.

Unable to access a simple web application (running on Tomcat Server) from another System

I have written a simple web Application which is running(on Tomcat Server) fine on my local system.But when I tried to access from a different system using http:/my_ip_address:8080/Projec1/My_Application. Its showing this error
Network Error (tcp_error)
A communication error occurred: ""
The Web Server may be down, too busy, or experiencing other problems preventing it from responding to requests. You may wish to try again at a later time.
I know many of you must be well versed with this kinda error.But for me its kinda new.I would be happy if you state possible reason and solutions(Please tell me if there is configuration is required in Server step wise)
Thanks All
I forgot tell you all that i found the answer of above question, actually there was proxy setting problem.This is what i did
Open internet option in IE.
Goto LAN setting in Connection option.
In LAN Setting there is advance setting tab, click it.
You will see a Exception box at the bottom.
Type the IP Address form which you want access.
eg. 10.200;*.xyz.com
This setting is to be done on system from where you want to access your web application.
Starting IP address where application is running 10.200.---.--- that is why in exception box it is mentioned as 10.200;*.(your Interanet Server Name)
Hope this will help.
Thanks

.Net Ria Services Deployment

I am having difficulty deploying RIA services/Silverlight 3 to a staging environment.
Here is my situation:
1) I am using RIA for authentication. This works fine on both my development machine and in the staging environment.
2) I created a custom LinqToEntities RIA service to get data from the database into my application. This service works fine when I do a local build, but does not work on the staging server.
The server side RIA code never gets called when the client makes a call to it.
The RiaContext appears to be initialized ok, i.e. it does not throw an exception.
I use code sililar to Context.Load(qry); to put data into the entities. The LoadOperation's complete event fires, but no data was loaded, the serverside methods were never called.
Any ideas on what may be wrong?
I would check to make sure that you have:
The correct connection string in your web.config.
The application is configured to run under a service account that has permissions to access the database.
Your Context.Load should be passing a completed event handler and in that handler you chould check that the LoadOperation.HasError is false. There will be no exception thrown if something went wrong, you have to explicity check for the error.

Resources