ResourceBundle.getString() throws ArrayIndexOutOfBoundsException
Hi Everyone.
I am getting "java.lang.ArrayIndexOutOfBoundsException: 1" when I try to call ResourceBundle.getString():
ResourceBundle rb = ResourceBundle.getBundle("full.package.name.StringsBundle");
String s;
try {
s = rb.getString( key_that_i_am_pretty_sure_really_exists_in_StringsBundle_and_is_really_a_string );
} catch ( Exception e ) {
s = "Exception:" + e.toString();
}s always ends up as "Exception: java.lang.ArrayIndexOutOfBoundsException: 1"
According to the javadoc, getString() can throw NullPointerExceptions or MissingResourceExceptions or ClassCastException, but not ArrayIndexOutOfBoundsExceptions... and the Exception doesn't make any sense to me in this context...
Could this be a bug in the ResourceBundle implementation? Or is there something really stupid I am missing or what do you think?
Thanks,
Bishop
Thanks for the lead about the character compatibility. I will look into that more. It sounds likely since the strings I am trying to look up in the bundle have kanji in them.
Here's the stack trace (some package/class/variable names slightly obfuscated). The rogue exception is indeed being thrown by the ListResourceBundle implementation code.
java.lang.ArrayIndexOutOfBoundsException: 1
at java.util.ListResourceBundle.loadLookup(ListResourceBundle.java:176)
at java.util.ListResourceBundle.handleGetObject(ListResourceBundle.java:106)
at java.util.ResourceBundle.getObject(ResourceBundle.java:378)
at java.util.ResourceBundle.getString(ResourceBundle.java:344)
at my.app.package.MyOtherObject.getStringByKey(MyOtherObject.java:59)
at my.app.package.MyCommandObject.execute(MyCommandObject.java:79)
at my.app.package.MyServletObject.processRequest(MyServletObject.java:102)
at my.app.package.MyServletObject.doPost(MyServletObject.java:131)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:427)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:315)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:287)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:222)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1096)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:166)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1096)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:288)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:647)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:579)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:831)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:380)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
Similar Messages
-
TableSorter throws ArrayIndexOutOfBoundsException
Hi,
When I'm using the TableSorter in my program the getValueAt(int, int) throws ArrayIndexOutOfBoundsException.
I can't understand why??
My only idea is that the model isn't informed of a change in size of the data.
All clues are welcome!!
/DavidHi,
use fireTableRowsDeleted(...)-method, every time, you delete one or more rows
use fireTableStructureChanged()-method, every time, you delete a hole column in the model
This will inform the JTable correctly, if the table decreases in size in any direction.
greetings Marsian -
Long.toString(long, int) throws ArrayIndexOutOfBoundsException
We're using Long.toString(long, int) to convert a long into a base-32 string, which is used as a primary key for entities in our database. On occasion, Long.toString(long, int) throws an ArrayOutOfBoundsException! This only occurs in the deployed system, I cannot get it to occur in a testing environment.
The object that contains the call to Long.toString(int, long) is shared by multiple threads, but the state of the object is immutable and access to the object is not synchronized. I have tested this code extensively with multithreaded access and cannot reproduce the exception in a test environment.
Furthermore, this bug only occurs on Linux.
As a workaround, we have a loop that will attempt the call 5 times, and then fail if the call could not be completed. Generally, this helps to get the code running but will sometimes fail.
Here are some characteristics of the problem:
1) Linux kernel 2.4.10 on Pentium III.
2) Sun JVM 1.3.1_01
3) Code is accessed from a session bean deployed into JBoss 2.4.3.
4) Database entities have undergone bytecode enhancement per JDO specification.
Obviously, the bytecode enhancement is most suspect here. The class that contains the error-prone code is not enhanced, but entities do contain references to instances of the primary key class.
At first blush this sounds like a classic memory corruption issue that is surfacing in Long.toString() but is probably caused elsewhere. Has anybody seen anything like this or know of either a solution or suggested debugging procedure?
Thanks.
-brianWe already discussed that approach. The reason that
it was rejected is because my C experience suggests
that it will just move the corruption evidence to another
area of the application with possibly more insidious
effects.I'm not so sure about that. Does your five-try loop actually help? If a stateless method throws an IndexOutOfBoundsException with a given set of parameters, then I would expect it to always throw this exception with the same parameters. Any other behaviour is non-deterministic and not suitable (IMHO) for a production machine.
I assume you are manipulating arrays in other locations of your code... if these other locations aren't displaying similar non-deterministic behaviour, then common sense dictates that writing your own toString method will not exhibit the same non-deterministic behaviour.
A little test, compile a class (TestLong, for argument sake) with the method exactly from the Sun source. Decompile it to byte-code with 'javap -c TestLong', and compare that to the same method from Long with 'javap -c java.lang.Long'. If the bytecode isn't identical (Barring numbering differences for class reference table differences), then the implementation you have is not the expected.
A final suggestion, try a different JVM - both IBM and Sun provide JVMs for linux? -
Text not updated when changing the ResourceBundle
this is an abstraction of what i have on my code:
controller
public class controller extends VBox{
@FXML protected Label ex2;
public CtrlMainMenu() throws Exception{
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/view/View.fxml"));
fxmlLoader.setController(this);
fxmlLoader.setRoot(this);
fxmlLoader.setResources(CtrlLanguage.resource);
fxmlLoader.load();
@Override public void initialize(URL arg0, ResourceBundle arg1) {
ex2.setText(arg1.getString("ex2"));
}View
<fx:root type="VBox" xmlns:fx="http://javafx.com/fxml">
<children>
<Label text="%ex1"/>
<Label fx:id="ex2"/>
<children>
</fx:root>Language controller
public class CtrlLanguage{
private static String PATH =
new File(
CtrlImageLoader.class.getProtectionDomain().getCodeSource().getLocation().getPath()
).getParentFile().getPath() + "/language/";
public static ResourceBundle resource;
public static void setLanguage(String file) throws Exception{
try {
if(new File(PATH + file).exists())
resource = new PropertyResourceBundle(new FileInputStream(PATH + file));
else
resource = new PropertyResourceBundle(CtrlLanguage.class.getResourceAsStream("/language/"+file));
} catch (Exception e) {
resource = new PropertyResourceBundle(CtrlLanguage.class.getResourceAsStream("/language/EN"));
public static String get(String key){
try {
return resource.getString(key);
} catch (Exception e) {
return key;
}problem comes when I try to change the language without changing the current root
the elements of the view are not updated when the bundle is changed (CtrlLanguage.setLanguage("file");) until the root is changed/loaded again
is there any way so i can make the content change without having to reload again the root?A method which returns an instance of the following class:
* A localizable read only property for internationalization of string properties.
* @author Christian Schudt
public final class LocalizableStringProperty extends ReadOnlyStringProperty {
private String resourceKey;
private StringProperty text;
private String baseName;
private ClassLoader classLoader;
// Keep the listener as hard reference in the class, so that it won't get GCed, until this class has no references any more.
private ChangeListener<Locale> changeListener;
public LocalizableStringProperty(LocaleManager localeManager, String baseName, String resourceKey) {
this(localeManager, baseName, resourceKey, null);
public LocalizableStringProperty(LocaleManager localeManager, String baseName, String resourceKey, ClassLoader classLoader) {
changeListener = new ChangeListener<Locale>() {
@Override
public void changed(ObservableValue<? extends Locale> observableValue, Locale locale, Locale locale1) {
localeChanged(locale1);
localeManager.localeProperty().addListener(new WeakChangeListener<Locale>(changeListener));
this.baseName = baseName;
this.classLoader = classLoader;
this.resourceKey = resourceKey;
text = new SimpleStringProperty();
localeChanged(localeManager.getLocale());
private void localeChanged(Locale locale) {
ResourceBundle resourceBundle;
Locale.setDefault(locale);
if (classLoader == null) {
resourceBundle = ResourceBundle.getBundle(baseName, locale);
} else {
resourceBundle = ResourceBundle.getBundle(baseName, locale, classLoader);
text.set(resourceBundle.getString(resourceKey));
@Override
public String get() {
return text.get();
@Override
public Object getBean() {
return text.getBean();
@Override
public String getName() {
return text.getName();
@Override
public void addListener(ChangeListener<? super String> changeListener) {
text.addListener(changeListener);
@Override
public void removeListener(ChangeListener<? super String> changeListener) {
text.removeListener(changeListener);
@Override
public void addListener(InvalidationListener invalidationListener) {
text.addListener(invalidationListener);
@Override
public void removeListener(InvalidationListener invalidationListener) {
text.removeListener(invalidationListener);
} -
Hi All,
We are on Netweaver 7.01 SP14. (well I understand we are way behind patch levels, but a simple file upload should be working ?/)
We are trying to upload (HTML &/ Image) a file in one of the KM's public folder.
As and when we select folder and click on upload we get the below message:
Below is the error trace details:
Full Message Text
com.sapportals.wdf.WdfException
at com.sapportals.wcm.control.edit.ResourceUploadControl.render(ResourceUploadControl.java:688)
at com.sapportals.wdf.layout.HorizontalLayout.renderControls(HorizontalLayout.java:42)
at com.sapportals.wdf.stack.Pane.render(Pane.java:155)
at com.sapportals.wdf.stack.PaneStack.render(PaneStack.java:73)
at com.sapportals.wdf.layout.HorizontalLayout.renderPanes(HorizontalLayout.java:73)
at com.sapportals.wdf.stack.Pane.render(Pane.java:158)
at com.sapportals.wdf.stack.PaneStack.render(PaneStack.java:73)
at com.sapportals.wdf.layout.HorizontalLayout.renderPanes(HorizontalLayout.java:73)
at com.sapportals.wdf.stack.Pane.render(Pane.java:158)
at com.sapportals.wdf.stack.PaneStack.render(PaneStack.java:73)
at com.sapportals.wdf.layout.HorizontalLayout.renderPanes(HorizontalLayout.java:73)
at com.sapportals.wdf.stack.Pane.render(Pane.java:158)
at com.sapportals.wdf.stack.PaneStack.render(PaneStack.java:73)
at com.sapportals.wdf.WdfCompositeController.internalRender(WdfCompositeController.java:709)
at com.sapportals.wdf.WdfCompositeController.buildComposition(WdfCompositeController.java:674)
at com.sapportals.htmlb.AbstractCompositeComponent.preRender(AbstractCompositeComponent.java:33)
at com.sapportals.htmlb.Container.preRender(Container.java:120)
at com.sapportals.htmlb.Container.preRender(Container.java:120)
at com.sapportals.htmlb.Container.preRender(Container.java:120)
at com.sapportals.portal.htmlb.PrtContext.render(PrtContext.java:408)
at com.sapportals.htmlb.page.DynPage.doOutput(DynPage.java:238)
at com.sapportals.wcm.portal.component.base.KMControllerDynPage.doOutput(KMControllerDynPage.java:134)
at com.sapportals.htmlb.page.PageProcessor.handleRequest(PageProcessor.java:133)
at com.sapportals.portal.htmlb.page.PageProcessorComponent.doContent(PageProcessorComponent.java:134)
at com.sapportals.wcm.portal.component.base.ControllerComponent.doContent(ControllerComponent.java:88)
at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)
at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215)
at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:645)
at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:753)
at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:249)
at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:557)
at java.security.AccessController.doPrivileged(Native Method)
at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:430)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1064)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:104)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176)
--- Nested WDF Exception -----------------------
java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key xtlt_Required
at java.util.ResourceBundle.getObject(ResourceBundle.java:327)
at java.util.ResourceBundle.getObject(ResourceBundle.java:324)
at java.util.ResourceBundle.getString(ResourceBundle.java:287)
at com.sapportals.wcm.util.resource.ResourceBundles.getString(ResourceBundles.java:55)
at com.sapportals.wcm.control.base.WcmBaseControl.getBaseBundleString(WcmBaseControl.java:150)
at com.sapportals.wcm.control.base.WcmBaseControl.getBaseBundleString(WcmBaseControl.java:176)
at com.sapportals.wcm.control.edit.ResourceUploadControl.renderUploadFileContent(ResourceUploadControl.java:773)
at com.sapportals.wcm.control.edit.ResourceUploadControl.render(ResourceUploadControl.java:655)
at com.sapportals.wdf.layout.HorizontalLayout.renderControls(HorizontalLayout.java:42)
at com.sapportals.wdf.stack.Pane.render(Pane.java:155)
at com.sapportals.wdf.stack.PaneStack.render(PaneStack.java:73)
at com.sapportals.wdf.layout.HorizontalLayout.renderPanes(HorizontalLayout.java:73)
at com.sapportals.wdf.stack.Pane.render(Pane.java:158)
at com.sapportals.wdf.stack.PaneStack.render(PaneStack.java:73)
at com.sapportals.wdf.layout.HorizontalLayout.renderPanes(HorizontalLayout.java:73)
at com.sapportals.wdf.stack.Pane.render(Pane.java:158)
at com.sapportals.wdf.stack.PaneStack.render(PaneStack.java:73)
at com.sapportals.wdf.layout.HorizontalLayout.renderPanes(HorizontalLayout.java:73)
at com.sapportals.wdf.stack.Pane.render(Pane.java:158)
at com.sapportals.wdf.stack.PaneStack.render(PaneStack.java:73)
at com.sapportals.wdf.WdfCompositeController.internalRender(WdfCompositeController.java:709)
at com.sapportals.wdf.WdfCompositeController.buildComposition(WdfCompositeController.java:674)
at com.sapportals.htmlb.AbstractCompositeComponent.preRender(AbstractCompositeComponent.java:33)
at com.sapportals.htmlb.Container.preRender(Container.java:120)
at com.sapportals.htmlb.Container.preRender(Container.java:120)
at com.sapportals.htmlb.Container.preRender(Container.java:120)
at com.sapportals.portal.htmlb.PrtContext.render(PrtContext.java:408)
at com.sapportals.htmlb.page.DynPage.doOutput(DynPage.java:238)
at com.sapportals.wcm.portal.component.base.KMControllerDynPage.doOutput(KMControllerDynPage.java:134)
at com.sapportals.htmlb.page.PageProcessor.handleRequest(PageProcessor.java:133)
at com.sapportals.portal.htmlb.page.PageProcessorComponent.doContent(PageProcessorComponent.java:134)
at com.sapportals.wcm.portal.component.base.ControllerComponent.doContent(ControllerComponent.java:88)
at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)
at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215)
at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:645)
at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:753)
at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:249)
at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:557)
at java.security.AccessController.doPrivileged(Native Method)
at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:430)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1064)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:104)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176)Hi Vijay,
Thanks for the quick reply.
I have gone through the notes 1535201 & now on 1606563 after your advise.
Both the notes says the fix is available on 7.01 after SP 07 and we are on SP 14 already.
Also just in case I did checked with our basis and they confirmed we are a head and we have the above notes in our release already.
Unfortunately the notes are not the solution to the investigation till date.
Thanks,
Sai -
ArrayIndexOutOfBoundsException in JDeveloper
Hi,
I am working with JDeveloper for 11.5.10 CU2. I extended a View object for an LOV and created the relevant substitution for it.
It was working fine and when I had to create another substitution it did not allow me to go ahead.
On the click of the the Substitutions Tab in the Edit Business Components Project window I get the following error:
java.lang.ArrayIndexOutOfBoundsException
at oracle.jbo.dt.ui.main.tree.DtuTreeNode.getChildAt(DtuTreeNode.java:109)
at javax.swing.tree.DefaultTreeModel.nodesWereInserted(DefaultTreeModel.java:293)
at javax.swing.tree.DefaultTreeModel.insertNodeInto(DefaultTreeModel.java:223)
at oracle.jbo.dt.ui.main.tree.DtuBaseTree.addChild(DtuBaseTree.java:142)
at oracle.jbo.dt.ui.main.tree.DtuJboTree.addChild(DtuJboTree.java:472)
at oracle.jbo.dt.ui.main.tree.DtuJboTree.populateObject(DtuJboTree.java:465)
at oracle.jbo.dt.ui.main.tree.DtuJboTree.populateContainerChildren(DtuJboTree.java:429)
at oracle.jbo.dt.ui.main.tree.DtuJboTree.populateFromContainer(DtuJboTree.java:393)
at oracle.jbo.dt.ui.main.tree.DtuJboTree.populateContainerChildren(DtuJboTree.java:414)
at oracle.jbo.dt.ui.main.tree.DtuJboTree.populateTree(DtuJboTree.java:362)
at oracle.jbo.dt.ui.main.tree.DtuJboTree.setApplication(DtuJboTree.java:118)
at oracle.jbo.dt.ui.pkg.PKSubsPanel.enter(PKSubsPanel.java:169)
at oracle.jbo.dt.ui.main.dlg.DtuWizard.selectPage(DtuWizard.java:620)
at oracle.jbo.dt.ui.pkg.PKAppWizard.selectPage(PKAppWizard.java:258)
at oracle.jbo.dt.ui.main.dlg.DtuWizard.selectPage(DtuWizard.java:595)
at oracle.jbo.dt.ui.main.dlg.DtuWizard.newMddPageSelected(DtuWizard.java:633)
at oracle.jbo.dt.ui.main.dlg.DtjMddTraversable.onEntry(DtuMddNavigable.java:255)
at oracle.ide.panels.MDDPanel.enterTraversableImpl(MDDPanel.java:649)
at oracle.ide.panels.MDDPanel.enterTraversable(MDDPanel.java:630)
at oracle.ide.panels.MDDPanel.access$7000571(MDDPanel.java:86)
at oracle.ide.panels.MDDPanel$Tsl.updateSelectedNavigable(MDDPanel.java:933)
at oracle.ide.panels.MDDPanel$Tsl.actionPerformed(MDDPanel.java:803)
at javax.swing.Timer.fireActionPerformed(Timer.java:271)
at javax.swing.Timer$DoPostEvent.run(Timer.java:201)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:141)
at java.awt.Dialog$1.run(Dialog.java:540)
at java.awt.Dialog.show(Dialog.java:561)
at java.awt.Component.show(Component.java:1133)
at java.awt.Component.setVisible(Component.java:1088)
at oracle.jbo.dt.ui.main.dlg.DtjDialog.setVisible(DtjDialog.java:137)
at oracle.jbo.dt.ui.main.dlg.DtjMddWizardDialog.setVisible(DtuWizard.java:1922)
at oracle.bali.ewt.dialog.JEWTDialog.runDialog(Unknown Source)
at oracle.jbo.dt.ui.main.dlg.DtjDialog.showDialog(DtjDialog.java:115)
at oracle.jbo.dt.ui.main.dlg.DtjMddWizardDialog.showDialog(DtuWizard.java:1881)
at oracle.jbo.dt.ui.main.dlg.DtuWizard.createMddWizard(DtuWizard.java:422)
at oracle.jbo.dt.ui.main.dlg.DtuWizard.setVisible(DtuWizard.java:276)
at oracle.jbo.dt.ui.main.dlg.DtuWizard.showDialog(DtuWizard.java:254)
at oracle.jbo.dt.jdevx.ui.JdxMenuManager.invokePackageWizard(JdxMenuManager.java:877)
at oracle.jbo.dt.jdevx.ui.JdxMenuManager.invokePackageWizard(JdxMenuManager.java:854)
at oracle.jbo.dt.ui.main.DtuMenuManager.doEditMenuAction(DtuMenuManager.java:1150)
at oracle.jbo.dt.ui.main.DtuMenuManager.doMenuAction(DtuMenuManager.java:1006)
at oracle.jbo.dt.jdevx.ui.JdxMenuManager.doMenuAction(JdxMenuManager.java:533)
at oracle.jbo.dt.ui.main.DtuMenuManager.doAction(DtuMenuManager.java:838)
at oracle.jbo.dt.ui.main.DtuMenuManager.doAction(DtuMenuManager.java:823)
at oracle.jbo.dt.jdevx.ui.JdxMenuManager.doActionPerformed(JdxMenuManager.java:391)
at oracle.jbo.dt.jdevx.ui.JdxMenuInvoker.run(JdxMenuManager.java:1076)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
I tried restarting JDeveloper but it still persists. Any help in this regard would be appreciated.
Warm Regards,
Jasmine.public WizardPage getPageAt(int index)
Returns a page by index.
Parameters:
index - the page index
Throws:
ArrayIndexOutOfBoundsException - If an invalid index was given
Try to check your implementation before the error existed. If you think the code is correct try to CLEAN your project (I mean, go to RUN then select clean). Then try to recompile. Sometimes intermittent errors appears when your code is not clean.
TIP:
* In JDEV the XML file (PageDef) is updated automatically, try to look at those files because there are times when you remove something, the XML is not properly updated (you have to clean it manually sometimes in explorer).
*The code is autogenerated when you add something, right. Sometimes the arrangement of code affects the output.
I hope this can help you somehow. God bless.
Cykun -
Rutime error: ArrayIndexOutOfBoundsException -- though i'm using a vector!!
hello,
here is my situation,
I have a vector in which u find classes' names in the following order:
v.get[0] contains a class name
v.get[1] contains a class that inherits from v.get[0]
v.get[2] contains a class( it may b the same as v.get[0] or v.get[1])
v.get[3] contains a class that inherits from v.get[2]
etc....
so I have to write a code that draws me the tree inheritance( I can have many trees so i have to find first the different roots)
here is the code i wrote but i still have an error at runtime and i hope u can help me
import java.util.*;
public class DrawClasses{
public static void main(String args[]){
draw();
public static void draw() throws ArrayIndexOutOfBoundsException{
String s="";
int sum=0;
Vector< String > v = new Vector< String >();
Vector< String > v1 = new Vector< String >();
Vector< String > v2 = new Vector< String >();
v.add("A");// A is the first root
v.add("B");
v.add("A");
v.add("C");
v.add("A");
v.add("D");
v.add("B");
v.add("E");
v.add("B");
v.add("F");
v.add("B");
v.add("G");
v.add("C");
v.add("H");
v.add("C");
v.add("I");
v.add("D");
v.add("J");
v.add("G");
v.add("K");
v.add("G");
v.add("L");
v.add("I");
v.add("M");
v.add("Z");// Z is the other root
v.add("O");
v.add("Z");
v.add("P");
for(int i=0; i<v.size(); i++) //get distinct classes and fill them in vector v1
if( v1.contains(v.get(i))){}
else {v1.add(v.get(i));}
for(int i=0;i<v1.size();i++)//get root classes and fill them in vector v2
for(int j=0;j<v.size();j++)
if (v.get(j).equals(v1.get(i)))
if(j%2!=0){sum=sum+1; }
if(sum==0)
{v2.add(v1.get(i));}
sum=0;
for(int i=0;i<=v1.size();i++) // get the tree for each root class
if(v2.contains(v1.get(i)))
System.out.println(v1.get(i)+" is root");
for(int j=0;j<=v1.size();j++)
for(int k=0;k<v.size();k++)
if(v1.get(j)==v.get(k) && k%2==0)
if(v2.contains(v1.get(j)) && !v1.get(j).equals(v1.get(i))){} else
System.out.println(v.get(k+1)+" inherits from "+v1.get(j));
//ListIterator iter = v2.listIterator();
//while (iter.hasNext()) {
//System.out.println((String)iter.next());}
NB:the runtime gives me the output only for one tree and then it gives me the error at runtime
Thank youBut if you had been programming in Java (instead of bastardized C) you wouldn't have had that problem. Instead of this:
for(int i=0; i<v.size(); i++) //get distinct classes and fill them in vector v1
if( v1.contains(v.get(i))){}
else {v1.add(v.get(i));}
}you could write this:
for (String s: v) {
if ( ! v1.contains(s)) {
v1.add(s);
}This does bring up the question about why you don't just use a Set if you want to store only distinct entries. And there's the question of why you're using the obsolete Vector class. But let's leave it there for now. -
How to resolve ArrayIndexOutOfBoundsException
Hello,
I've an issue in running a program which throws ArrayIndexOutOfBoundsException. The program tries to insert many records in multiple tables. Sometime it works fine without any issue and sometime it fail. I believe that its because of the data what I select to trigger the event.
I have 2 set of data which trigger an event for the insertion of records. The both dataset are same. Using the first one it works fine and using the second it give me an Exception ArrayIndexOutOfBoundsException.
Please find the Stack Trace from the Logs of the event which ended up in failure. Please someone help me try to understand why its failing.
2010-04-15 14:35:26,981 [WebContainer : 10] ERROR DS-UTIL - ERROR: class java.lang.ArrayIndexOutOfBoundsException Exception caught during insert: -32393
java.lang.ArrayIndexOutOfBoundsException: -32393
at oracle.jdbc.driver.OraclePreparedStatement.setupBindBuffers(OraclePreparedStatement.java:2673)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10689)
at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.pmiExecuteBatch(WSJdbcPreparedStatement.java:958)
at com.ibm.ws.rsadapter.jdbc.WSJdbcStatement.executeBatch(WSJdbcStatement.java:705)
at com.labvantage.sapphire.DataSetUtil.insert(DataSetUtil.java:191)
at com.labvantage.sapphire.actions.sdidata.AddDataSet.processAction(AddDataSet.java:361)
at sapphire.action.BaseAction.processAction(BaseAction.java:81)
at com.labvantage.sapphire.services.ActionService.processActionClass(ActionService.java:371)
at com.labvantage.sapphire.services.ActionService.processAction(ActionService.java:256)
at com.labvantage.sapphire.services.ActionService.processAction(ActionService.java:178)
at com.labvantage.sapphire.actions.workitem.AddSDIWorkItem.applyWorkItemItem(AddSDIWorkItem.java:595)
at com.labvantage.sapphire.actions.workitem.AddSDIWorkItem.applyWorkItem(AddSDIWorkItem.java:519)
at com.labvantage.sapphire.actions.workitem.AddSDIWorkItem.processAction(AddSDIWorkItem.java:379)
at com.labvantage.sapphire.actions.workitem.AddSDIWorkItem.processAction(AddSDIWorkItem.java:223)
at sapphire.action.BaseAction.processAction(BaseAction.java:81)
at com.labvantage.sapphire.services.ActionService.processActionClass(ActionService.java:371)
Thanks in advance!!Hello,
I've an issue in running a program which throws ArrayIndexOutOfBoundsException. The program tries to insert many records in multiple tables. Sometime it works fine without any issue and sometime it fail. I believe that its because of the data what I select to trigger the event.
I have 2 set of data which trigger an event for the insertion of records. The both dataset are same. Using the first one it works fine and using the second it give me an Exception ArrayIndexOutOfBoundsException.
Please find the Stack Trace from the Logs of the event which ended up in failure. Please someone help me try to understand why its failing.
2010-04-15 14:35:26,981 [WebContainer : 10] ERROR DS-UTIL - ERROR: class java.lang.ArrayIndexOutOfBoundsException Exception caught during insert: -32393
java.lang.ArrayIndexOutOfBoundsException: -32393
at oracle.jdbc.driver.OraclePreparedStatement.setupBindBuffers(OraclePreparedStatement.java:2673)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10689)
at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.pmiExecuteBatch(WSJdbcPreparedStatement.java:958)
at com.ibm.ws.rsadapter.jdbc.WSJdbcStatement.executeBatch(WSJdbcStatement.java:705)
at com.labvantage.sapphire.DataSetUtil.insert(DataSetUtil.java:191)
at com.labvantage.sapphire.actions.sdidata.AddDataSet.processAction(AddDataSet.java:361)
at sapphire.action.BaseAction.processAction(BaseAction.java:81)
at com.labvantage.sapphire.services.ActionService.processActionClass(ActionService.java:371)
at com.labvantage.sapphire.services.ActionService.processAction(ActionService.java:256)
at com.labvantage.sapphire.services.ActionService.processAction(ActionService.java:178)
at com.labvantage.sapphire.actions.workitem.AddSDIWorkItem.applyWorkItemItem(AddSDIWorkItem.java:595)
at com.labvantage.sapphire.actions.workitem.AddSDIWorkItem.applyWorkItem(AddSDIWorkItem.java:519)
at com.labvantage.sapphire.actions.workitem.AddSDIWorkItem.processAction(AddSDIWorkItem.java:379)
at com.labvantage.sapphire.actions.workitem.AddSDIWorkItem.processAction(AddSDIWorkItem.java:223)
at sapphire.action.BaseAction.processAction(BaseAction.java:81)
at com.labvantage.sapphire.services.ActionService.processActionClass(ActionService.java:371)
Thanks in advance!! -
ResourceBundle error in NetWeaver Developer Studio MI 2.5 SP16 Patch 3.
SAP NetWeaver Developer Studio
Version: 2.0.19
Build id: 200610270428
MDK Mobile Development Kit Tools v2.5.13
Java: j2sdk 1.4.0 Win
Mobile client: MI 2.5 SP16 Patch 3
Running MAU v1.0 SR 5
Downloaded:
MAM FOR UTILITIES 1 0 SP05 05042006
In the SAP NetWeaver Developer Studio I imported the MAU_eclipse.war from MAM FOR UTILITIES 1 0 SP05 05042006 using the MDK as MAU.war.
Yet, without implementing any changes, just to test, I exported the MAU project into a war file in the following path: C:\Program Files\SAP Mobile Infrastructure\webapps\MAU.war.
I renamed the existing folder C:\Program Files\SAP Mobile Infrastructure\webapps\MAU to MAU_Old
Then, I started MAU from within the NetWeaver Developer Studio by selecting Run, Run.
The client application launched and the new MAU.war file was automatically unpacked C:\Program Files\SAP Mobile Infrastructure\webapps\MAU
The application opens and can be successfully logged into from the SAP NetWeaver Developer Studio.
When the MOBILE ASSET MANAGEMENT FOR UTILITIES link is selected in the client application, error messages appear for example.
See below for the full error messages.
It appears the errors below might be somewhat straightforward, mentioning that the resource bundle could not be found.
Please assist regarding how to ensure the resource bundle can be found and properly loaded for example or what else could be the issue.
Please note that the application opens and can be successfully navigated by launching and logging into C:\Program Files\SAP Mobile Infrastructure\MobileEngine.exe directly.
The issue is launching from within the SAP NetWeaver Developer Studio for running or debugging.
Thanks in advance for your assistance.
Error in the console for the SAP NetWeaver Developer Studio:
java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key dispatcher.forwardException
at java.util.ResourceBundle.getObject(ResourceBundle.java:314)
at java.util.ResourceBundle.getString(ResourceBundle.java:274)
at org.apache.tomcat.util.StringManager.getString(StringManager.java:136)
at org.apache.tomcat.util.StringManager.getString(StringManager.java:155)
at org.apache.tomcat.util.StringManager.getString(StringManager.java:194)
at org.apache.tomcat.facade.RequestDispatcherImpl.doForward(RequestDispatcherImpl.java:238)
at org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:162)
at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:423)
at 0002fmam0005fstart_0002ejspmam_0005fstart_jsp_0._jspService(_0002fmam_0005fstart_0002ejspmam_0005fstart_jsp_0.java:62)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspCountedServlet.service(JspServlet.java:130)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:282)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:806)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:752)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:536)
Error on client is below:
Address: http://localhost:4444/MAU/start
Error: 500
Location: /MAU/home/home_mgmt.do
Internal Servlet Error:
javax.servlet.ServletException: cannot find message associated with key : dispatcher.forwardException
at org.apache.tomcat.facade.RequestDispatcherImpl.doForward(RequestDispatcherImpl.java:238)
at org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:162)
at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:423)
at 0002fmam0005fstart_0002ejspmam_0005fstart_jsp_0._jspService(_0002fmam_0005fstart_0002ejspmam_0005fstart_jsp_0.java:62)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspCountedServlet.service(JspServlet.java:130)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:282)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:806)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:752)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:536)Hello,
MDK plug in is as bad as NWDS itself. Since the mobile applications are really just a java application, you do not need special plugin for developing them. I STRONGLY suggest to take a look at this blog entry I did when I was working on MAM at SAP:
How to set up NWDS or Eclipse without MDK
Thank you,
Julien Guimont
msc mobile Canada inc.
http://www.msc-mobile.com -
HowTo get ResourceBundle from package?
Hello, again I have rather silly question.
I'm using maven to build simple Java application packaged as jar.
I have such structure:
myapp.ui.button
-SuperButton.java
-SuperButton.png
-SuperButton.properties
-SuperButton_ru_RU.properties.
Also I have a method which loads string from ResourceBundle:
public static String readFromBundle(Class clz, String key){
ResourceBundle resourceBundle = ResourceBundle.getBundle(clz.getName().toLowerCase()); //also tried clz.getName() and clz.getSimpleName(),
return resourceBundle.getString(key);
}The problem is that i get such error:
java.util.MissingResourceException: Can't find bundle for base name SuperButton, locale ru_RU
If I move SuperButton*.properties files to default package (i.e. root of the package structure), it works fine. My method locates ResourceBundle which I need and returns value by key.
But It's very bad, it the future I'll have several jars in one classpath and it's possible that different jars can have ResourceBundles with equal names. That is why I would like to keep each ResourceBundle in the package where i18n class is situated. With this approach ResourceBundles will not "cover" each other.
What do I do wrong? What do I have to do if I want to keep ResourceBundle in the same package with class? I don't wan't to keep resources in root.The problem was in installed artifact where displayed method is situated.
problem is solved. -
Which IndexOutOfBoundsException to throw and why?
I'm looking into FilterOutputStream implementation :
public void write(byte b[], int off, int len) throws IOException {
if ((off | len | (b.length - (len + off)) | (off + len)) < 0)
throw new IndexOutOfBoundsException();
for (int i = 0 ; i < len ; i++) {
write(b[off + i]);
}Can you explain the explicit range check above? I thought system performs boundry checking automatically throwing ArrayIndexOutOfBoundsException. I'm interested in the considerations overriding the method.If ArrayIndexOutOfBoundsException were thrown from that method, it would be because of an internal implementation error of the method itself. That's an implementation detail that the caller of the API should not have to be exposed to (that it is internally using an Array). On the other hand, IndexOutOfBoundsException directly relates to the Index (off or len parameters) being passed to the method.
-
Problem with Socket Programming
Hi
I have used java sockets in my program for installing a tool on different boxes.On running this server program on a linux box my client program is unable to listen to the socket on the linux box.It give a
ConnectionRefused exception in the client program which is running on the windows box.This behaviour is pretty inconsistent though.The version of linux is redhat 7.3 and the kernel is 2.4.18-3 on au i686 (valhalla) and the java version on the
linux ->1.4.0_01-b03,mixed mode.
The windows box also has j2sdk1.4.0.
Please reply urgently.I have used the same source to open sockets on windows and on solaris and it has worked consistenly.It is only the linux box that is inconsistent in listening to the sockets.
On the server i have used this part to open the socket:
public void process() throws Exception {
SocketChannel sc = null;
ServerSocketChannel ssc = null;
Selector acceptSelector = null;
try {
int port = Integer.parseInt(resourceBundle.getString("AUTH_PORT"));
System.out.println("Listening on Port:: "+port);
int socketTimeOut = Integer.parseInt(resourceBundle.getString("SOCKET_TIMEOUT"));
acceptSelector = SelectorProvider.provider().openSelector();
ssc = ServerSocketChannel.open();
ssc.configureBlocking(false);
InetAddress lh = InetAddress.getLocalHost();
InetSocketAddress isa = new InetSocketAddress(lh, port);
ssc.socket().bind(isa);
SelectionKey acceptKey = ssc.register(acceptSelector,SelectionKey.OP_ACCEPT);
int keysAdded = 0;
while ((keysAdded = acceptSelector.select()) > 0) {
// Someone is ready for I/O, get the ready keys
Set readyKeys = acceptSelector.selectedKeys();
Iterator i = readyKeys.iterator();
// Walk through the ready keys collection and process date requests.
while (i.hasNext()) {
boolean processFlag = true;
SelectionKey sk = (SelectionKey)i.next();
i.remove();
// The key indexes into the selector so you
// can retrieve the socket that's ready for I/O
ServerSocketChannel nextReady = (ServerSocketChannel)sk.channel();
// Accept the date request and send back the date string
sc = nextReady.accept();
so = sc.socket();
writeToLogFile ("Socket is ::"+so+"::",4);
// so.setSoTimeout(socketTimeOut);
writeToLogFile ("Before receiveAuthReqMessage",4);
ois = new ObjectInputStream(so.getInputStream());
receiveAuthReqMessage(); // receive AuthReqMessage.xml
writeToLogFile ("After receiveAuthReqMessage::"+processFlag,4);
// readAuthReqMessageData(); // reads the userName, password for validation
authenticate(); // validates username & password of client
sendAuthResMessage(); // feedback to client AuthResMessage.xml
if(validbool)
while (processFlag) {
processFlag = receiveRegReqMessage();
else
writeToLogFile ("INVALID : You are NOT a VALID user .......",0);
writeToLogFile ("Just before closing",4);
ois.close();
// sc.close();
// so.close();
} catch (Exception e) {
e.printStackTrace();
finally {
os.close();
sc.close();
ssc.close();
acceptSelector.close();
so.close();
and on the client part of the program i use this code to make the client listen to the server program:
public boolean openAuthSocket(String machineName) {
try{
int portNo = 0;
ResourceBundle resourceBundle = ResourceBundle.getBundle("GPSClientProperties", locale);
portNo = Integer.parseInt(resourceBundle.getString("AUTH_PORT"));
if (machineName == null) {
machineName = resourceBundle.getString("AUTH_MACHNAME");
authsocket =new Socket(machineName,portNo);
writeToLogFile("Authentication socket OPENED on authsocket: " +authsocket,4);
int socketTimeOut = Integer.parseInt(resourceBundle.getString("SOCKET_TIMEOUT"));
authsocket.setSoTimeout(socketTimeOut);
}catch (Exception e){
writeToLogFile("The exception in open socket is "+e,0);
e.printStackTrace();
return false;
return true; -
How to catch exception while validating the username and password in hbm
Hi,
I do want to set the username and password dynamically in hibernate.cfg.xml
Here below is my configuration file.
{code<hibernate-configuration>
<session-factory>
<property name="hibernate.bytecode.use_reflection_optimizer">false</property>
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.pool_size">10</property>
<property name="show_sql">true</property>
<property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<property name="current_session_context_class">thread</property>
<property name="show_sql">true</property>
</session-factory>
</hibernate-configuration>{code}
Also im getting that session factory object like the below code.
public class Sessions { private static SessionFactory sessionFactory; private static Configuration configuration = new Configuration(); static { try { String userName = GuigenserviceImpl.userName; String password = GuigenserviceImpl.password; String hostName = GuigenserviceImpl.hostName; String portNo = GuigenserviceImpl.portNo; String sId = GuigenserviceImpl.sId; configuration .setProperty("hibernate.connection.username", userName); configuration .setProperty("hibernate.connection.password", password); configuration.setProperty("hibernate.connection.url", "jdbc:oracle:thin:@" + hostName + ":" + portNo + ":" + sId); try { configuration.configure("/hibernate.cfg.xml"); sessionFactory = configuration.buildSessionFactory(); GuigenserviceImpl.strAccpted = "true"; } catch (Exception e) { e.printStackTrace(); GuigenserviceImpl.strAccpted = "false"; } } catch (HibernateException hibernateException) { GuigenserviceImpl.strAccpted = "false"; hibernateException.printStackTrace(); } catch (Throwable ex) { GuigenserviceImpl.strAccpted = "false"; ex.printStackTrace(); throw new ExceptionInInitializerError(ex); } } public static SessionFactory getSessionFactory() { return sessionFactory; }
So, in this above scenario, suppose if im giving the wrong password means exception should be caught and the string variable "GuigenserviceImpl.strAccpted" should be assigned to false.
But im getting the SQL Exception only in console like wrong username and password. And finally i couldn't able to catch the exception in Sessions class, static block.
Anyone can help me in catching that SQL Exception in my Sessions class and i need to handle that SQL Exception in my class.
Im getting this following exception message in my console.
INFO: configuring from resource: /hibernate.cfg.xml Apr 6, 2009 2:47:00 PM org.hibernate.cfg.Configuration getConfigurationInputStream INFO: Configuration resource: /hibernate.cfg.xml Apr 6, 2009 2:47:00 PM org.hibernate.cfg.Configuration doConfigure INFO: Configured SessionFactory: null Apr 6, 2009 2:47:00 PM org.hibernate.connection.DriverManagerConnectionProvider configure INFO: Using Hibernate built-in connection pool (not for production use!) Apr 6, 2009 2:47:00 PM org.hibernate.connection.DriverManagerConnectionProvider configure INFO: Hibernate connection pool size: 10 Apr 6, 2009 2:47:00 PM org.hibernate.connection.DriverManagerConnectionProvider configure INFO: autocommit mode: false Apr 6, 2009 2:47:00 PM org.hibernate.connection.DriverManagerConnectionProvider configure INFO: using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@192.168.1.12:1521:orcl Apr 6, 2009 2:47:00 PM org.hibernate.connection.DriverManagerConnectionProvider configure INFO: connection properties: {user=scott, password=****} Apr 6, 2009 2:47:01 PM org.hibernate.cfg.SettingsFactory buildSettings WARNING: Could not obtain connection metadata java.sql.SQLException: ORA-01017: invalid username/password; logon denied at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70) at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:131) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:204) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:406) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:399) at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOauth(T4CTTIoauthenticate.java:799) at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:368) at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:508) at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:203) at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:33) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:510) at java.sql.DriverManager.getConnection(DriverManager.java:525) at java.sql.DriverManager.getConnection(DriverManager.java:140) at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2073) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1298) at com.beyon.ezygui.server.Sessions.<clinit>(Sessions.java:39) at com.beyon.ezygui.server.GuigenserviceImpl.testRPC(GuigenserviceImpl.java:322) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
Thanks in advance.
Thanks & Regards,
Kothandaraman N.Hi,
Myself hardcoded that username and password checking like the below code.
String name = loginData.get("userName").toString();
String pswd = loginData.get("pswd").toString();
String hstName = loginData.get("hName").toString();
String prtNo = loginData.get("portNo").toString();
String sid = loginData.get("sId").toString();
SessionFactory sessionFactory = null;
try {
if (name.trim().equals(userName) && pswd.trim().equals(password)
&& hstName.trim().equals(hostName)
&& prtNo.trim().equals(portNo) && sid.trim().equals(sId)) {
sessionFactory = Sessions.getSessionFactory();
strAccpted = "true";
} else {
strAccpted = "false";
} catch (Exception e) {
e.printStackTrace();
strAccpted = "false";
}I have my own values in string objects, then comparing that values with the values from login form. If both values are matching, then i will do configurations in hibernate.
ResourceBundle resourceBundle = ResourceBundle
.getBundle("com.beyon.ezygui.server.Queries");
public static final String connection_url = resourceBundle
.getString("connection.url");
public static final String userName = resourceBundle.getString("userName");
public static final String password = resourceBundle.getString("password");
public static final String hostName = resourceBundle.getString("hostName");
public static final String portNo = resourceBundle.getString("portNo");
public static final String sId = resourceBundle.getString("sId");The above are the String objects i'm checking for the match with values from login form.
Thanks & Regards,
Kothandaraman N. -
I try to deploy dimension to target database, but deployment fails with "java.lang.ArrayIndexOutOfBoundsException" message.
Table, index and dimension are created physically without any problem, but general result is "Failed" because of this error.
I recreated repositories, played with locale settings in system and OWB, no luck.
I have no such problem on my second database/client machines.
OWB is 9.0.4.
What can cause this thing ?This is the only text that appears in message.
Database is Personal Oracle9i Release 9.2.0.1.0 for NT.
Now if I want to deploy dimension by right-clicking on it and selecting deploy i get window with message:
"No deployment actions were set for 1 objects.
Either the runtime platform connection is invalid or the objects are not eligible for a default deployment action.
Operation abandoned.
and have to deploy from deployment manager.
Now I noticed that during starting OWB creates file owb\bin\admin\unfoundkey.log with such contents (to the point of logon):
Unfound key: 8i.MAPPINGS.STEPTYPE:PARAMNAME
Exception detail:
java.util.MissingResourceException: Can't find resource for bundle oracle.wh.resource.InspectorDialogs, key 8i.MAPPINGS.STEPTYPE:PARAMNAME
at java.util.ResourceBundle.getObject(ResourceBundle.java:382)
at oracle.bali.rts.MultiResourceBundle.handleGetObject(Unknown Source)
at java.util.ResourceBundle.getObject(ResourceBundle.java:376)
at java.util.ResourceBundle.getString(ResourceBundle.java:354)
at oracle.wh.util.NLSUtils.getNLSString(NLSUtils.java:228)
at oracle.wh.service.impl.integrator.weakconfig.ConfigParamImpl.translate(ConfigParamImpl.java:42)
at oracle.wh.service.impl.integrator.weakconfig.ConfigParamImpl.init(ConfigParamImpl.java:17)
at oracle.wh.service.impl.integrator.xml.XMLParseMachine.startElement(XMLParseMachine.java:60)
at oracle.wh.service.impl.integrator.xml.XMLResolve.startElement(XMLResolve.java:147)
at oracle.xml.parser.v2.XMLContentHandler.startElement(XMLContentHandler.java:166)
at oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1082)
at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:287)
at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:254)
at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:141)
at oracle.wh.service.impl.integrator.xml.XMLResolve.parseLocation(XMLResolve.java:96)
at oracle.wh.service.impl.integrator.xml.XMLResolve.parseXML(XMLResolve.java:66)
at oracle.wh.service.impl.integrator.xml.XMLResolve.resolveAll(XMLResolve.java:24)
at oracle.wh.service.impl.integrator.IntegratorController.init(IntegratorController.java:21)
at oracle.wh.util.ControllerInitializer.initControllers(ControllerInitializer.java:118)
at oracle.wh.util.ControllerInitializer.initBackendControllers(ControllerInitializer.java:36)
at oracle.wh.util.ControllerInitializer.initAllControllers(ControllerInitializer.java:22)
at oracle.wh.ui.framework.StaticLoader.main(StaticLoader.java:114)
Unfound key: 8i.MAPPINGS.STEPTYPE:DESCRIPTION
Exception detail:
java.util.MissingResourceException: Can't find resource for bundle oracle.wh.resource.InspectorDialogs, key 8i.MAPPINGS.STEPTYPE:DESCRIPTION
at java.util.ResourceBundle.getObject(ResourceBundle.java:382)
at oracle.bali.rts.MultiResourceBundle.handleGetObject(Unknown Source)
at java.util.ResourceBundle.getObject(ResourceBundle.java:376)
at java.util.ResourceBundle.getString(ResourceBundle.java:354)
at oracle.wh.util.NLSUtils.getNLSString(NLSUtils.java:228)
at oracle.wh.service.impl.integrator.weakconfig.ConfigParamImpl.translate(ConfigParamImpl.java:42)
at oracle.wh.service.impl.integrator.weakconfig.ConfigParamImpl.init(ConfigParamImpl.java:18)
at oracle.wh.service.impl.integrator.xml.XMLParseMachine.startElement(XMLParseMachine.java:60)
at oracle.wh.service.impl.integrator.xml.XMLResolve.startElement(XMLResolve.java:147)
at oracle.xml.parser.v2.XMLContentHandler.startElement(XMLContentHandler.java:166)
at oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1082)
at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:287)
at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:254)
at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:141)
at oracle.wh.service.impl.integrator.xml.XMLResolve.parseLocation(XMLResolve.java:96)
at oracle.wh.service.impl.integrator.xml.XMLResolve.parseXML(XMLResolve.java:66)
at oracle.wh.service.impl.integrator.xml.XMLResolve.resolveAll(XMLResolve.java:24)
at oracle.wh.service.impl.integrator.IntegratorController.init(IntegratorController.java:21)
at oracle.wh.util.ControllerInitializer.initControllers(ControllerInitializer.java:118)
at oracle.wh.util.ControllerInitializer.initBackendControllers(ControllerInitializer.java:36)
at oracle.wh.util.ControllerInitializer.initAllControllers(ControllerInitializer.java:22)
at oracle.wh.ui.framework.StaticLoader.main(StaticLoader.java:114)
Running deployment manager creates more entries in it, starting with "Unfound key: Find... [exception details...] Unfound key: Expand" and so on.
Maybe it has something to do with it... -
resource-bundle tag of portlet.xml
Hi.
I'd like to use resource bundle. Therefore I add following tags inside <portlet> tag of portlet.xml and create 'testprofile.properties' file.
<resource-bundle>testprofile</resource-bundle>
But when I start tomcat, the error occured like following.
2004-08-05 12:01:45,437 ERROR [main]
java.lang.NullPointerException
at java.io.Reader.<init>(Reader.java:61)
at java.io.InputStreamReader.<init>(InputStreamReader.java:80)
at java.util.Properties.load(Properties.java:189)
at java.util.PropertyResourceBundle.<init>(PropertyResourceBundle.java:96)
at com.plumtree.portlet.util.PortletInfo.addPropertyBundles(PortletInfo.java:425)
at com.plumtree.portlet.servlet.PortletServlet.digestPortletXml(PortletServlet.java:527)
at com.plumtree.portlet.servlet.PortletServlet.initDigester(PortletServlet.java:651)
at com.plumtree.portlet.servlet.PortletServlet.init(PortletServlet.java:60)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:935)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:823)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContex ...
So I modified portlet.xml like following and try to start tomcat again.
<resource-bundle>testprofile.properties</resource-bundle>
Tomcat can be started successfully.
But when I display the portlet, error occured.
java.util.MissingResourceException: Can't find resource for bundle com.plumtree.portlet.util.PortletResourceBundle, key LogLevel at java.util.ResourceBundle.getObject(ResourceBundle.java:314) at java.util.ResourceBundle.getString(ResourceBundle.java:274) at portlet.TWNewMailPortlet.init(TWNewMailPortlet.java:45) at com.plumtree.portlet.servlet.BaseServlet.init(BaseServlet.java:522) at com.plumtree.portlet.servlet.PortletServlet.service(PortletServlet.java:136)
The properties file 'testprofile.properties' is not loaded successfully, maybe.
Do you know how to specify or use ResouceBundle in using Plumtree JSR168?
The tips of source code is following
In Portlet class which extends GenericPortlet
public void init(PortletConfig config) throws PortletException { super.init(config); PortletLogger.init("Test", getPortletContext()); ResourceBundle rb = getResourceBundle(Locale.getDefault()); for (Enumeration e = rb.getKeys(); e.hasMoreElements(); ) { String str = (String)e.nextElement(); System.out.println(str); } String level = rb.getString("LogLevel"); PortletLogger.setLevel(level); }Are you naming your resource bundles something like:
1. messages_en.properties (for English)
2. messages_de.properties (for German)
and so on.
Also, do you include these properties files in your final deployment package, because if they're not there then the messages won't be displayed.
Maybe you are looking for
-
I want to add a new language for peoplesoft. For example: I want to add the simple Chinese to the HRCS system. It stops at somewhere, and then I want to do it again, so I kill the old process and then use data mover to add the language. It will tell
-
Posting with Incomplete Header
Hi all, I need to post a certain cancellation invoice so that a report (KE24 - COPA Line Item Report) will be corrected. however, the problem is that the Cancellation Invioce displays an error Foreign Trade Missing. AND, we cannot update this as the
-
Autoconfiguration of Mac Mail (OS X, iOS)
Hi, I work for freemail service (4m+ users). When a user is trying to configure his/her mail account in OS X or iOS, the GUI automatically sets the information for our domain -- servers and ports for POP3 and SMTP. It seems that Apple knows some info
-
I am trying to edit phots from Aperture in Photoshop. When the photo is back in Aperture as a psd file it does not apprear. Message of unsupported format appears. Does anyone have a list of supported formats? psd, tif, pdf all seem to be unsupport
-
Can't connect through "extention"
I cannot connect through "extentions" in Illustrator CS4, which I just recently purchased. I can get to the Kuler site, but not through a Kuler desktop program. I'm lost. Any suggestions? I read another thread on this problem, but it's from 2008!