Quantcast
Channel: Java mon amour
Viewing all 1124 articles
Browse latest View live

WebLogic deployment fails with java.lang.ArrayIndexOutOfBoundsException in com.bea.objectweb.asm.ClassReader.readClass

$
0
0

BEA-149205 Failed to initialize the application "BLA" due to error weblogic.application.ModuleException: 26
26
weblogic.application.ModuleException: 26
26
at weblogic.servlet.internal.WebAppModule.createModuleException(WebAppModule.java:1824)
at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:270)
at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:682)
at weblogic.application.internal.flow.ScopedModuleDriver.init(ScopedModuleDriver.java:162)
at weblogic.application.internal.ExtensibleModuleWrapper.init(ExtensibleModuleWrapper.java:98)
at weblogic.application.internal.flow.ModuleListenerInvoker.init(ModuleListenerInvoker.java:84)
at weblogic.application.internal.flow.InitModulesFlow.initModule(InitModulesFlow.java:288)
at weblogic.application.internal.flow.InitModulesFlow.initModules(InitModulesFlow.java:301)
at weblogic.application.internal.flow.InitModulesFlow.prepare(InitModulesFlow.java:329)
at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:706)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:237)
at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:61)
at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:158)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:61)
at weblogic.deploy.internal.targetserver.AppDeployment.prepare(AppDeployment.java:155)
at weblogic.management.deploy.internal.DeploymentAdapter$1.doPrepare(DeploymentAdapter.java:39)
at weblogic.management.deploy.internal.DeploymentAdapter.prepare(DeploymentAdapter.java:191)
at weblogic.management.deploy.internal.AppTransition$1.transitionApp(AppTransition.java:21)
at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:240)
at weblogic.management.deploy.internal.ConfiguredDeployments.prepare(ConfiguredDeployments.java:165)
at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:122)
at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:210)
at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:118)
at weblogic.server.AbstractServerService.postConstruct(AbstractServerService.java:78)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.glassfish.hk2.utilities.reflection.ReflectionHelper.invoke(ReflectionHelper.java:1017)
at org.jvnet.hk2.internal.ClazzCreator.postConstructMe(ClazzCreator.java:388)
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:430)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456)
at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:225)
at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:82)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2488)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:98)
at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:606)
at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:77)
at org.jvnet.hk2.internal.ClazzCreator.resolve(ClazzCreator.java:231)
at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:254)
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:413)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456)
at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:225)
at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:82)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2488)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:98)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:87)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1162)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1147)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:548)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
Caused By: java.lang.ArrayIndexOutOfBoundsException: 26
at com.bea.objectweb.asm.ClassReader.readClass(Unknown Source)
at com.bea.objectweb.asm.ClassReader.accept(Unknown Source)
at com.bea.objectweb.asm.ClassReader.accept(Unknown Source)
at weblogic.application.utils.annotation.ClassInfoImpl.(ClassInfoImpl.java:42)
at weblogic.application.utils.annotation.ClassfinderClassInfos.polulateOneClassInfo(ClassfinderClassInfos.java:240)
at weblogic.application.utils.annotation.ClassfinderClassInfos.populateClassInfos(ClassfinderClassInfos.java:193)
at weblogic.application.utils.annotation.ClassfinderClassInfos.(ClassfinderClassInfos.java:44)
at weblogic.servlet.internal.War.initializeClassInfosIfNecessary(War.java:446)
at weblogic.servlet.internal.War.getAnnotatedClasses(War.java:376)
at weblogic.servlet.utils.WarUtils.isJsfApplication(WarUtils.java:258)
at weblogic.servlet.internal.WebAppModule.detectJsfApplication(WebAppModule.java:277)
at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:262)
at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:682)
at weblogic.application.internal.flow.ScopedModuleDriver.init(ScopedModuleDriver.java:162)
at weblogic.application.internal.ExtensibleModuleWrapper.init(ExtensibleModuleWrapper.java:98)
at weblogic.application.internal.flow.ModuleListenerInvoker.init(ModuleListenerInvoker.java:84)
at weblogic.application.internal.flow.InitModulesFlow.initModule(InitModulesFlow.java:288)
at weblogic.application.internal.flow.InitModulesFlow.initModules(InitModulesFlow.java:301)
at weblogic.application.internal.flow.InitModulesFlow.prepare(InitModulesFlow.java:329)
at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:706)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:237)
at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:61)
at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:158)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:61)
at weblogic.deploy.internal.targetserver.AppDeployment.prepare(AppDeployment.java:155)
at weblogic.management.deploy.internal.DeploymentAdapter$1.doPrepare(DeploymentAdapter.java:39)
at weblogic.management.deploy.internal.DeploymentAdapter.prepare(DeploymentAdapter.java:191)
at weblogic.management.deploy.internal.AppTransition$1.transitionApp(AppTransition.java:21)
at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:240)
at weblogic.management.deploy.internal.ConfiguredDeployments.prepare(ConfiguredDeployments.java:165)
at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:122)
at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:210)
at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:118)
at weblogic.server.AbstractServerService.postConstruct(AbstractServerService.java:78)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.glassfish.hk2.utilities.reflection.ReflectionHelper.invoke(ReflectionHelper.java:1017)
at org.jvnet.hk2.internal.ClazzCreator.postConstructMe(ClazzCreator.java:388)
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:430)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456)
at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:225)
at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:82)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2488)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:98)
at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:606)
at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:77)
at org.jvnet.hk2.internal.ClazzCreator.resolve(ClazzCreator.java:231)
at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:254)
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:413)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456)
at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:225)
at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:82)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2488)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:98)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:87)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1162)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1147)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:548)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)




In Oracle support I find that

Unable To Deploy An Application In WebLogic 12C That Works In WebLogic 10 (Doc ID 1565172.1)

WebLogic Server 12c (12.1.1 and higher) does a complete scan of all *.class files in an application when it is deployed. This is an enhancement over previous versions which prevents invalid Java classes being deployed with an application. However, in a few cases where there is an unused invalid class packaged with the application, deployment which succeeded in WLS 11g or earlier could fail in WebLogic 12c. See Note 1504269.1 for more information about a similar case. In that case, there was an invalid class file in the application being deployed. The problem wasn't caught by the previous JVM, but was caught in WLS 12.1.1. In the customer's case, there were files in the customer application which were not Java class files, but which were named with the .class extension. These files were scanned and validated on deployment of the application, and failed validation since they were not Java classes. This caused the deployment failure.


I restart the WLS server with -verbose:class, to find out that weblogic.application.utils.annotation.ClassfinderClassInfos is loaded from wlserver/modules/features/weblogic.server.merged.jar

I patch this class adding this println:

private void polulateOneClassInfo(Source source)
throws AnnotationProcessingException
{
if (source == null) {
return;
}
System.out.println("polulateOneClassInfo: source=" + source.getURL().toString());



and I find out that the offending class is loaded from a JAR compiled with Java 1.4 (check the manifest.mf)

See also http://stackoverflow.com/questions/19152655/java-lang-arrayindexoutofboundsexception-while-deploying-app-in-wls-12


if you suffer of "slow favorites menu" in IE

$
0
0
if you suffer of "slow favorites menu" when you pass the mouse over, in IE, this fixed my problem:

In Control Panel, Folder Options, View tab, scroll to the bottom and uncheck “Show pop-up description for folders and desktop items”.
IE is a 1800 pound pig like this one http://weeklyworldnews.com/headlines/25815/1800-pound-pig/ , but please don't kill pigs, just use Firefox instead!

HPROF is your friend (if you REALLY have nothing else at hand)

$
0
0
Official Java 7 doc https://docs.oracle.com/javase/7/docs/technotes/samples/hprof.html
http://www.oracle.com/technetwork/java/javase/tooldescr-136044.html#gblvj Excellent also this article http://www.brendangregg.com/blog/2014-06-09/java-cpu-sampling-using-hprof.html

I am using this stupid class to test:

import java.util.HashMap;

public class CUT {
public static void main(String[] args) {
try {
for (int i = 0; i < 10000; i++) {
Thread.sleep(1);
HashMap<String, Object> m = new HashMap<String, Object>();
m.put("1", new Object());
}
}
catch (Exception e) {
e.printStackTrace();
}
}
}


then I run

javac -g CUT.java

java -agentlib:hprof=cpu=samples CUT

less java.hprof.txt



this is what I get:


THREAD START (obj=50000193, id = 200001, name="main", group="main")
THREAD END (id = 200001)
THREAD START (obj=50000193, id = 200004, name="DestroyJavaVM", group="main")
THREAD END (id = 200004)
THREAD END (id = 200002)
TRACE 300050:
java.lang.Thread.sleep(Thread.java:Unknown line)
CUT.main(CUT.java:7)
TRACE 300014:
sun.usagetracker.UsageTrackerClient.getPropertyPrivileged(UsageTrackerClient.java:136)
sun.usagetracker.UsageTrackerClient.getPropertyPrivileged(UsageTrackerClient.java:132)
sun.usagetracker.UsageTrackerClient.(UsageTrackerClient.java:109)
sun.misc.PostVMInitHook.trackJavaUsage(PostVMInitHook.java:28)
TRACE 300026:
java.lang.System.arraycopy(System.java:Unknown line)
java.lang.String.getChars(String.java:826)
java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:422)
java.lang.StringBuffer.append(StringBuffer.java:272)
TRACE 300042:
java.io.FilePermissionCollection.(FilePermission.java:711)
java.io.FilePermission.newPermissionCollection(FilePermission.java:642)
java.security.Permissions.getPermissionCollection(Permissions.java:254)
java.security.Permissions.add(Permissions.java:132)
TRACE 300051:
java.util.HashMap.putVal(HashMap.java:628)
java.util.HashMap.put(HashMap.java:611)
CUT.main(CUT.java:9)
TRACE 300052:
java.util.HashMap.put(HashMap.java:611)
CUT.main(CUT.java:9)
CPU SAMPLES BEGIN (total = 12) Wed Feb 3 06:07:50 2016
rank self accum count trace method
1 58.33% 58.33% 7 300050 java.lang.Thread.sleep
2 8.33% 66.67% 1 300014 sun.usagetracker.UsageTrackerClient.getPropertyPrivileged
3 8.33% 75.00% 1 300026 java.lang.System.arraycopy
4 8.33% 83.33% 1 300042 java.io.FilePermissionCollection.
5 8.33% 91.67% 1 300051 java.util.HashMap.putVal
6 8.33% 100.00% 1 300052 java.util.HashMap.put
CPU SAMPLES END



Using the other option

java -agentlib:hprof=cpu=times CUT

gives me


THREAD START (obj=5000017d, id = 200002, name="HPROF gc_finish watcher", group="system")
THREAD START (obj=5000017d, id = 200001, name="main", group="main")
THREAD END (id = 200001)
THREAD START (obj=5000017d, id = 200003, name="DestroyJavaVM", group="main")
THREAD END (id = 200003)
THREAD END (id = 200002)
TRACE 301665:
CUT.main(CUT.java:Unknown line)
TRACE 301663:
java.util.HashMap.putVal(HashMap.java:Unknown line)
java.util.HashMap.put(HashMap.java:Unknown line)
CUT.main(CUT.java:Unknown line)
TRACE 301664:
java.util.HashMap.put(HashMap.java:Unknown line)
CUT.main(CUT.java:Unknown line)
TRACE 301657:
java.util.HashMap.(HashMap.java:Unknown line)
CUT.main(CUT.java:Unknown line)
TRACE 301659:
java.util.HashMap.hash(HashMap.java:Unknown line)
java.util.HashMap.put(HashMap.java:Unknown line)
CUT.main(CUT.java:Unknown line)
TRACE 301661:
java.util.HashMap.newNode(HashMap.java:Unknown line)
java.util.HashMap.putVal(HashMap.java:Unknown line)
java.util.HashMap.put(HashMap.java:Unknown line)
CUT.main(CUT.java:Unknown line)
TRACE 301660:
java.util.HashMap.resize(HashMap.java:Unknown line)
java.util.HashMap.putVal(HashMap.java:Unknown line)
java.util.HashMap.put(HashMap.java:Unknown line)
CUT.main(CUT.java:Unknown line)
TRACE 301662:
java.util.HashMap.afterNodeInsertion(HashMap.java:Unknown line)
java.util.HashMap.putVal(HashMap.java:Unknown line)
java.util.HashMap.put(HashMap.java:Unknown line)
CUT.main(CUT.java:Unknown line)
TRACE 300952:
java.util.HashMap$Node.(HashMap.java:Unknown line)
java.util.HashMap.newNode(HashMap.java:Unknown line)
java.util.HashMap.putVal(HashMap.java:Unknown line)
java.util.HashMap.put(HashMap.java:Unknown line)
TRACE 301656:
java.util.AbstractMap.(AbstractMap.java:Unknown line)
java.util.HashMap.(HashMap.java:Unknown line)
CUT.main(CUT.java:Unknown line)
TRACE 301658:
java.lang.String.hashCode(String.java:Unknown line)
java.util.HashMap.hash(HashMap.java:Unknown line)
java.util.HashMap.put(HashMap.java:Unknown line)
CUT.main(CUT.java:Unknown line)
TRACE 300163:
java.lang.invoke.MethodHandle.(MethodHandle.java:Unknown line)
TRACE 300094:
java.lang.invoke.MethodHandleImpl.(MethodHandleImpl.java:Unknown line)
java.lang.invoke.MethodHandle.(MethodHandle.java:Unknown line)
TRACE 300252:
java.lang.CharacterDataLatin1.getProperties(CharacterDataLatin1.java:Unknown line)
java.lang.CharacterDataLatin1.toLowerCase(CharacterDataLatin1.java:Unknown line)
java.lang.Character.toLowerCase(Character.java:Unknown line)
java.lang.Character.toLowerCase(Character.java:Unknown line)
TRACE 301251:
sun.misc.PerfCounter.(PerfCounter.java:Unknown line)
sun.misc.PerfCounter.newPerfCounter(PerfCounter.java:Unknown line)
sun.misc.PerfCounter$CoreCounters.(PerfCounter.java:Unknown line)
sun.misc.PerfCounter.getReadClassBytesTime(PerfCounter.java:Unknown line)
CPU TIME (ms) BEGIN (total = 11886) Wed Feb 3 06:21:21 2016
rank self accum count trace method
1 94.75% 94.75% 1 301665 CUT.main
2 1.10% 95.85% 10000 301663 java.util.HashMap.putVal
3 0.83% 96.69% 10000 301664 java.util.HashMap.put
4 0.75% 97.43% 10000 301657 java.util.HashMap.
5 0.58% 98.01% 10000 301659 java.util.HashMap.hash
6 0.41% 98.43% 10000 301661 java.util.HashMap.newNode
7 0.27% 98.70% 10000 301660 java.util.HashMap.resize
8 0.24% 98.93% 10000 301662 java.util.HashMap.afterNodeInsertion
9 0.22% 99.15% 10016 300952 java.util.HashMap$Node.
10 0.21% 99.36% 10000 301656 java.util.AbstractMap.
11 0.15% 99.51% 10000 301658 java.lang.String.hashCode
12 0.04% 99.55% 1 300163 java.lang.invoke.MethodHandle.
13 0.02% 99.57% 1 300094 java.lang.invoke.MethodHandleImpl.
14 0.02% 99.59% 80 300252 java.lang.CharacterDataLatin1.getProperties
15 0.02% 99.60% 6 301251 sun.misc.PerfCounter.
CPU TIME (ms) END


which SEEMS much more accurate.
Heap Profiling uses this:

java -agentlib:hprof=heap=sites CUT
which gives (shortened form)

TRACE 300318:
java.util.HashMap.resize(HashMap.java:703)
java.util.HashMap.putVal(HashMap.java:628)
java.util.HashMap.put(HashMap.java:611)
CUT.main(CUT.java:9)

TRACE 300316:
java.util.AbstractMap.(AbstractMap.java:73)
java.util.HashMap.(HashMap.java:474)
CUT.main(CUT.java:8)

TRACE 300186:
java.util.HashMap$Node.(HashMap.java:284)
java.util.HashMap.newNode(HashMap.java:1734)
java.util.HashMap.putVal(HashMap.java:630)
java.util.HashMap.put(HashMap.java:611)


(etc etc)

SITES BEGIN (ordered by live bytes) Wed Feb 3 06:28:22 2016
percent live alloc'ed stack class
rank self accum bytes objs bytes objs trace name
1 39.18% 39.18% 800000 10000 800000 10000 300318 java.util.HashMap$Node[]
2 23.51% 62.69% 480000 10000 480000 10000 300316 java.util.HashMap
3 15.69% 78.38% 320384 10012 320384 10012 300186 java.util.HashMap$Node
4 7.84% 86.22% 160000 10000 160000 10000 300317 java.lang.Object
5 0.34% 86.56% 7000 53 7000 53 300011 char[]
6 0.07% 86.63% 1504 4 1504 4 300001 java.lang.Thread
7 0.06% 86.70% 1304 11 1304 11 300154 char[]
8 0.06% 86.76% 1296 3 1296 3 300000 java.lang.Thread
9 0.06% 86.82% 1248 11 1248 11 300172 char[]
10 0.06% 86.88% 1248 11 1248 11 300173 char[]
11 0.06% 86.94% 1240 10 1240 10 300176 char[]
12 0.05% 86.99% 1040 1 1040 1 300021 java.lang.invoke.MethodHandle[]




To get help do:
java -agentlib:hprof=help


HPROF: Heap and CPU Profiling Agent (JVMTI Demonstration Code)

hprof usage: java -agentlib:hprof=[help]|[

WebLogic: validating config.xml

$
0
0
config.xml requires several XSDs to be validated:

xsi:schemaLocation="http://xmlns.oracle.com/weblogic/security/xacml http://xmlns.oracle.com/weblogic/security/xacml/1.0/xacml.xsd
http://xmlns.oracle.com/weblogic/domain http://xmlns.oracle.com/weblogic/1.0/domain.xsd
http://xmlns.oracle.com/weblogic/security http://xmlns.oracle.com/weblogic/1.0/security.xsd
http://xmlns.oracle.com/weblogic/security/wls http://xmlns.oracle.com/weblogic/security/wls/1.0/wls.xsd
http://xmlns.oracle.com/weblogic/security/providers/passwordvalidator http://xmlns.oracle.com/weblogic/security/providers/passwordvalidator/1.0/passwordvalidator.xsd"


For the exact location of these files check here:
http://docs.oracle.com/cd/E28280_01/web.1111/e13716/config_files.htm#DOMCF128 for 10.3.6
namely: WL_HOME/server/lib/schema/weblogic-domain-binding.jar and diagnostics-binding.jar and the names are schema-0.xsd and schema-1.xsd (not a great idea IMHO to rename those files...)

Quick script to create a domain for WLS 12.2.1

$
0
0


# https://docs.oracle.com/middleware/1221/wls/WLSTC/reference.htm#WLSTC3772
# Use selectTemplate followed by loadTemplates in place of readTemplate.

HOSTNAME='myhost.mydomain.com'
LISTENPORT=7012
SSLLISTENPORT=7022
JAVAHOME='/usr/java/jdk1.8.0_65'
DOMAINHOME='/opt/oracle/fmw1221/user_projects/domains/mydomain'

selectTemplate('Basic WebLogic Server Domain','12.2.1.0')
loadTemplates()

#readTemplate is deprecated
#readTemplate('/opt/oracle/fmw1221/wlserver/common/templates/wls/wls.jar')

# Admin Server SSL and Non-SSL
print('Creating Server - Admin Server')
cd('Servers/AdminServer')
set('ListenAddress', HOSTNAME)
set('ListenPort', LISTENPORT)

create('AdminServer','SSL')
cd('SSL/AdminServer')
set('Enabled', 'True')
set('ListenPort', SSLLISTENPORT)

# Security
print('Creating Password')
cd('/')
cd('Security/base_domain/User/weblogic')
set('Password', 'Welcome1')
#cmo.setPassword('Welcome1')

# Start Up
print('Setting StartUp Options')
# Setting the JDK home. Change the path to your installed JDK for weblogic
setOption('JavaHome', JAVAHOME)
setOption('OverwriteDomain', 'true')

# Create Domain to File System
print('Writing Domain To File System')
# Change the path to your domain accordingly
writeDomain(DOMAINHOME)
closeTemplate()

# Read the Created Domain
print('Reading the Domain from In Offline Mode')
readDomain(DOMAINHOME)

# updating the changes
print('Finalizing the changes')
updateDomain()
closeDomain()

# Exiting
print('Exiting...')
exit()


BEA-2162501 Class bytes found, but couldnt define class

$
0
0


<Feb 15, 2016 5:51:24 PM CET> <Error> <Class Loaders> <BEA-2162501> <Class bytes found, but couldnt define class, com.sun.faces.spi.InjectionProviderException due to the following error: {1}
java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file com/sun/faces/spi/InjectionProviderException
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at weblogic.utils.classloaders.GenericClassLoader.defineClass(GenericClassLoader.java:412)
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:366)
Truncated. see log file for complete stacktrace
>




This error stems probably by the use of wrong JAR compiled with some JVM different from the one being used. Please check MANIFEST.MF file of the JAR and eventually recompile code.

Funny error message using t3s and 2 way SSL

$
0
0

javax.naming.CommunicationException: t3s://localhost:25001: Destination 0:0:0:0:0:0:0:1, 25001 unreachable; nested exception is:
javax.net.ssl.SSLException: Received fatal alert: bad_certificate; No available router to destination

but there was absolutely no issue with the localhost or the port or anything else... WebLogic was listening on all IPv4 and IPv6 addresses on 25001...
googling around I find:
http://middlewaremagic.com/weblogic/


If the Client keystore/truststore PATH is not valid, so check the path specified in “-Djavax.net.ssl.trustStore” (OR) if the client keystore does not include the WebLogic certificate imported in it then we may see the following kind of error: Destination 0:0:0:0:0:0:0:1, 7443 unreachable.; nested exception is:
javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure; [RJVM:000576]No available router to destination.; nested exception is:
java.rmi.ConnectException: [RJVM:000576]No available router to destination.


check that what you are using as trust store and identity store are valid, and that valid password and alias is provided....

weblogic.security.subject.SubjectManager.getSubjectManager hangs when using wrong JDK

$
0
0
Trying to connect from Eclipse to a WLS, Java client for EJB, using 2 way SSL and t3s, we get a stuck thread on this:


"main" #1 prio=5 os_prio=0 tid=0x000000000263f000 nid=0x12900 in Object.wait() [0x0000000002a6d000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x00000000d8d00d00> (a java.lang.Object)
at java.lang.Object.wait(Object.java:502)
at weblogic.security.subject.SubjectManager.getSubjectManager(SubjectManager.java:277)
- locked <0x00000000d8d00d00> (a java.lang.Object)
at weblogic.security.subject.SubjectManager$GetKernelIdentityAction.run(SubjectManager.java:440)
at weblogic.security.service.SecurityManager.getKernelIdentity(SecurityManager.java:164)
at weblogic.security.service.GetKernelIdentityAction.run(GetKernelIdentityAction.java:25)
at java.security.AccessController.doPrivileged(Native Method)
at weblogic.jndi.WLSJNDIEnvironmentImpl.(WLSJNDIEnvironmentImpl.java:57)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at weblogic.jndi.internal.JNDIEnvironment.getJNDIEnvironment(JNDIEnvironment.java:37)
at weblogic.jndi.Environment.(Environment.java:92)

...


The issue was solved changing JDK

Notepad++ : all the accessories you need for it

Winzip holds the zip file open

$
0
0
I often find that, when I select files and use the Explorer menu "WinZip/Add to somefile.zip", the somefile.zip remains opened by "some" process (Windows doesn't bother to tell you which one). Using ProcessExplorer doesn't help identifying the process.
The only workaround I found so far is restarting the Explorer.exe process.
Windows is a pathetic piece of piecemeal spaghetti disaster and WinZip is not better. I normally use 7Zip.

The JVM was unable to load the native wlfileio library , on Linux

$
0
0
We are getting this message:


<Warning> <Store> <BEA-280109> <The JVM was unable to load the native wlfileio library for the store "bla". File and paging stores will continue to function correctly. Specifically, file stores that are configured with a transactionally safe synchronous write policy will continue to operate safely and transactionally but may open with a different write-policy. Other store types may not be able to open.>


http://docs.oracle.com/cd/E21764_01/apirefs.1111/e13952/pagehelp/Corecoreserverserverconfigservicestitle.html#attributes under Synchronous Write Policy it explains a lot
Your default-file-store or file-store should be using in the LD_LIBRARY_PATH env variable one of the following folders / files (LD_LIBRARY_PATH should point to a FOLDER only, not to a specific FILE):
WL_HOME/wlserver/server/native/linux/x86_64/libwlfileio3.so WL_HOME/wlserver/server/native/linux/i686/libwlfileio3.so WL_HOME/wlserver/server/native/win/32/wlfileio3.dll WL_HOME/wlserver/server/native/win/x64/wlfileio3.dll WL_HOME/wlserver/server/native/solaris/sparc64/libwlfileio3.so
Check the java.library.path which should also be initialized to the same value.
Otherwise, run weblogic with strace to find out what is going wrong
See also http://mcgmiddleware.blogspot.ch/2012/03/weblogic-on-linux-x86-64-libmuxer.html and see http://blog.whitehorses.nl/2012/05/30/native-io-in-weblogic-on-solaris-11-x64/
Check also that you are using the 64 bit JVM and not the 32 bit

test-connections-on-reserve

$
0
0
If you get:

java.sql.SQLException: Protocol violation: [ 0, ] at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:536)
java.sql.SQLRecoverableException: Closed Connection at oracle.jdbc.driver.PhysicalConnection.needLine(PhysicalConnection.java:4220) at oracle.jdbc.driver.T4CXAResource.doStart(T4CXAResource.java:187)

then make sure that /jdbc-data-source/jdbc-connection-pool-params/test-connections-on-reserve is set to true

WebLogic Web Service: A jws BLA should have a package declaration

$
0
0


Caused by: weblogic.wsee.ws.WsException: A jws [class PVWSImpl01] should have a package declaration.
at weblogic.wsee.deploy.DeployInfo.validate(DeployInfo.java:356)
at weblogic.wsee.jaxws.JAXWSDeployedServlet.init(JAXWSDeployedServlet.java:87)
at javax.servlet.GenericServlet.init(GenericServlet.java:244)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:343)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:294)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:326)
at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:196)
at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203)
at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71)
at weblogic.servlet.internal.StubSecurityHelper.initServletInstance(StubSecurityHelper.java:99)
at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:87)
at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:71)
at weblogic.servlet.internal.StubLifecycleHelper.(StubLifecycleHelper.java:57)
at weblogic.servlet.internal.StubLifecycleHelper.(StubLifecycleHelper.java:31)
at weblogic.servlet.internal.ServletStubImpl.initStubLifecycleHelper(ServletStubImpl.java:673)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:612)
at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:2053)
at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:2030)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1919)
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3063)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1830)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:875)
at weblogic.application.internal.ExtensibleModuleWrapper$StartStateChange.next(ExtensibleModuleWrapper.java:360)
at weblogic.application.internal.ExtensibleModuleWrapper$StartStateChange.next(ExtensibleModuleWrapper.java:356)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:138)




as the error message says, it's compulsory to assign a package (package com.bla.ws;) to your interface and implementation for your WebService and SEI.



package com.pierre.ws;

import javax.jws.*;

@WebService(portName = "PVWLSWS01Port", serviceName = "PVWLSWS01Service", targetNamespace = "http://com.pierre.ws/", endpointInterface = "com.pierre.ws.PVWLSWS01")
public class PVWLSWS01Impl implements PVWLSWS01 {

public String hello(String name) {
System.out.println("Hello " + name);
return "Hello " + name;

}
}



package com.pierre.ws;

import javax.jws.WebMethod;
import javax.jws.WebService;

@WebService(name = "PVWLSWS01", targetNamespace = "http://com.pierre.ws/")
public interface PVWLSWS01 {

@WebMethod(operationName = "hello")
public String hello(String name);
}


EJB 3.2 tutorial with Manning, EJB 3 in Action

$
0
0



The book is decent, but half of the prose could be removed and the narrative could be much more terse. It seems that often the authors get carried away by their literary velleity. Unfortunately the code examples are incomplete, as always happens the "import" statement are omitted, so that it really takes some effort to try the examples. However, code is provided on the Manning site.
@Stateless
@Stateful
@Singleton
@Lock
@Asynchronous
@Local
@Remote
@Remove
@Inject
@Resource
@PreDestroy
@Startup
@EJB
@Named
@Produces
@RequestScoped
@LoggedIn
@PersistenceContext
@JMSConnectionFactory
@MessageDriven


java:/[app-name]//[!fully-qualifiedinterface- name] java:comp java:module java:app java:global

@AroundInvoke @Interceptors , default interceptor in ejb-jar-xml
@InterceptorBinding


@TransactionAttribute @ApplicationException
@Schedule @Schedules
@RunAs
@WebService @SOAPBinding @WebMethod @WebResult
@Produces @Consumes
@EntityManager @Entity






ExceptionInInitializerError , NoClassDefFoundError and ClassNotFoundException

$
0
0
https://docs.oracle.com/javase/7/docs/api/java/lang/ExceptionInInitializerError.html
"an exception occurred during evaluation of a static initializer or the initializer for a static variable."

https://docs.oracle.com/javase/7/docs/api/java/lang/NoClassDefFoundError.html
"no definition of the class could be found"

the above 2 are LinkageError (Error). The one below is an Exception:
https://docs.oracle.com/javase/7/docs/api/java/lang/ClassNotFoundException.html

Thrown when an application tries to load in a class through its string name using:

The forName method in class Class.
The findSystemClass method in class ClassLoader .
The loadClass method in class ClassLoader.

but no definition for the class with the specified name could be found.

Difference between NoClassDefFoundError and ClassNotFoundException is well explained here:
http://www.javaroots.com/2013/02/classnotfoundexception-vs.html"This is thrown when at compile time the required classes are present, but at run time the classes are changed or removed or class's static initializes threw exceptions. It means the class which is getting loaded is present in classpath, but one of the classes which are required by this class are either removed or failed to load by compiler. So you should see the classes which are dependent on this class."

Examples: this will throw a

Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: java.lang.ArithmeticException: / by zero
at com.pierre.pvtest.Test.(Test.java:4)




package com.pierre.pvtest;

public class Test {
static int a = 1 / 0;
public static void main(String[] args) {
System.out.println("hello");
}
}



If I compile this:

package com.pierre.pvtest;

public class Test {

public static void main(String[] args) {
Test1 test1 = new Test1();
test1.hello();
System.out.println("hello");
}
}

package com.pierre.pvtest;

public class Test1 {
public void hello() {
System.out.println("Test1 hello");
}

}

then I delete Test1.class, I get this:

java com.pierre.pvtest.Test
Exception in thread "main" java.lang.NoClassDefFoundError: com/pierre/pvtest/Test1
at com.pierre.pvtest.Test.main(Test.java:6)
Caused by: java.lang.ClassNotFoundException: com.pierre.pvtest.Test1
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more



HTTP/1.1 502 Bad Gateway

$
0
0

com.sun.xml.ws.client.ClientTransportException: HTTP transport error: java.io.IOException: Unable to tunnel through proxy.
Proxy returns "HTTP/1.1 502 Bad Gateway" HTTP transport error:
java.io.IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 502 Bad Gateway" at
com.sun.xml.ws.transport.http.client.HttpClientTransport.getOutput(HttpClientTransport.java:141) at
com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:187) at
com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:124) at
com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:118) at
com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:866) at
com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:815) at
com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:778) at
com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:680) at
com.sun.xml.ws.client.Stub.process(Stub.java:272) at
com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:153) at
com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:115) at
com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:95) at
com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:136)



It's not clear what is causing this problem...

Javassist and code instrumentation

$
0
0
Looking for a way to trace an Error in a static initializer block, I have stumbled upon this http://stackoverflow.com/a/2211150/651288 example of how to dynamically redefine an ExceptionInInitializerError :

import java.lang.instrument.*;
import javassist.*;
import java.io.*;
import java.security.*;

public class InitializerLoggingAgent implements ClassFileTransformer {
public static void premain(String agentArgs, Instrumentation inst) {
inst.addTransformer(new InitializerLoggingAgent(), true);
}

private final ClassPool pool = new ClassPool(true);

public byte[] transform(ClassLoader loader, String className, Class classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) {
try {
if (className.equals("java/lang/ExceptionInInitializerError")) {
CtClass klass = pool.makeClass(new ByteArrayInputStream(classfileBuffer));
CtConstructor[] ctors = klass.getConstructors();
for (int i = 0; i < ctors.length; i++) {
ctors[i].insertAfter("this.printStackTrace();");
}
return klass.toBytecode();
} else {
return null;
}
} catch (Throwable t) {
return null;
}
}
}

http://jboss-javassist.github.io/javassist/tutorial/tutorial.html
Download javassist zip from here http://jboss-javassist.github.io/javassist/ and explode it
Download Ant (Ant? yes, Ant!) from here https://ant.apache.org/bindownload.cgi
Build javassist source and put the javassist.jar file in the lib folder of your project, add it to build classpath.
Follow instructions to jar your JavaAgent with a MANIFEST.MF containing

Manifest-Version: 1.0
Premain-Class: InitializerLoggingAgent
Can-Retransform-Classes: true

run java -javaagent:agentjar.jar MainClass
It works! Your Error is intercepted and stacktrace is printed! No more silently failing static initializers!
If you forget to add "Can-Retransform-Classes: true" in the MANIFEST.MF, you get the infamous "java.lang.UnsupportedOperationException: adding retransformable transformers is not supported in this environment"

WebLogic: No known valid port for Default[t3]: 7001, No available router to destination.

$
0
0
if you get a funny error like:

The Message-Driven EJB failed while creating a JMS Connection ... java.io.IOException: No known valid port for: 'Default[t3]:t3(t3):169.33.234.123:7001:null ... No available router to destination.
check Oracle Support document "JMS Servers Fail To Communicate via T3 in WebLogic Server (WLS): "No available router to destination" (Doc ID 948192.1)", it could be that you should declare t3s as default protocol in the config.xml section for the server.

EJB : Stateless vs Singleton

$
0
0
http://stackoverflow.com/questions/14464823/difference-between-stateless-and-singleton and in particular this answer
http://docs.oracle.com/javaee/6/tutorial/doc/gipjg.html#gipmt
The EXCELLENT book "Beginning EJB 3: Java EE 7 Edition" (that I highly recommend to buy) explains it very well:

"Introduced in EJB 3.1, a singleton session bean is a session bean component that is instantiated only once per application. For an application, only one instance of a singleton session bean can ever exist. Once instantiated, a singleton session bean lives for the full duration of the application. The singleton session bean maintains its state between client invocations, but it cannot save that state after a container shutdown or crash. Similar to stateless and stateful session beans, the singleton session bean is comprised of a bean class and, optionally, one or more business interfaces."


https://docs.oracle.com/javaee/6/api/javax/ejb/Singleton.html
http://docs.oracle.com/javaee/6/api/javax/ejb/Stateless.html

Firebug for Chrome

$
0
0
As a Firefox user I have normally used Firebug to debug HTTP requests and trace the execution of a request.
In Chrome most people see to be happy with the Control-Shift-I (= “more tools” / “Developer tools”) , then in the Network tab, enable “preserve logs”
Viewing all 1124 articles
Browse latest View live