azizkhani.net

I know that I know nothing

Hibernate exception _$$_javassist_0 cannot be cast to javassist.util.proxy.Proxy

clock December 23, 2014 22:18 by author Administrator

hibernate 4.3.7 using javasssist new version and oracle weblogic older than that version for solve this problem will add this configuration to weblogic.xml

<wls:container-descriptor>
        <wls:prefer-application-packages>
            <wls:package-name>javassist</wls:package-name>
        </wls:prefer-application-packages>
    </wls:container-descriptor>



Weblogic fast-swap

clock May 17, 2013 22:23 by author Administrator

This is something that could eat up time in any bigger project. If you make changes to your working application and you need to track down bugs, it's inevitable to redeploy your application on any change. What is done in seconds, if you
a) know the WLS administration and/or
b) your application is quite lean

If you have a fullblown JEE application with all the magic inside, it's no problem to wait for a successful redeployment for minutes.
In practice there are some ways to get rid of this overhead very quickly.

1) Weblogic's ChangeAwareClassLoader (WLS <=10.x)
Java classloaders do not have any standard mechanism to undeploy or unload a set of classes, nor can they load new versions of classes. In order to make updates to classes in a running virtual machine, the classloader that loaded the changed classes must be replaced with a new classloader. When a classloader is replaced, all classes that were loaded from that classloader (or any classloaders that are offspring of that classloader) must be reloaded. Any instances of these classes must be re-instantiated. If you deploy an exploded application and run the WLS in development mode, you can take advantage from the ChangeAwareClassloader. If you make changes to a single class, the WLS simply replaces the whole classloader and starts over with your newly created class. This was one of the first approaches to quicker development roundtrips. Anyway it is still not the solution for bigger applications.

2) Weblogic Fast-Swap (WLS >=10.x)
Java EE 5 introduces the ability to redefine a class at runtime without dropping its ClassLoader or abandoning existing instances. This allows containers to reload altered classes without disturbing running applications, vastly speeding up iterative development cycles and improving the overall development and testing experiences. The usefulness of the Java EE dynamic class redefinition is severely curtailed, however, by the restriction that the shape of the class – its declared fields and methods – cannot change. The purpose of FastSwap is to remove this restriction in WLS, allowing the dynamic redefinition of classes with new shapes to facilitate iterative development.

With FastSwap, Java classes are redefined in-place without reloading the ClassLoader, thereby having the decided advantage of fast turnaround times. This means that you do not have to wait for an application to redeploy and then navigate back to wherever you were in the Web page flow. Instead, you can make your changes, auto compile, and then see the effects immediately.
 

    • FastSwap is only supported when WLS is running in development mode. It is automatically disabled in production mode.
    • Only changes to class files in exploded directories are supported. Modifications to class files in archived applications, as well as archived JAR files appearing in the application’s classpath are not supported.


To enable FastSwap in your application, add <fast-swap>true</fast-swap> to the weblogic-application.xml file.

FastSwap can also be enabled for a standalone web-application by adding the <fast-swap> element to the weblogic.xml file.

Once FastSwap is enabled at the descriptor level, an appropriate ClassLoader is instantiated when the application is deployed to WLS. It is recommended that you have your IDE setting set to "compile-on-save" so that java files are compiled on saving. The FastSwap agent tries to find all classes that have been modified since the last iteration by looking at all directories in the classpath.

FastSwap is supported with POJOs (JARs), Web applications (WARs) and enterprise applications (EARs) deployed in an exploded format. FastSwap is not supported with resource adapters (RARs).

 

Supported changes:
    • Addition and Removal of static methods
    • Addition and Removal of instance methods
    • Changes to static and instance method bodies
    • Addition and Removal of static fields
    • Addition and Removal of instance fields
limitations:
    • Java Reflection results do not include newly added fields and methods and include removed fields and methods. As a result, use of the reflection API on the modified classes can result in undesired behavior.
    • Changing the hierarchy of an already existing class is not supported by FastSwap. For example, either a) changing the list of implemented interfaces of a class; or b) changing the superclass of a class, is not supported.
    • Addition or removal of Java annotations is not supported by FastSwap, since this is tied to the reflection changes mentioned above.
    • Addition or removal of methods on EJB Interfaces is not supported by FastSwap since an EJB Compilation step is required to reflect the changes at runtime.
    • Addition or removal of constants from Enums is not supported.
    • Addition or removal of the finalize method is not supported.


When FastSwap is enabled, after you recompile a class, FastSwap attempts to redefine classes in existing classloaders. If redefinition fails because your changes fall outside the scope of supported FastSwap changes, the JVM throws an UnsupportedOperationException in the WLS window and in the server log file. Your application will not reflect the changes, but will continue to run.

ref:http://blog.eisele.net



install weblogic in mac

clock March 24, 2013 21:48 by author Administrator

alis-MacBook-Pro:~ aliakbarazizkhani$  cd /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
alis-MacBook-Pro:Home aliakbarazizkhani$ sudo mkdir -p jre/lib

WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.

To proceed, enter your password, or type Ctrl-C to abort.

Password:
alis-MacBook-Pro:Home aliakbarazizkhani$ cd jre/lib
alis-MacBook-Pro:lib aliakbarazizkhani$ sudo touch rt.jar
alis-MacBook-Pro:lib aliakbarazizkhani$ sudo touch core.jar
alis-MacBook-Pro:lib aliakbarazizkhani$ cd /azizkhani/software

java -Dspace.detection=false -Dos.name=unix -XX:MaxPermSize=512m -Xmx1024m -jar wls1035_generic.jar



run


export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home

alis-MacBook-Pro:bin aliakbarazizkhani$ export MW_HOME=/azizkhani/Oracle/Middlewarea
alis-MacBook-Pro:bin aliakbarazizkhani$ export USER_MEM_ARGS="-Xmx1024m -XX:MaxPermSize=256m"
alis-MacBook-Pro:bin aliakbarazizkhani$ . /azizkhani/Oracle/Middleware/user_projects/domains/base_domain/bin/setDomainEnv.sh
alis-MacBook-Pro:base_domain aliakbarazizkhani$ . /azizkhani/Oracle/Middleware/user_projects/domains/base_domain/bin/startWeblogic.sh



WEBLOGIC BEA-002616: Failed to listen on channel on listenAddress:port

clock February 11, 2013 18:52 by author Administrator

Technology, KeyWords:

WebLogic Server 10.3, Cluster, Exception; Too many open files, Socket, Linux, SLES

Error Message: <BEA-002616> <Failed to listen on channel "Default"…>

 

Problem:

<Critical> <Server> <BEA-002616> <Failed to listen on channel "Default" on IP_NR:Port, failure count: 1, failing for 0 seconds, java.net.SocketException: Too many open files>

 

Description

Weblogic declaration from: http://docs.oracle.com/cd/E23549_01/apirefs.1111/e14397/Server.html

BEA-002616

Critical: Failed to listen on channel "channel" on listenAddress:port, failure count: fails1, failing for secs2 seconds, e3

 

Description

The server listener will retry the listen after a short delay.

 

Cause

The server got an exception while trying to accept client connections. It will try to backoff to aid recovery.

 

Action

The OS limit for the number of open file descriptor (FD limit) needs to be increased. Tune OS parameters that might help the server to accept more client connections (e.g. TCP accept back log).

 

More detail and Background information:

“Tune OS parameters” depends on OS which you use. For Linux, kernel parameters need adjustment- exact details depend on the distribution. There are individual user limits for open files. You can use `ulimit -a` command to find out the Linux for the user that owns.

You can find information regarding the important parameters e.g. number of "open files" or similar entry. Please consider, in AIX, the user limits apply as well as a system OS configuration for the total number of open files allowed on the host.

 

 

Solution

Here is an example how can you check and isolate the position of error.

 

1-    Check linux configuration (e.g. on host XXX):

> ulimit –a

core file size          (blocks, -c) 1

data seg size           (kbytes, -d) unlimited

scheduling priority             (-e) 0

file size               (blocks, -f) unlimited

pending signals                 (-i) 127575

max locked memory       (kbytes, -l) 64

max memory size         (kbytes, -m) 13887980

open files                      (-n) 65600 à OK

pipe size            (512 bytes, -p) 8

POSIX message queues     (bytes, -q) 819200

real-time priority              (-r) 0

stack size              (kbytes, -s) 8192

cpu time               (seconds, -t) unlimited

max user processes              (-u) 127575

virtual memory          (kbytes, -v) 17749200

file locks                      (-x) unlimited

 

The open file descriptor limit is at 65600 as recommended by Oracle.

 

2-    Check currently open files

a.    Find PID of Managed Server

> ps -fea|grep myManagedServer

 

b.    Check open files

Please use lsof (list open files) that lists information about files opened by processes

You see list of open files via (e.g.PID is here 1234)

>lsof -p 1234  

 

In order to findour the number of open files:

> lsof -p 1234 | wc –l

 

In this case, we observed that application has 13 thousand connections on "CLOSE_WAIT" status. This usually happens when the application doesn't close the connections properly:



About the author

 Welcome to this web site . This page has two purposes: Sharing information about my professional life such as articles, presentations, etc.
This website is also a place where I would like to share content I enjoy with the rest of the world. Feel free to take a look around, read my blog


Java,J2EE,Spring Framework,JQuery,

Hibernate,NoSql,Cloud,SOA,Rest WebService and Web Stack tech...

RecentPosts

Month List

Sign In