Hot questions for Using Enterprise JavaBeans in weblogic

Question:

We are doing a EJB call as below which is returning us the MaxMessageSizeExceededException.

Java Code to Call the EJB -

Properties env = new Properties(); 
env.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory"); 
env.put(Context.PROVIDER_URL, "t3://xxxxxx.xxxx.xxx.com:4444"); 
InitialContext context; 
try { 
    context = new InitialContext(env); 
    Home hb =  context.lookup("lookupname"); 
    Service service = hb.create(); 
    Request request = new Request(); 
    service.getAPI(request); 
}

Error Details -

<Error> <Socket> <BEA-000403> <IOException occurred on socket: Socket[addr=XXXX.xxx.xxx.com/xxx.x.xxx.xxx,port=xxxx,localport=xxxxx]
weblogic.socket.MaxMessageSizeExceededException: Incoming message of size: '10000080' bytes exceeds the configured maximum of: '10000000' bytes for protocol: 't3'.
weblogic.socket.MaxMessageSizeExceededException: Incoming message of size: '10000080' bytes exceeds the configured maximum of: '10000000' bytes for protocol: 't3'

On the Weblogic where the service is deployed they have updated the configs to 30MB,Do we have to do any changes in our client side to increase the incoming size of the response. Any JVM level changes.?


Answer:

Try setting the value programatically in your java code e.g:

System.setProperty("weblogic.MaxMessageSize", "300000000"); 

You can also set the value in your JAVA_OPTIONS -Dweblogic.MaxMessageSize=300000000

Source: https://blogs.oracle.com/LuzMestre/entry/how_to_fix_weblogic_socket

Question:

I have a system where several (20 or so) web app servers (hosting a website) talk to the same 2 - 4 EJB servers (through a VIP). I'd like to know if it is possible to identify which one of those app servers generated a specific request.

For example: Website example.com works by sending HTTP requests to any of 20 app servers to handle the request. These servers are named (internally) app01 through app20. It is ensured that all requests with the same session ID will be routed to the same app server, thus enabling us to logically track all requests from a single user. Some requests will need some extra data not available directly, for which there is an EJB (2.1) application on another cluster of 3 servers, named ejb01 to ejb03. Connections to the EJB servers are made through a VIP (ejb00), which routes the requests round-robin style to the three EJB serves.

Within the logging (we use Apache Log4J) of the EJB servers, it would be really nice if I could identify which of the 20 app servers a request originated from. The alternative is checking the logs on each server separately - but I don't have a good way to grep through the logs on 20 different boxes.

My question is: is this possible within Standard EJB? I'd be willing to do something non-standard, if there was nothing else, but it's gotta be reliable and work on my system. We use Weblogic 11g, both for the web-app and the EJB servers.

I've seen suggestions to pass the identity of the caller as a parameter, but that would mean an extra parameter for each of 20+ EJB methods, and that's rather unwieldy.

Any solutions, anyone?


Answer:

There is no standard solution. There was a proposal in JSR 149, but it was withdrawn. Adding an extra parameter to the remote methods is probably your best option. If you're using RMI remote, you might be able to write an ORB interceptor to add a custom context on the client side, receive it on the server side, and set a thread local around the method invocation on the server.

WebSphere Application Server has a non-standard solution called work areas, which does work for remote EJB.

I am not familiar with WebLogic, so I don't know if they have a similar solution. Searching for similar terms finds a WorkContextMap that looks similar, but I don't know if it works for remote EJB since all the examples I can find are for webservices.

Question:

I have installed weblogic server in my system.Now,i want to learn to develop EJB applications.But,i have heard that a special kind of directory structure is required to keep .java files and .jar files in the application directory (if not developing using eclipse) .So,i need information regarding the directory structure and then how to deploy the application on weblogic server.


Answer:

You should use an IDE with JAVA EE support for this.Here it is a list: IntellJ IDEA, Eclipse, NetBeans, STS, JDeveloper, Etc.

Question:

I am developing a project which accesses the database, but I get this error:

Failure occurred in the execution of deployment request with ID "1581339957215" for task "weblogic.deploy.configChangeTask.1". Error is: "weblogic.application.ModuleException: 
java.lang.NoSuchFieldError: TRACE"


Answer:

You need to correct your CLASSPATH with required version of log4j. The TRACE level is available in the log4j jar of version 1.2.12 or higher.

Question:

I am upgrading a java application from Weblogic 10 to 12c. One of the functions of the application uses a EJB to connect to a reporting webservice using a wsdl. The application compiles and deploys correctly. When the reporting service class is created, this error occurs:

requestReply exception: EJB Exception: : java.lang.NoClassDefFoundError: weblogic/webservice/core/rpc/ServiceImpl at java.lang.ClassLoader.defineClass1(Native Method)

Someone else had a similar issue because they did not have the weblogic jar, wlfullclient.jar on the classpath. But I checked the server and this jar is there.

Are there other properties that I need to change due to the upgrade from Weblogic 10 to 12 for EJBs that I need to check? The version of EJB that I am using is 3.0.

Thanks.


Answer:

In the 12.1.1 release, the 8.1 WebLogic Web services run time has been removed. If you are using 8.1 WebLogic Web services, you need to upgrade the 8.1 WebLogic Web service applications to Web service stacks available in this release

https://docs.oracle.com/cd/E24329_01/web.1211/e24497/upgrade_ws.htm#WLUPG334