Saturday, March 25, 2017

Poll results: I believe Obama's allegations about Russian hackers



So the absolute majority of voters believe it's nonsense.

Friday, March 24, 2017

WebLogic : Controlling Multi Data Source Failover with a Callback

Here the schema http://xmlns.oracle.com/weblogic/jdbc-data-source/1.5/jdbc-data-source.xsd

and here the documentation : https://docs.oracle.com/cd/E24329_01/web.1211/e24367/jdbc_multidatasources.htm#JDBCA209

"The name of the application class to handle the callback sent when a multi data source is ready to failover or fail back connection requests to another data source within the multi data source. The name must be the absolute name of an application class that implements the weblogic.jdbc.extensions.ConnectionPoolFailoverCallback interface."



Monday, March 20, 2017

Book review: The rise of the Robots

https://www.amazon.com/Rise-Robots-Technology-Threat-Jobless/dp/0465097537



The book is excellent. Read it. Then you will be really scared about the future, and I mean the next 10-20 years. Because it's going to be a very quick process the one putt us all out of work. Unless you belong to a very selected elite of super-engineers dedicated to AI processes. Or someone like a surgeon or medical doctor who HAS to be present to a process to give some accountability.

I have read the book and felt really frightened. No matter how hard one studies, s/he will never be able to compete with a machine.

Nevertheless life goes on and I keep studying. More for personal pride and curiosity. Anyway in 9 years I will be 65 inshallah and hope to retire...



LoggingLastResource

If you use a LoggingLastResource Datasource, you must specify a table with the tag jdbcllr-table-name in config.xml.

We did that and we got

"javax.transaction.SystemException: Failed to call registerLoggingResourceTransactions() weblogic.transaction.loggingresource.LoggingResourceException: weblogic.transaction.loggingresource.LoggingResourceException: java.sql.SQLException: JDBC LLR, table verify failed for table 'WL_LLR_PIPPO_7436', failed to create table"

I have enabled the flags

-Dweblogic.debug.DebugJDBCSQL=true -Dweblogic.log.StdoutSeverity=Debug -Dweblogic.StdoutDebugEnabled=true

and discovered this

[weblogic.jdbc.wrapper.Statement_oracle_jdbc_driver_OracleStatementWrapper@4] 
executeUpdate(CREATE TABLE WL_LLR_PIPPO_7436 (XIDSTR VARCHAR(40) NOT NULL PRIMARY KEY, POOLNAMESTR VARCHAR(64), RECORDSTR VARCHAR(1000))) 
throws java.sql.SQLSyntaxErrorException: ORA-01031: insufficient privileges

        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:450)
        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:399)
        at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1059)
        at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:522)
        at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:257)
        at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:587)
        at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:210)
        at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:30)
        at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:931)
        at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1150)
        at oracle.jdbc.driver.OracleStatement.executeUpdateInternal(OracleStatement.java:1707)
        at oracle.jdbc.driver.OracleStatement.executeUpdate(OracleStatement.java:1670)
        at oracle.jdbc.driver.OracleStatementWrapper.executeUpdate(OracleStatementWrapper.java:310)
        at weblogic.jdbc.wrapper.Statement.executeUpdate(Statement.java:535)
        at weblogic.jdbc.wrapper.JTSLoggableResourceTable.createTable(JTSLoggableResourceTable.java:234)
        at weblogic.jdbc.wrapper.JTSLoggableResourceTable.findOrCreateTable(JTSLoggableResourceTable.java:287)
        at weblogic.jdbc.wrapper.JTSLoggableResourceImpl.findOrCreateBackingTable(JTSLoggableResourceImpl.java:530)




so you can simply ask the DBA to create the table, or grant you CREATE TABLE privileges.

Sunday, March 19, 2017

Suspending a MDB

It's easy to suspend consumption of JMS messages from a MDB with WLST (this code is from an Oracle Support document):
connect("username", "password", "t3://host:port")
domainRuntime()
cd("/ServerRuntimes/TargetServerName/ApplicationRuntimes/ApplicationDeploymentName/ComponentRuntimes/ApplicationDeploymentName/EJBRuntimes/MDBName_JNDINameoftheQueue")
cmo.suspend()


The Java JMX version is horrendously more complicated.

Here http://middlewaremagic.com/weblogic/?p=5099 they say:

“NOTE:Suspending One individual MDB from an EAR file is not possible so if your EAR application Contains multiple MDBs then you will have to suspend all the MDBs present in that EAR like above.”

but I am not really sure this is true, since there is a JMX method for this:

http://docs.oracle.com/cd/E23943_01/apirefs.1111/e13945/weblogic/management/runtime/MessageDrivenEJBRuntimeMBean.html#suspend()

However if you restart WLS, the MDB will resume consumption.

If you use native WLS JMS, you can disable consumption on the JMS queue itself. This feature doesn't seem to be available for foreign JMS destinations (like MQ). In this case, you can simply comment out the destination in the JMS WLS configuration XML.... the MDB at startup will complain that it can't connect to the destination, but the application will still deploy. It's a horrible hack but it works



Learning React - books and tutorials

Awesome 2 hours beginner's training on React



This is a link to his full 10 hours tutorial https://codewithmosh.com/p/mastering-react


https://www.youtube.com/watch?v=-AbaV3nrw6E&list=PL6gx4Cwl9DGBuKtLgPR_zWYnrwv-JllpA this is a cool simple tutorial showing you the basics of React programming.

You can also go through the examples here https://facebook.github.io/react/docs/installation.html using Codepen.

I had a look at these 2 books: https://leanpub.com/the-road-to-learn-react and http://www.apress.com/us/book/9781484212462 but I found the first is just a bunch of notes put quickly together without much explanation and conceptualization, the second on the opposite too complex and verbose and not straight to the point.

I am increasingly turning to videos to learn new "technologies", especially videos which show real-time coded examples accompanied by explanation - they are definitely more expressive than traditional static written information with code snippets.

Incidentally this site http://todomvc.com/ is quite cool, it showcases a huge collection of frameworks to implement the same application.... it's scary that there are so many products out there.... my impression is that IT is becoming more and more a titanic mess without standards.


https://lostechies.com/derekgreer/2017/05/25/hello-react-a-beginners-setup-tutorial/

I have gone through all the 13 steps to get a simple "hello world" application running.... and it still fails with error messages that nobody can possibly understand.
Then as suggested in the comment I do

npm install -g create-react-app
create-react-app my-app
cd my-app/
npm start

and it works..... but I do
ls -1 node_modules/ | wc -l
1009

1009 modules installed to run a HELLO WORLD application ?????

it's crazy that in 2018 the Planet relies on such unstable piggish and messy products to power the Web....
something is really wrong in IT...





Thursday, March 16, 2017

WebLogic ClusterMessaging

We occasionally see these messages in an instance of a WLS cluster:

####<Mar 8, 2017 10:21:43 AM CET> <Info> <WorkManager> <myhost> <myserver> <[ACTIVE] ExecuteThread: '13' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1488964903589> <BEA-002939> <The maximum thread constraint ClusterMessaging has been reached 2 times for the last 237 seconds.>

What is that constraint ClusterMessaging ? It's set internally by WLS on a WorkManager, it allows max 8 threads to handle the internal cluster messaging and this parameter can't be changed.

If you want to detect what is wrong, take a few thread dumps at interval of 3-5 seconds. Most likely you have some huge object in the JNDI tree being serialized/deserialized. Another possibility is that you have a non serializable object in the JNDI tree. If this is not the case, try analyzing your network traffic (the procedure could be very differend depending if you are using Multicast of Unicast)

In our case, we had this message which could be a hint that serialization is wrong:

<Mar 14, 2017 10:30:19 AM CET> <Error> <Cluster> <BEA-000123> <Conflict start: You tried to bind an object under the name jdbc.workflow.HibernateSessionFactory in the JNDI tree. The object from -2132852355821393490S:169.56.179.213:[-1,-1,32275,32275,-1,-1,-1]:mydomain:myserver01 is non-clusterable, and you have tried to bind more than once from two or more servers. Such objects can only be deployed from one server.>



Wednesday, March 15, 2017

Birbal story

If you don't know Birbal, please google it and try to read some of his stories. Birbal is one of the best memories I have brought back from India.

I am reblogging here this story because it's too precious to go lost. In fact I have found it on another blog.



Once Akbar asked Birbal “Which is the most precious thing in the world? Is it diamonds, rubies or gold?” Birbal thought for a minute and replied with a smile “The most precious thing is not diamonds, rubies or gold but the relief of shitting”. Akbar was outraged! He started storming around his court screaming at Birbal and his insolence. “You fool! Have you finally lost it? You see my kingdom? It’s the richest and the most powerful empire. I own every precious thing conceivable. And you make a joke on my treasures? Get out of my sight or else I will have you beheaded.” But Birbal had far too much pride to quit. After a couple of days, Akbar was supposed to leave on a boat trip to a far away part of his empire. In the morning breakfast, Birbal mixed some Croton seeds, jamalgota, in Akbar’s food. So when Akbar was almost half way through the water journey, he got a very pressing call of nature. And when it did not subside and kept on increasing, he asked the men to turn back and head for shore. They barely made it in time to the shore and Akbar ran into the bushes with a pail of water. When he came back, he was smiling with beads of perspiration on his forehead. And there Birbal was, giving Akbar a knowing smile. Akbar conceded “Yeah, now I know you were right as always Birbal...”


References:

https://en.wikipedia.org/wiki/Croton_tiglium

https://en.wikipedia.org/wiki/Birbal

Tuesday, March 7, 2017

Warning: org.apache.xerces.parsers.SAXParser: Feature 'http://javax.xml.XMLConstants/feature/secure-processing' is not recognized

We often see in the logs

Warning: org.apache.xerces.parsers.SAXParser: Feature 'http://javax.xml.XMLConstants/feature/secure-processing' is not recognized.
Warning: org.apache.xerces.parsers.SAXParser: Property http://javax.xml.XMLConstants/property/accessExternalDTD' is not recognized.
Warning org.apache.xerces.parsers.SAXParser: Property 'http://www.oracle.com/xml/jaxp/properties/entityExpansionLimit' is not recognized


See https://access.redhat.com/solutions/1124603 and https://issues.apache.org/jira/browse/XERCESJ-1654

see also Oracle Support:

Warning: org.apache.xerces.parsers.SAXParser After Upgrade to JDK 1.6.0_75 or Higher (Doc ID 1951255.1)

These messages are "logged" by com.sun.org.apache.xml.internal.utils.XMLReaderManager

public synchronized XMLReader getXMLReader()
    throws SAXException
  {
    if (this.m_readers == null) {
      this.m_readers = new ThreadLocal();
    }
    if (this.m_inUse == null) {
      this.m_inUse = new HashMap();
    }
    XMLReader reader = (XMLReader)this.m_readers.get();
    boolean threadHasReader = reader != null;
    String factory = SecuritySupport.getSystemProperty("org.xml.sax.driver");
    if ((threadHasReader) && (this.m_inUse.get(reader) != Boolean.TRUE) && ((factory == null) || (reader.getClass().getName().equals(factory))))
    {
      this.m_inUse.put(reader, Boolean.TRUE);
    }
    else
    {
      try
      {
        try
        {
          reader = XMLReaderFactory.createXMLReader();
          try
          {
            reader.setFeature("http://javax.xml.XMLConstants/feature/secure-processing", this._secureProcessing);
          }
          catch (SAXNotRecognizedException e)
          {
            System.err.println("Warning:  " + reader.getClass().getName() + ": " + e.getMessage());
          }
        }
        catch (Exception e)




so even if you add a Log Filter in WebLogic you won't prevent them from appearing in the stdout/stderr
Try updating to latest Xerces implementation http://xerces.apache.org/mirrors.cgi (prepend xercesImpl.jar and xml-apis.jar to your system classpath, or deploy in your EAR using prefer-application-packages)


Monday, March 6, 2017

Itinerary to visit Istanbul

You have to visit below places (ordered by importance/ must do)
1) There are many types of Bosphorus Ferry tours. http://www.turkeytravelplanner.com/go/Istanbul/Sights/Bosphorus/BosphorusCruise.html

2) These places are close to each other

Kapali Çarşisi (Covered or Grand Bazaar) http://kapalicarsi.com.tr/

Misir Çarşisi (Egyptian or Spice Market) http://www.istanbul-travel.net/egyptian-spice-bazaar.html

3) These places are close to each other

Haghia Sophia http://www.istanbul-travel.net/hagia-sophia-church.html
Topkapi Palace http://www.360tr.com/topkapi/index.htm
Sultanahmet Camii (Blue Mosque) http://www.istanbul-travel.net/the-blue-mosque.html
Yerebatan Sarayi (Basilica Cistern) http://www.istanbul-travel.net/basilica-cistern.html
Mevlevi Monastery http://www.istanbul-travel.net/mevlevi-monastery.html

4) Istiklal Street - Taxim http://www.istanbul-travel.net/istiklal-street.html

5) DolmaBahce Palace http://www.istanbul-travel.net/dolmabahce-palace.html

6) Istanbul islands (Princes' Islands) http://www.turkeytravelplanner.com/go/Istanbul/Sights/adalar/

Another list, you may find a few extra places in it.
If you go to Ortaköy, you have to eat “Kumpir” there. It is very popular.
There you can also have a tea(and eat simit http://en.wikipedia.org/wiki/Simit ) next to bosphorous and buy things from small shops.
If you like sweets, I would suggest buying baklava and other things from Gulluoglu, or MADO.
more:
Beyoglu (Pera): Istanbul's real centre now is the Grand Rue de Pera (Istiklal Caddesi). Nice restaurants and shops. Crowded.

• In the Sultanahmet Square :

• Istanbul Archaeology Museums

• Grand Bazar

• Spice Bazar

• Galata Tower: cross the Golden Horn Bridge and give a coffee break at Karaköy before heading to Tünel and going up the Galata Tower to watch the splendid view of Istanbul.

• Dolmabahce Palace

• OrtaKöy

• Bagdat Caddesi (Bagdat Street): the Anatolian side.

• • Istanbul hamams

The Museum Pass Istanbul is a museum entrance card that allows entrance to Istanbul’s twelve must-see museums, without having to endure the long queues. The 85 TL Museum Pass is valid for 72 hours (3 days) and the 115 TL Museum Pass for 120 hours (5 days) from the first museum visit.

The Museum Pass Istanbul gives easy access to:
Hagia Sophia Museum
Topkapi Palace Museum and Harem Apartments
Istanbul Archaeological Museums
The Museum of Turkish and Islamic Arts
Museum for the History of Science and Technology in Islam
Istanbul Mosaic Museum
Hagia Irene Museum
Chora Museum
Rumeli Hisar Museum
Yildiz Palace Museum
Galata Mevlevi House Museum
Istanbul Fethiye Museum (Pammakaristos)
You can save quite a bit of money with the Museum Pass compared to buying separate tickets for each museum. Recently the individual ticket prices have increased, so the Museum Pass is more beneficial than ever. The card is also crucial to anyone trying to save time. In the busy season for museums, the queues can be up to two hours long. Museum Pass Istanbul allows you to enter each of the twelve museums in only 30 seconds.
Museum Pass Istanbul gives additional discounts from 10% to 30% at elite private museums, more than twenty arts and entertainment venues, museum shops and GES Shops. You can purchase Museum Pass Istanbul from the ticket gates at Topkapi Palace Museum, Hagia Sophia Museum, Chora Museum, Istanbul Archaeological Museums, http://www.muze.gov.tr and Mobile Sales Stations. The two types of Museum Pass are also available at the concierge desk of the many hotels around the city, listed here. However, the sale of the Museum Pass at hotels is under discretion of the hotel concierge and reception.





Java: no more boilerplate, use Lombok

https://projectlombok.org/ the video tells it all. The problem with boilerplate code is not much that you have to write it (it's mostly autogenerated by Eclipse anyway) and maintain it, but is that it's VISUALLY disturbing and indistinguishable from business code. So the less boilerplate code, the more readable your code.

Saturday, March 4, 2017

Spring Boot starter web app

(courtesy of the excellent javabrains.io https://javabrains.io/courses/spring_bootquickstart/ )
Install Spring Tool Suite https://spring.io/tools/sts/all

Run STS.exe
Adjust your Maven setting.xml (Window, Preferences, Maven, User Settings)

new / Maven Project

edit the pom.xml :

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>io.javabrains.springbootquickstart</groupId>
  <artifactId>course-api</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>Java Brains Course API</name>
  <parent>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-parent</artifactId>
   <version>1.5.0.RELEASE</version>
  </parent>
  
  <dependencies>
  <dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-web</artifactId>
  </dependency>
  
  </dependencies>
  
  <properties>
   <java.version>1.8</java.version>
  </properties>
</project>



Create this main App class

package io.javabrains.springbootstarter;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class CourseApiApp {

 public static void main(String[] args) {
  SpringApplication.run(CourseApiApp.class, args);

 }

}


and these 2 controller classes

package io.javabrains.springbootstarter.hello;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {
 @RequestMapping("/hello")
 public String sayHi() {
  return "Hi";
 }
 
 

}


package io.javabrains.springbootstarter.topic;

import java.util.Arrays;
import java.util.List;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TopicController {
 @RequestMapping("/topics")
 public List getAllTopics() {
  return Arrays.asList(
    new Topic("a", "aa", "aaa"),
    new Topic("b", "bb", "bbb")
    );
 } 

}




where Topic is

package io.javabrains.springbootstarter.topic;

public class Topic {
 private String id;
 private String name;
 private String description;
 public String getId() {
  return id;
 }
 public void setId(String id) {
  this.id = id;
 }
 public String getName() {
  return name;
 }
 public void setName(String name) {
  this.name = name;
 }
 public String getDescription() {
  return description;
 }
 public void setDescription(String description) {
  this.description = description;
 }
 public Topic(String id, String name, String description) {
  super();
  this.id = id;
  this.name = name;
  this.description = description;
 }
 
 public Topic() {
  
 }
 

}




Run the main App (this will start the embedded tomcat), enter in the browser this

http://localhost:8080/topics

and you get a great JSON response....

[{"id":"a","name":"aa","description":"aaa"},{"id":"b","name":"bb","description":"bbb"}]



Thursday, March 2, 2017

bad class file, bad signature

We had an interesting case of an invalid class failing with version 12.1.3 of WebLogic (it was working with previous release)
 
 
####<Feb 27, 2017 7:46:40 AM CET> <Error> <Deployer> <myserver.pippo.com> <pippodomain> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1488178000430> <BEA-149205> <Failed to initialize the application "PIPPO" due to error weblogic.application.ModuleException: String index out of range: -1
String index out of range: -1
weblogic.application.ModuleException: String index out of range: -1
String index out of range: -1
        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:211)
        at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:119)
        at weblogic.server.AbstractServerService.postConstruct(AbstractServerService.java:78)
        at sun.reflect.GeneratedMethodAccessor8.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 org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$UpOneLevel.run(CurrentTaskFuture.java:753)
        at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:553)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
Caused By: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
        at java.lang.String.substring(String.java:1911)
        at weblogic.application.utils.annotation.ClassInfoImpl$MethodVisitorImpl.visitAnnotation(ClassInfoImpl.java:472)
        at com.bea.objectweb.asm.ClassReader.b(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.<init>(ClassInfoImpl.java:86)
        at weblogic.application.utils.annotation.ClassInfoImpl.<init>(ClassInfoImpl.java:79)
        at weblogic.application.utils.annotation.ClassfinderClassInfos.getClassInfoFromSource(ClassfinderClassInfos.java:325)
        at weblogic.application.utils.annotation.ClassfinderClassInfos.populateClassInfos(ClassfinderClassInfos.java:278)
        at weblogic.application.utils.annotation.ClassfinderClassInfos.<init>(ClassfinderClassInfos.java:72)
        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:260)
        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:211)
        at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:119)
        at weblogic.server.AbstractServerService.postConstruct(AbstractServerService.java:78)
        at sun.reflect.GeneratedMethodAccessor8.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 org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$UpOneLevel.run(CurrentTaskFuture.java:753)
        at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:553)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
>
 


See also this previous post http://www.javamonamour.org/2016/01/weblogic-deployment-fails.html

Problem is that WebLogic doesn't tell us which class is failing, so I had to patch this class

package weblogic.utils.classloaders;
 
import java.io.IOException;
import java.security.cert.Certificate;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
 
public class JarSource
  extends ZipSource
{
  private final JarFile jarFile;
  private final JarEntry jarEntry;
 
  public JarSource(JarFile jf, JarEntry je)
  {
    super(jf, je);
    this.jarFile = jf;
    this.jarEntry = je;
    System.out.println("JarSource, jf=" + jf.getName() + " je=" + je);
  }
 
  public Manifest getManifest()
    throws IOException
  {
    return this.jarFile.getManifest();
  }
 
  public Certificate[] getCertificates()
  {
    return this.jarEntry.getCertificates();
  }
}


adding a System.out.println(it's horrible but it works)


To check if the class is REALLY invalid I use this tester (bad class is com.pippo.web.util.Properties ):
import com.pippo.web.util.Properties;
import java.lang.annotation.Annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.reflect.Method;
 
public class TestAnnotations {
       public static void main(String[] args) throws Exception {
             Class propertiesClass = com.pippo.web.util.Properties.class;
             Annotation annos[] = propertiesClass.getAnnotations();
             for (Annotation a : annos)
                    System.out.println(a);
            
             for (Method m : propertiesClass.getMethods()) {
                    System.out.println("parsing method " + m.getName());
                    annos = m.getAnnotations();
 
                    System.out.println("All annotations for method " + m.getName());
                    for (Annotation a : annos) System.out.println(a);
                   
             }
       }
 
}


With Java 8 I get this:

parsing method setProperty All annotations for method setProperty parsing method getProperty All annotations for method getProperty parsing method getProperty All annotations for method getProperty parsing method load All annotations for method load parsing method load All annotations for method load parsing method save Exception in thread "main" java.lang.reflect.GenericSignatureFormatError: Signature Parse error: Expected Field Type Signature Remaining input: = at sun.reflect.generics.parser.SignatureParser.error(SignatureParser.java:124) at sun.reflect.generics.parser.SignatureParser.parseFieldTypeSignature(SignatureParser.java:297) at sun.reflect.generics.parser.SignatureParser.parseFieldTypeSignature(SignatureParser.java:283) at sun.reflect.generics.parser.SignatureParser.parseTypeSignature(SignatureParser.java:485) at sun.reflect.generics.parser.SignatureParser.parseTypeSig(SignatureParser.java:188) at sun.reflect.annotation.AnnotationParser.parseSig(AnnotationParser.java:436) at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:241) at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120) at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72) at java.lang.reflect.Executable.declaredAnnotations(Executable.java:599) at java.lang.reflect.Executable.declaredAnnotations(Executable.java:597) at java.lang.reflect.Executable.getDeclaredAnnotations(Executable.java:588) at java.lang.reflect.Method.getDeclaredAnnotations(Method.java:630) at java.lang.reflect.AccessibleObject.getAnnotations(AccessibleObject.java:207) at TestAnnotations.main(TestAnnotations.java:16)

With Java 7 and 6 I get this when compiling:

TestAnnotations.java:1: cannot access com.pippo.web.util.Properties bad class file: com/pippo/web/util/Properties.class(com/pippo/web/util:Properties.class) bad signature: = ¿I ^ Please remove or make sure it appears in the correct subdirectory of the classpath. import com.pippo.web.util.Properties; ^

As a workaround, to avoid all this class scanning, you can try using -Dweblogic.servlet.DIDisabled=true or setting the metadata-complete attribute to true in the web.xml :

https://docs.oracle.com/cd/E24329_01/web.1211/e21049/annotateservlet.htm#WBAPP225



Wednesday, March 1, 2017

java.net.ProtocolException: EOF after reading only BLA of MUMBLE promised bytes

java.net.ProtocolException: EOF after reading only: '1343374' of: '17674381' promised bytes, 
               out of which at least: '0' were already buffered
        at weblogic.servlet.internal.PostInputStream.complain(PostInputStream.java:97)
        at weblogic.servlet.internal.PostInputStream.read(PostInputStream.java:198)
        at weblogic.servlet.internal.ServletInputStreamImpl.read(ServletInputStreamImpl.java:228)
        at java.io.FilterInputStream.read(FilterInputStream.java:116)
        at org.apache.commons.fileupload.util.LimitedInputStream.read(LimitedInputStream.java:134)
        at org.apache.commons.fileupload.MultipartStream$ItemInputStream.makeAvailable(MultipartStream.java:999)
        at org.apache.commons.fileupload.MultipartStream$ItemInputStream.read(MultipartStream.java:903)
        at java.io.FilterInputStream.read(FilterInputStream.java:116)
        at org.apache.commons.fileupload.util.LimitedInputStream.read(LimitedInputStream.java:134)
        at java.io.FilterInputStream.read(FilterInputStream.java:90)
        at org.apache.commons.fileupload.util.Streams.copy(Streams.java:100)
        at org.apache.commons.fileupload.util.Streams.copy(Streams.java:70)
        at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:347)



Several things can be attempted:
1) increase max post size and post timeout
2) restart server
3) change browser

https://blogs.oracle.com/vijaya/entry/java_net_protocolexception_eof_after

https://docs.oracle.com/cd/E13222_01/wls/docs81/ConsoleHelp/domain_server_protocols_http.html