Showing posts with label weblogic. Show all posts
Showing posts with label weblogic. Show all posts

Wednesday, April 26, 2017

How to solve 'Cannot assign requested address: JVM_Bind' on NodeManager in Weblogic?

Next problem could be caused by port used by other process or ip is not suited in hosts file:

--------------------------------------------
 The server is unable to create a server socket for listening. The address localhost might be incorrect or another process is using port 5556: java.net.BindException: Cannot assign requested address: JVM_Bind
--------------------------------------------
Windows check: netstat -an | find "5556"

After checking if ports were used by another process next is to make a review in hosts file whether or not is IP correct declared.

Best Regards,

Friday, February 10, 2017

Friday, December 23, 2016

How to solve common error on Oracle Weblogic using Spring Websocket?

The fooling error clarify the handshake use in Spring Websocket as it is said in the folling line:

registry.addEndpoint("/portafolio").setAllowedOrigins("*").withSockJS();

Error:


The solution to this error should be review Spring Messaging and Websocket version to charge 4.3.5.RELEASE version, there are somes changes from version 4.1.2.RELEASE to 4.3.5.RELEASE specially in Tyrus container and application server distribution.

Error:
Error during WebSocket handshake: Unexpected response code: 500

Solution: Add handshakehandler.-
registry.addEndpoint("/portafolio").setHandshakeHandler(new DefaultHandshakeHandler(new WebLogicRequestUpgradeStrategy()))
    .setAllowedOrigins("*").withSockJS();



Best regards,

Thursday, June 26, 2014

WEBLOGIC JMS: "The persistent file store", "cannot open file"

It is well known that the way to have a persistence store on you JMS Configuration is a good habit on your development mainly if we are talking about of Cluster Enviroment, having a configuration with dat file sored on a filesystem is done by doing asignation on your JMS Server, but what-if something happen with DAT file, perhaps you could even imagine a situation can produce this event, for example a bad configuration throught a unknown familiar user on your server, a kind of application trying to access to DAT file, there some situations could happend, on my experience i have list some specific expection related above:

  • The persistence store ... Cannot open file ...
  • Cannot find ... DAT File
  • GXA... read exception

If you are on this kind of situation my advice to you should please make a backup of your persistence store and follow the next steps:

1. BackUp Persistence Store  on a new folder under your filesystem
2. Delete Components on your weblogic likes: Module JMS, Server JMS and Persistence Store.
3. Shutdown all servers involver, including adminserver
4. Start All Servers, please be sure that no one could have any failed exception related.
5. Make your JMS Configuration Again.
6. Most common problems may be resolve by doing this, if there is another problem by creating a JMS Server please try to change the type of writing to save with cache and File locked to false, this is because the time of saving to DAT probably do a mess with another process.

Please take care about situation likes because someone or something on your operating system try to do a connection  with your DAT file.

Best Regards,

Monday, June 9, 2014

Back-Up FileStore of a JMS Weblogic Configuration

Main reasons you could be benefits of doing this, are a backup, delete, compress or replace .dat file.

  • Shutdown servers, cluster, nodeManager  or coherence (cluster or server) who is occupied the JMS Configuration.

  • Having access as a root or weblogic user, you  should execute the following script  shell:

  1. setWLSEnv.sh: Located on  /opt/weblogic/XXXX/wlserver_10.3/server/bin or wherever is installed weblogic, maybe /root/Oracle/wlserver_10.3/server/bin is another possible location.
  2. wlst.sh: Located on  /opt/weblogic/XXXX/wlserver_10.3/common/bin or wherever is installed weblogic, maybe /root/Oracle/wlserver_10.3/common/bin is another possible location.
  • Now, what we have just done?, well setWLSEnv.sh configure on your enviroment several jar  that are part of the neccesary running to calling method or classes for doing changes in weblogic without a web console, at the last one is a script which is necessary for doing python/ironpython o command execution,

  • After running wlst.sh, you will have a prompt just like this:  wls:/offline> with the weblogic password, user and ip/port the possibilites are unlimted to whatever your imagination could do.

  1. Execute: 
wls:/offline> compactstore('<LOCATION_FILESTOREORIGINAL>','<LOCATION_COPYONFAIL>')
  •  Depends on your dat size is the time that you will be waiting, may I say that for a 5 files amout of 2GB takes me about 1 hour, please waiting after the execution is complete.

  1. In your LOCATION_FILESTOREORIGINAL(ex:/root/jms/filestore) you must a found a compressend file, in my case the size reduce about a 20% per file. 
  2. In your LOCATION_COPYONFAIL(ex:/root/jms/backup), you must found the original file with the same size of the original file.

Now, what we have in mind?, perhaps you could limite the size of  your persistence store in the way that you could make a backup for auditing process as I said this could be benifit for each part of development.

Best regards,



Saturday, March 22, 2014

How to resolve "Object has been closed" driver exception on Oracle Weblogic?

Oracle Weblogic provide a list of jdbc driver which you could connect with another database different of Oracle Database Grid Link, If you chose a configuration of a simple datasource you will get a error like this on your log file:


Caused by: java.sql.SQLException: [FMWGEN][SQLServer JDBC Driver]Object has been closed.
    at weblogic.jdbc.sqlserverbase.ddb_.b(Unknown Source)
    at weblogic.jdbc.sqlserverbase.ddb_.a(Unknown Source)
    at weblogic.jdbc.sqlserverbase.ddb9.b(Unknown Source)
    at weblogic.jdbc.sqlserverbase.ddb9.a(Unknown Source)
    at weblogic.jdbc.sqlserverbase.BaseConnection.getTransactionIsolation(Unknown Source)
    at weblogic.jdbc.wrapper.PoolConnection_weblogic_jdbc_sqlserverbase_ddah.getTransactionIsolation(Unknown Source)
    at org.springframework.jdbc.datasource.DataSourceUtils.prepareConnectionForTransaction(DataSourceUtils.java:190)



After a quick look inside of the log file I figure out that is Memory Problem of OracleWeblogic so I imagine that driver should be changed by an updated driver made it by a the original vendor in this case we are talking of Microsoft SqlServer 2008 R2, if you following a changing configuration of a driver inside of a weblogic you might get an idea of you was. After a successful artifact update and depending of application I get an error like this:

Reached maximum capacity of pool

So after a shameful explanation of what in the hell I was doing with a Database Connection with my leaders the decision was taken, increase capacity connection inside of oracle weblogic, in future releases I will fix my problem with shared configuration using weblogic.xml and probably using a SqlAdapter created with Oracle Service Bus.

 Best regards,

Tuesday, March 18, 2014

How to Install a JDBC Driver on Oracle Weblogic?

Next Steps should be doing inside each Server on Cluster Server also you have to include administrative console of Oracle Weblogic.

Procedure for Driver Installation

1. We should use an administrative user on Server Console for copy and paste an artifact.(Example: weblogic).
2. Copy & Paste jdbcdriver-XXX.jar artifact inside the following path: ${WL_HOME}/server/lib/

 ${WL_HOME} is the path where is installed binary files of Oracle Weblogic, as example of that is the following path:
 /root/Oracle/Middleware/wlserver_10.3/server/lib/

3. Add permissions to the artifact executing the following sentences:


chmod 755 ${WL_HOME}/server/lib/jdbcdriver-XXX.jar

4. Open the following file inside ${WL_HOME}/server/lib

jdbcdrivers.xml

Add the following code snippet:

EXAMPLE (SQL SERVER 2008 R2):

  <Driver
    Database="MS SQL Server"
    Vendor="Microsoft"
    Type="Type 4"
    DatabaseVersion="2005 and later"
    ForXA="false"
    ClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
    URLHelperClassname="weblogic.jdbc.utils.MSSQL2005JDBC4DriverURLHelper"
    TestSql="SELECT 1">
        <Attribute Name="DbmsName" Required="true" InURL="true"/>
        <Attribute Name="DbmsHost" Required="true" InURL="true"/>
        <Attribute Name="DbmsPort" Required="true" InURL="true" DefaultValue="1433"/>
        <Attribute Name="DbmsUsername" Required="true" InURL="false"/>
        <Attribute Name="DbmsPassword" Required="true" InURL="false"/>
  </Driver>

  <Driver
    Database="MS SQL Server"
    Vendor="Microsoft"
    Type="Type 4"
    DatabaseVersion="2005 and later"
    ForXA="true"
    ClassName="com.microsoft.sqlserver.jdbc.SQLServerXADataSource"
    URLHelperClassname="weblogic.jdbc.utils.MSSQL2005JDBC4DriverURLHelper"
    TestSql="SELECT 1">
        <Attribute Name="DbmsName" Required="true" InURL="true"/>
        <Attribute Name="DbmsHost" Required="true" InURL="true"/>
        <Attribute Name="DbmsPort" Required="true" InURL="true" DefaultValue="1433"/>
        <Attribute Name="DbmsUsername" Required="true" InURL="false"/>
        <Attribute Name="DbmsPassword" Required="true" InURL="false"/>

  </Driver>

This snippet contains a description of Driver Class and the proper use of it inside Oracle Weblogic Driver declaration.

The way to choose where it should be add the above lines is looking for the vendor of you jdbc driver, In my case is a SQL Server 2008 R2 so I identify where is SQL SERVER part of code and after the final bracket I add above code.

5. Go to the following path:

${WL_HOME}/common/bin
Example: /root/Oracle/Middleware/wlserver_10.3/common/bin

Open a file called: commEnv.sh

You should locate the following lines:
(Search between the lines of : # set up WebLogic Server's class path):

Inside of WEBLOGIC_CLASSPATH add the following line:

${CLASSPATHSEP}${WL_HOME}/server/lib/sqljdbc4.jar

You should have a variable declared likes this one:

WEBLOGIC_CLASSPATH="${JAVA_HOME}/lib/tools.jar${CLASSPATHSEP}${WL_HOME}/server/lib/weblogic_sp.jar${CLASSPATHSEP}${WL_HOME}/server/lib/weblogic.jar${CLASSPATHSEP}${FEATURES_DIR}/weblogic.server.modules_10.3.5.0.jar${CLASSPATHSEP}${WL_HOME}/server/lib/webservices.jar${CLASSPATHSEP}${ANT_HOME}/lib/ant-all.jar${CLASSPATHSEP}${ANT_CONTRIB}/lib/ant-contrib.jar${CLASSPATHSEP}${WL_HOME}/server/lib/sqljdbc4.jar"

After of doing step briefly commented above, you should have to restarted all your servers including administrative console, and If you declare a driver, you will get a Database Driver declared as you did it.



Best regards,


Monday, July 22, 2013

Quartz executes twice on Weblogic (Spring 3.2 + Quartz 1.8.6 + Weblogic 10.3g)

If you are developing some jobs with quartz probably you will figure out if your application will be well received by Weblogic, after a few hours some unittest I have the problem that quartz execute twice the method cointained in the job, If you try to debug the application on Weblogic you will be thinking alot of theories my solution was the following steps:

1. Create Quartz Database for clustering, this is at: 

../quartz-1.8.6/docs/dbTables

After executing the script in the database you will have to configure the quartz.properties:


This property file should be included in classpath, to charge this file you will have to add the following lines in applicationContext.xml:



Having this configuration will be loaded the ClusterManager, and you job executes only one time.

Best Regards,

Thursday, July 18, 2013

Exception: OptimisticLockingFailureException, Spring Batch 2.1.7

Probably this is not a non common exception on Spring Batch 2.1.7, if you are doing UnitTest this error will not appear, but if you are going to deploy your application on WebLogic 10g, spring batch breaks on ItemWriter, so the first thought is something like having break with a database transaction, well this is the answer:

If you have a configuration like this:


This will be break with the following exception on your Weblogic:



This is because some id and version are having a bad update in your spring batch table, to fix this problem you will have to create a Database with the full tables defined in your spring batch jar file:


If you unzip the jar file you will find a 'schema-drop-'%DATABASE%'.sql'  in "org/springframework/batch/core", you have to execute that script and re-deploy your application context with the folling configuration:


Finally, this error will be fixed.

Best Regards,

Monday, July 8, 2013

Create a JMS Destination Key on Weblogic 11g using WSLT

UPDATE: 13/04/2014
The article had been published on CodeProject.

http://www.codeproject.com/Tips/748377/Create-a-JMS-Configuration-on-Oracle-Weblogic-g-us
-------------------------------------------------------------------------------------------

There is another method to create a Server Configuration on Weblogic if you are not using the console, if you want to execute a script with all of your configuration you must know about WSLT.

This model solve problems like deployment on others enviroments like Quality Assurance and Production were you should dont have any permision to access to this console, only the deployer will run the script and install any executable on the server. You should follow the next steps:

1. First go to you Weblogic Home, for example the location of my weblogic installation is:


1:  [root@USER25 bin]# cd /root/Oracle/Middleware/11.1.2.4.0/   

2. Go to the next folder...


1:  [root@USER25 bin]# cd /root/Oracle/Middleware/11.1.2.4.0/wlserver_10.3/server/bin  

3. Open a console and keep in mind you should have running weblogic and the execute:


1:  [root@USER25 bin]# ./setWLSEnv.sh  

4. Running the above command you will have the opportunity to run script on Python and IronPython on your weblogic running, I will show you an script example runs several tasks to create a JMS Server, JMS Module, Queue, Dead Letter Queue and DESTINATION QUEUE that is the object we need for this tutorial, so this the code...

The segment of code we  carry on the next ...


1:    def createDestinationKey(dkname):  
2:        print "createDestinationKey() START"    
3:        cd('/JMSSystemResources/'+moduleName+'/JMSResource/'+moduleName)  
4:        dk1 = create(dkname, "DestinationKey")  
5:        dk1.setProperty("JMSPriority")  
6:        dk1.setKeyType("String")  
7:        dk1.setSortOrder("Descending")  
8:        print "createDestinationKey() END"  

Here we define a part of the XML that is deployed on the server, we pass the property, keytype and sortorder that should be published on Weblogic, this procedure can be executed as a transaction as python script. 


1:            ...  
2:          cd('/JMSSystemResources/'+moduleName+'/JMSResource/'+moduleName)                    
3:            cd('/JMSSystemResources/'+moduleName+'/JMSResource/'+moduleName+'/Queues/'+qname)  
4:            set('DestinationKeys',jarray.array([String(dkName)],String))  
5:          ...  


If you follow the script you will get a declaration of an array on XML, that because if you check Weblogic documentation a Destination Key is an Array of String, so in Python you have to declare your DeclarationKeys as String[], keep in mind that note.
  
5. The comand we need to execute on terminal is:


1:  [root@USER25 bin]# java weblogic.WLST createJmsServer.py  

6. Finally we will see the trace of execution, and veryfing with the Weblogic Console all the script will be create all configuration declarated on python file, this is so much powerfull of course you can create a JNDI or any task that we do over console.

UPDATE 29/05/2016
You could found script uploaded to github on the next link:
https://github.com/osanchezh/weblogicjmsclustered-module  

Best Regards,